linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Deepa Dinamani <deepa.kernel@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	kbuild test robot <lkp@intel.com>,
	kbuild-all@01.org, Ingo Molnar <mingo@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	y2038 Mailman List <y2038@lists.linaro.org>
Subject: Re: [PATCH] trace: Make trace_hwlat timestamp y2038 safe
Date: Mon, 27 Mar 2017 14:02:46 -0700	[thread overview]
Message-ID: <CABeXuvpwLhXCVyBitpFBKAan+5CbnszfvK-=shQYaEeCwyhA7A@mail.gmail.com> (raw)
In-Reply-To: <CAK8P3a2Tm0qFiMx7VgK8bprncCCJ_w0ePrqPU3ex4LVm4fceaw@mail.gmail.com>

>>> >
>>> >    kernel/trace/trace_output.c: In function 'trace_hwlat_print':
>>> >>> kernel/trace/trace_output.c:1168:5: warning: format '%lld' expects argument of type 'long long int', but argument 6 has type '__kernel_time_t' [-Wformat=]
>>> >         field->timestamp.tv_nsec);
>>>
>>> This happens on 64-bit architectures because 'struct timespec64' is defined to
>>> be equal to 'struct timespec', which has a 'long' tv_sec rather than
>>> 'long long'.
>>>
>>> A cast to 's64' is probably the best workaround.

We have been using long long cast to print timespec64 tv_sec.

I'm not sure what format specifier we would use if we cast to s64.
printk-formats suggests %lld or %llx.
Meaning a cast to long long.

>>>
>>> >    kernel/trace/trace_output.c: In function 'trace_hwlat_raw':
>>> >    kernel/trace/trace_output.c:1202:5: warning: format '%lld' expects argument of type 'long long int', but argument 5 has type '__kernel_time_t' [-Wformat=]
>>> >         field->seqnum);
>>>
>>> Same here.
>>>
>>
>> Actually, I believe that "%zd" will work. It's made to work with size_t
>> which is long long on 32 and long on 64.
>
> size_t is always 'long', not 'long long'. We have %pad for dma_addr_t
> which may be 'long' or 'long long', but it is configuration dependent
> which one it is on 32-bit.
>
> We could probably introduce a %pts format string for timespec64
> and have that pretty-printed.

dma_addr_t can be u64 or u32 based on architecture be it 32 bit or 64 bit.
But, timespec64 tv_sec is always s64. This is the opposite problem
from dma_addr_t that it is 64 bits regardless of architecture.
So, wouldn't it be easier to use long long cast for tv_sec and then
print tv_nsec as long?

-Deepa

  parent reply	other threads:[~2017-03-27 21:02 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-26 20:57 [PATCH] trace: Make trace_hwlat timestamp y2038 safe Deepa Dinamani
2017-03-27  9:25 ` kbuild test robot
2017-03-27  9:55   ` Arnd Bergmann
2017-03-27 14:28     ` Steven Rostedt
2017-03-27 14:53       ` Arnd Bergmann
2017-03-27 15:30         ` Steven Rostedt
2017-03-27 15:35           ` Arnd Bergmann
2017-03-27 16:11             ` Steven Rostedt
2017-03-27 21:02         ` Deepa Dinamani [this message]
2017-03-28  7:26           ` Arnd Bergmann
2017-03-27 10:04 ` kbuild test robot
  -- strict thread matches above, loose matches on Subject: below --
2017-03-16 13:56 [PATCH] acpi: fix incompatibility with mcount-based function graph tracing Josh Poimboeuf
2017-03-16 14:41 ` Steven Rostedt
2017-03-21 20:44 ` Paul Menzel
2017-03-22  0:04   ` Paul Menzel
2017-03-24 18:12   ` Josh Poimboeuf
2017-03-24 18:41     ` Steven Rostedt
2017-03-25 13:20       ` Rafael J. Wysocki
2017-03-27 14:08         ` Josh Poimboeuf
2017-03-27 14:54           ` [PATCH] ftrace/x86: fix x86-32 triple fault with graph tracing and suspend-to-ram Josh Poimboeuf
2017-03-27 15:01             ` Paul Menzel
2017-03-27 15:20               ` [PATCH v2] " Josh Poimboeuf
2017-03-27 15:24               ` [PATCH] " Steven Rostedt
2017-03-28  9:51               ` Paul Menzel
2017-03-28 15:39                 ` Steven Rostedt
2017-03-28 15:55                   ` Josh Poimboeuf
2017-03-28 21:12                     ` Rafael J. Wysocki
2017-03-28 21:42                       ` Josh Poimboeuf
2017-03-28 21:47                         ` Rafael J. Wysocki
2017-03-27 16:59           ` [PATCH] acpi: fix incompatibility with mcount-based function graph tracing Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABeXuvpwLhXCVyBitpFBKAan+5CbnszfvK-=shQYaEeCwyhA7A@mail.gmail.com' \
    --to=deepa.kernel@gmail.com \
    --cc=arnd@arndb.de \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).