Re: [PATCH 04/37] staging/lustre: tracefile: use 64-bit seconds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sep 23, 2015, at 3:13 PM, Arnd Bergmann wrote:

> The lustre tracefile has a timestamp defined as
> 
>       __u32 ph_sec;
>       __u64 ph_usec;
> 
> which seems completely backwards, as the microsecond portion of
> a time stamp will always fit into a __u32 value, while the second
> portion will overflow in 2038 or 2106 (in case of unsigned seconds).
> 
> This rectifies the situation by swapping out the types to have
> 64-bit seconds like everything else.
> 
> While this constitutes an ABI change, it seems to be reasonable
> for a debugging interface to change and is likely what was
> originally intended.

This is going to wreak some havoc as the old tools would obviously
misrepresent this, but the new tools also cannot assume blindly
this change is in place, since people tend to stick to old
lustre modules for a long time in production for various reasons,
while the tools might get upgraded.
So I wonder if we should include some sort of a hint somewhere that
the lctl could read and see which format it's going to convert from.
Either that or we'd need to play with some heuristic in the tools
to observe where the leading zeros are (in little ending) in one
and the other case (if the year is not quite 2038 yet) and
make a decision based on that.

> 
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h   | 4 ++--
> drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 8 ++++----
> 2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
> index a3aa644154e2..dfb81022397d 100644
> --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
> +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
> @@ -73,8 +73,8 @@ struct ptldebug_header {
> 	__u32 ph_mask;
> 	__u16 ph_cpu_id;
> 	__u16 ph_type;
> -	__u32 ph_sec;
> -	__u64 ph_usec;
> +	__u64 ph_sec;
> +	__u32 ph_nsec;
> 	__u32 ph_stack;
> 	__u32 ph_pid;
> 	__u32 ph_extern_pid;
> diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
> index 87d844953522..fad272d559c4 100644
> --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
> +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
> @@ -191,16 +191,16 @@ cfs_set_ptldebug_header(struct ptldebug_header *header,
> 			struct libcfs_debug_msg_data *msgdata,
> 			unsigned long stack)
> {
> -	struct timeval tv;
> +	struct timespec64 ts;
> 
> -	do_gettimeofday(&tv);
> +	ktime_get_real_ts64(&ts);
> 
> 	header->ph_subsys = msgdata->msg_subsys;
> 	header->ph_mask = msgdata->msg_mask;
> 	header->ph_cpu_id = smp_processor_id();
> 	header->ph_type = cfs_trace_buf_idx_get();
> -	header->ph_sec = (__u32)tv.tv_sec;
> -	header->ph_usec = tv.tv_usec;
> +	header->ph_sec = ts.tv_sec;
> +	header->ph_nsec = ts.tv_nsec;
> 	header->ph_stack = stack;
> 	header->ph_pid = current->pid;
> 	header->ph_line_num = msgdata->msg_line;
> -- 
> 2.1.0.rc2
> 

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux