From: Jon Hunter <jon-hunter@ti.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH 1/2] Dynamic Tick: Prevent clocksource wrapping during idle
Date: Thu, 25 Jun 2009 14:10:49 -0500 [thread overview]
Message-ID: <4A43CBB9.7040903@ti.com> (raw)
In-Reply-To: <4A282089.5020103@ti.com>
Jon Hunter wrote:
> Jon Hunter wrote:
>> Jon Hunter wrote:
>>> + * Calculate the time delta for the next timer event.
>>> + * If the time delta exceeds the maximum time delta
>>> + * permitted by the current clocksource then adjust
>>> + * the time delta accordingly to ensure the
>>> + * clocksource does not wrap.
>>> + */
>>> + time_delta = tick_period.tv64 * delta_jiffies;
>> Thinking about this more, although it is very unlikely, for 64-bit
>> machines there is a chance that the above multiply could overflow if
>> delta_jiffies is very large.
>>
>> tick_period.tv64 should always be less than NSEC_PER_SEC and so you
>> would need delta_jiffies to be greater than 2^32 to cause overflow. On a
>> 32-bit machine an unsigned long will not be greater than 2^32 as it is
>> only 32-bits but this would be possible on a 64-bit machines.
>>
>> So to be safe we should make sure that delta_jiffies is not greater than
>> NEXT_TIMER_MAX_DELTA (2^30 - 1) before doing the multiply. If you
>> think that this is a valid concern, then I can re-work and re-post.
>> Sorry for not catching this before.
>
> With regard to the above, to ensure that there are no overflows with the
> above calculation, I re-worked this patch a little. The below should be
> equivalent to the current code, just re-organised a little. Let me know
> if this would be acceptable or not.
Hi Thomas, John,
Did you guys have chance to review this? Let me know if you have any
further comments/feedback.
Cheers
Jon
next prev parent reply other threads:[~2009-06-25 19:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 14:49 [PATCH 1/2] Dynamic Tick: Prevent clocksource wrapping during idle Jon Hunter
2009-05-27 16:01 ` Thomas Gleixner
2009-05-27 20:20 ` john stultz
2009-05-27 20:32 ` Thomas Gleixner
2009-05-28 20:21 ` Jon Hunter
2009-05-28 20:36 ` Thomas Gleixner
2009-05-28 21:10 ` Jon Hunter
2009-05-28 21:43 ` John Stultz
2009-05-28 22:16 ` Thomas Gleixner
2009-05-29 19:43 ` Jon Hunter
2009-05-30 1:00 ` Jon Hunter
2009-06-04 19:29 ` Jon Hunter
2009-06-25 19:10 ` Jon Hunter [this message]
2009-05-27 18:15 ` john stultz
2009-05-27 20:54 ` Alok Kataria
2009-05-27 21:12 ` Thomas Gleixner
-- strict thread matches above, loose matches on Subject: below --
2009-07-28 0:00 [PATCH 0/2] Dynamic Tick: Enabling longer sleep times on 32-bit Jon Hunter
2009-07-28 0:00 ` [PATCH 1/2] Dynamic Tick: Prevent clocksource wrapping during idle Jon Hunter
2009-08-18 17:45 [PATCH 0/2] Dynamic Tick: Enabling longer sleep times on 32-bit machines Jon Hunter
2009-08-18 17:45 ` [PATCH 1/2] Dynamic Tick: Prevent clocksource wrapping during idle Jon Hunter
2009-08-18 19:25 ` Thomas Gleixner
2009-08-18 20:42 ` Jon Hunter
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=4A43CBB9.7040903@ti.com \
--to=jon-hunter@ti.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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