public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Clark Williams <williams@redhat.com>
Subject: Re: [PATCH] Greatly improve TSC calibration using a delayed workqueue
Date: Mon, 08 Nov 2010 14:04:47 -0800	[thread overview]
Message-ID: <1289253887.2798.40.camel@localhost.localdomain> (raw)
In-Reply-To: <20101107204153.GA17592@basil.fritz.box>

On Sun, 2010-11-07 at 21:41 +0100, Andi Kleen wrote:
> Hi John,
> 
> > +	/*
> > +	 * Since the timer is started early in boot, we may be
> > +	 * delayed the first time we expire. So set the timer
> > +	 * again once we know timers are working.
> > +	 */
> > +	if (tsc_start == -1) {
> > +		/*
> > +		 * Only set hpet once, to avoid mixing hardware
> > +		 * if the hpet becomes enabled later.
> > +		 */
> > +		hpet = is_hpet_enabled();
> > +		schedule_delayed_work(&tsc_irqwork, HZ);
> > +		tsc_start = tsc_read_refs(&ref_start, hpet);
> > +		return;
> > +	}
> > +
> > +	tsc_stop = tsc_read_refs(&ref_stop, hpet);
> 
> The HPET init code stops, starts the HPET. I think you need some
> way to protect against that here, e.g. a variable and rearming the 
> timer if it's true.

Interesting. Thanks for pointing that out! Couldn't I just start the
calibration after fs_initcall (when the hpet_late_init runs) to avoid
this as well? 

> Another issue may be races against suspend, but that may be too
> obscure.

Yea, that seems fairly obscure. Basically you'd have to suspend in the
first second as the system came up. In that case the code will throw out
any calibration refinement that's over 1% off of the initial boot
calibration, so I think this is ok trade off.

> I also worry a bit about NMIs etc. running later during this
> and messing up the measurement, but I guess the longer period
> makes up for it.

Yea, the 1 second period should help minimize any disturbance, and
again, this is just a refinement over the existing calibration, so if
its more then 1% off of the boot time fast calibration, we'll throw it
out.

> The rest of the patch looks ok to me.

Thanks for the review!
-john


  reply	other threads:[~2010-11-08 22:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-06  0:39 [PATCH] Greatly improve TSC calibration using a delayed workqueue John Stultz
2010-11-07 20:41 ` Andi Kleen
2010-11-08 22:04   ` john stultz [this message]
2010-11-09 13:43     ` Andi Kleen
2010-11-09 21:41       ` john stultz
2010-11-10 13:47         ` Andi Kleen
2010-12-05 11:18 ` [tip:x86/tsc] x86: Improve " tip-bot for John Stultz
2011-01-11  8:13   ` Kirill A. Shutemov
2011-01-11  8:26     ` Thomas Gleixner
2011-01-11  8:30       ` Kirill A. Shutemov
2011-01-11  8:37         ` Thomas Gleixner
2011-01-11  9:56           ` Kirill A. Shutemov
2011-01-11 10:26             ` Thomas Gleixner
2011-01-13 17:49             ` Konrad Rzeszutek Wilk
2011-01-13 18:01               ` john stultz
2011-01-13 21:40                 ` [PATCH] acpi/pm: If failed at validating ACPI PM timer, inhibit future reads Konrad Rzeszutek Wilk
2011-01-13 22:15                   ` Thomas Gleixner
2011-01-14 14:09                     ` Konrad Rzeszutek Wilk
2011-01-14 15:44                       ` john stultz
2011-01-14 15:54                         ` john stultz
2011-01-14 16:02                           ` Thomas Gleixner
2011-01-14 16:33                             ` john stultz
2011-01-14 16:28                           ` Konrad Rzeszutek Wilk
  -- strict thread matches above, loose matches on Subject: below --
2010-11-10 21:51 [PATCH] Greatly improve TSC calibration using a delayed workqueue 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=1289253887.2798.40.camel@localhost.localdomain \
    --to=johnstul@us.ibm.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.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