Skip to contentSkip to conversation

fnic: Use time64_t to represent trace timestamps

PATCH Applied Deepa Dinamani 3 participants 3 messages Oct 1, 2016 – Oct 11, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fnic: Use time64_t to represent trace timestamps

trace timestamps use struct timespec and CURRENT_TIME which are not y2038 safe.
These timestamps are only part of the trace log on the machine and are not shared with the fnic.
Replace then with y2038 safe struct timespec64 and ktime_get_real_ts64(), respectively.

Cc Hiral Patel <[email protected]>
Cc Suma Ramars <[email protected]>
Cc Brian Uchino <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
---
 drivers/scsi/fnic/fnic_trace.c | 4 ++--
 drivers/scsi/fnic/fnic_trace.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/fnic/fnic_trace.c +2 -2
index 4e15c4b..5a5fa01 100644
@@ -613,7 +613,7 @@ int fnic_fc_trace_set_data(u32 host_no, u8 frame_type,
 			fc_trace_entries.rd_idx = 0;
 	}
 
-	fc_buf->time_stamp = CURRENT_TIME;
+	ktime_get_real_ts64(&fc_buf->time_stamp);
 	fc_buf->host_no = host_no;
 	fc_buf->frame_type = frame_type;
 
@@ -740,7 +740,7 @@ void copy_and_format_trace_data(struct fc_trace_hdr *tdata,
 
 	len = *orig_len;
 
-	time_to_tm(tdata->time_stamp.tv_sec, 0, &tm);
+	time64_to_tm(tdata->time_stamp.tv_sec, 0, &tm);
 
 	fmt = "%02d:%02d:%04ld %02d:%02d:%02d.%09lu ns%8x       %c%8x\t";
 	len += snprintf(fnic_dbgfs_prt->buffer + len,
drivers/scsi/fnic/fnic_trace.h +1 -1
index a8aa057..e375d0c 100644
@@ -72,7 +72,7 @@ struct fnic_trace_data {
 typedef struct fnic_trace_data fnic_trace_data_t;
 
 struct fc_trace_hdr {
-	struct timespec time_stamp;
+	struct timespec64 time_stamp;
 	u32 host_no;
 	u8 frame_type;
 	u8 frame_len;
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Deepa Dinamani

trace timestamps use struct timespec and CURRENT_TIME which are not y2038 safe.
These timestamps are only part of the trace log on the machine and are not shared with the fnic.
Replace then with y2038 safe struct timespec64 and ktime_get_real_ts64(), respectively.

Cc Hiral Patel <[email protected]>
Cc Suma Ramars <[email protected]>
Cc Brian Uchino <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Quoted 1 line

---

Looks good,

Signature · 10 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038
#2 lore raw
In reply to Deepa Dinamani
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Deepa" == Deepa Dinamani <[email protected]> writes:

Deepa> trace timestamps use struct timespec and CURRENT_TIME which are Deepa> not y2038 safe. These timestamps are only part of the trace log Deepa> on the machine and are not shared with the fnic. Replace then Deepa> with y2038 safe struct timespec64 and ktime_get_real_ts64(), Deepa> respectively.

Applied to 4.10/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering