public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <johnstul@us.ibm.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Yong Zhang <yong.zhang0@gmail.com>,
	David Daney <ddaney.cavm@gmail.com>
Subject: Re: [PATCH] clocksource: Avoid selecting mult values that might overflow when adjusted
Date: Thu, 03 Nov 2011 10:09:31 -0400	[thread overview]
Message-ID: <1320329371.3681.20.camel@js-netbook> (raw)
In-Reply-To: <1320328869.3681.17.camel@js-netbook>

On Thu, 2011-11-03 at 10:01 -0400, John Stultz wrote:
> On Thu, 2011-11-03 at 14:26 +0100, Thomas Gleixner wrote:
> > On Thu, 3 Nov 2011, John Stultz wrote:
> > > On Thu, 2011-11-03 at 13:05 +0100, Thomas Gleixner wrote:
> > > > On Wed, 2 Nov 2011, John Stultz wrote:
> > > > >  
> > > > > +	WARN_ONCE(timekeeper.mult+adj >
> > > > > +			timekeeper.clock->mult + timekeeper.clock->maxadj,
> > > > > +			"Adjusting more then 11%%");
> > > > 
> > > > Shouldn't we rather limit the update instead of just warn and overflow ?
> > > 
> > > Well, I'm hesitant to commit to that, just yet. So I figured I'd start
> > > with the warning.
> > 
> > OTOH, we know right there that we might warp 32bit and confuse the
> > hell out of timekeeping, which is not a real good thing either.
> 
> Oh certainly, but two things:
> 1) The 11% max is not the actual overflow edge. Its just calculated as
> safe. The overflow could as far out as ~22%.
> 
> 2) This is the first case in however many years I've heard of of mult
> overflowing. So before we go changing the NTP code (which is really
> terribly complex, but has been working fairly well for awhile) I want to
> have some sense that the 11% max adjustment assumption is really
> correct.
> 
> But maybe I'm being too conservative? If we do limit the adjustment
> keeping the warning, I guess we'd know why things blew up on previously
> working machines. 

Oh, and the other bit is that not all clocksources have been converted
over to using clocksource_register_hz/khz, so some may be using very
small shift values, which could more easily hit large % mult adjustment
(due to the resulting coarseness of each integer change) that wouldn't
cause overflows.

thanks
-john


  reply	other threads:[~2011-11-03 14:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-02 20:01 [PATCH] clocksource: Avoid selecting mult values that might overflow when adjusted John Stultz
2011-11-03  3:10 ` Yong Zhang
2011-11-03  9:36   ` Américo Wang
2011-11-04  2:16     ` Yong Zhang
2011-11-03 12:05 ` Thomas Gleixner
2011-11-03 13:10   ` John Stultz
2011-11-03 13:26     ` Thomas Gleixner
2011-11-03 14:01       ` John Stultz
2011-11-03 14:09         ` John Stultz [this message]
2011-11-03 14:49           ` Thomas Gleixner
2011-11-03 14:52             ` Thomas Gleixner
2011-11-03 15:14               ` John Stultz
2011-11-03 21:10 ` Ingo Molnar
2011-11-04 13:11   ` John Stultz
2011-11-04 15:20     ` Ingo Molnar
2011-11-08  3:09   ` John Stultz
2011-11-08  3:11     ` Yong Zhang
2011-11-08  5:02     ` Yong Zhang
2011-11-08 21:39       ` John Stultz
2011-11-09  1:46         ` Yong Zhang
2011-11-10 15:05           ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2011-11-09  2:08 John Stultz

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=1320329371.3681.20.camel@js-netbook \
    --to=johnstul@us.ibm.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=yong.zhang0@gmail.com \
    /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