From: Jason Wessel <jason.wessel@windriver.com>
To: john stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] timekeeping: Fix overflow in rawtime tv_nsec on 32 bit archs
Date: Fri, 06 Aug 2010 10:09:43 -0500 [thread overview]
Message-ID: <4C5C25B7.4020902@windriver.com> (raw)
In-Reply-To: <1281046640.3405.18.camel@localhost.localdomain>
On 08/05/2010 05:17 PM, john stultz wrote:
> On Thu, 2010-08-05 at 07:28 -0500, Jason Wessel wrote:
>> The tv_nsec is a long and when added to the shift value it can wrap
>> and become negative which later causes looping problems in the
>> getrawmonotonic(). The edge case occurs when the system has slept for
>> a short period of time of ~2 seconds.
>
> Ah, good catch!
>
> I reworked some of the variable names to make a little more sense and
> simplified the accumulation. Do you mind giving this a test in your
> environment that triggered the issue to make sure nothing else slipped
> in?
>
No problem.
This looks good to me. I even increased the delay and I can see it recovers properly.
The instrumentation shows raw_nsecs would have otherwise been negative going from 90.* to 97.* in the log.
<...>-4801 [000] 90.105084: update_wall_time: raw_nsecs: 37283ea1
<...>-4801 [000] 90.109078: update_wall_time: raw_nsecs: 376547b4
<...>-4801 [000] 97.694264: update_wall_time: raw_nsecs: b1776db4
<...>-4801 [000] 97.694270: update_wall_time: raw_nsecs: b453ffb4
<...>-4801 [000] 97.694272: update_wall_time: raw_nsecs: 7b95c7b4
Note that I had instrumented it just after:
raw_nsecs += raw_time.tv_nsec;
We should send this over to -stable when it is considered baked because this was found in the 2.6.35 and may be a problem elsewhere as well.
Thanks,
Jason.
prev parent reply other threads:[~2010-08-06 15:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 12:28 [PATCH] timekeeping: Fix overflow in rawtime tv_nsec on 32 bit archs Jason Wessel
2010-08-05 22:17 ` john stultz
2010-08-06 15:09 ` Jason Wessel [this message]
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=4C5C25B7.4020902@windriver.com \
--to=jason.wessel@windriver.com \
--cc=hpa@zytor.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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