From: Ingo Molnar <mingo@kernel.org>
To: George Spelvin <linux@horizon.com>
Cc: a.p.zijlstra@chello.nl, adrian.hunter@intel.com,
ak@linux.intel.com, akpm@linux-foundation.org,
arjan@infradead.org, bp@alien8.de, hpa@zytor.com,
linux-kernel@vger.kernel.org, luto@amacapital.net,
penberg@iki.fi, tglx@linutronix.de,
torvalds@linux-foundation.org
Subject: Re: Discussion: quick_pit_calibrate is slow
Date: Wed, 10 Jun 2015 11:25:54 +0200 [thread overview]
Message-ID: <20150610092553.GA32269@gmail.com> (raw)
In-Reply-To: <20150610084703.3659.qmail@ns.horizon.com>
* George Spelvin <linux@horizon.com> wrote:
> > Could you please structure it the following way:
> >
> > - first a patch that fixes bogus comments about the current code. It has
> > bitrotten and if we change it significantly we better have a well
> > documented starting point that is easier to compare against.
Btw., we should make the patch fixing Adrian's system patch 0, as it looks simple
and obvious enough, agreed?
> > - then a patch that introduces your more accurate calibration method and
> > uses it as the first method to calibrate. If it fails (and it should have a
> > notion of failing) then it should fall back to the other two methods.
> >
> > - possibly add a boot option to skip your new calibration method -
> > i.e. to make the kernel behave in the old way. This would be useful
> > for tracking down any regressions in this.
> >
> > - then maybe add a patch for the RTC method, but as a .config driven opt-in
> > initially.
>
> Sonds good, but when do we get to the decruftification? I'd prefer to prepare
> the final patch (if nothing else, so Linus will be reassured by the diffstat),
> although I can see holding it back for a few releases.
what do you call 'decruftification'? So I'd suggest besides obvious bug (and
comment) fixes we should not change the current calibration code but add your new
logic as the first step, and preserve those other methods, because we know that it
works reasonably well on a wide range of hardware.
Because it all has to be kept in perspective: the benefits of any changes here are
a small boot speedup plus more stable calibration at best (and a warm fuzzy
feeling from having nicely structured, well working code), while the drawbacks are
the potential for totally miscalibrated systems that were working fine before.
Once your bits work fine will there be any need for any of the two other PIT based
calibration methods? We can simply remove them at a suitable point in time and
have a single (and by definition non-crufty) piece of PIT calibration code.
(and RTC if that can be managed.)
> > Please also add calibration tracing code (.config driven and default-off), so
> > that the statistical properties of calibration can be debugged and validated
> > without patching the kernel.
>
> Definitely desired, but I have to be careful here. Obviously I can't print
> during the timing loop, so it will take either a lot of memory, or add
> significant computation to the loop.
So in theory you can use a tracepoint and enable boot tracing. Not sure it's
initialized that early in the bootup, has to be explored ...
> I also don't want to flood the kernel log before syslog is started.
By default it should not print any trace.
So I don't think the details really matter: this is a boot and .config option for
debugging, not for production kernels. You can do a big memory array and printk
the result or use the generic tracing facilities if they are available. People can
increase the kmsg buffer if it does not fit.
> >> Any suggestions for a reasonable time/quality tradeoff? 500 ppm ASAP?
> >> Best I can do in 10 ms? Wait until the PIT is 500 ppm and then use
> >> the better result from a higher-resolution timer if available?
>
> > So I'd suggest a minimum polling interval (at least 1 msecs?) plus a
> > ppm target. Would 100ppm be too aggressive?
>
> How about 122 ppm (1/8192) because I'm lazy? :-)
;-)
> What I imagine is this:
>
> - The code will loop until it reaches 122 ppm or 55 ms, whichever comes
> first. (There's also a minimum, before which 122 ppm isn't checked.)
> - Initially, failure to reach 122 ppm will print a message and fall back.
> - In the final cleanup patch, I'll accept anything up to 500 ppm
> and only fail (and disable TSC) if I can't reach that.
Sounds good to me in principle.
Thanks,
Ingo
next prev parent reply other threads:[~2015-06-10 9:26 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-03 6:27 [PATCH RFC] x86, tsc: Allow for high latency in quick_pit_calibrate() George Spelvin
2015-06-03 18:29 ` George Spelvin
2015-06-03 18:48 ` H. Peter Anvin
2015-06-03 19:07 ` George Spelvin
2015-06-04 16:38 ` George Spelvin
2015-06-04 16:52 ` Linus Torvalds
2015-06-04 17:54 ` George Spelvin
2015-06-04 18:07 ` Linus Torvalds
2015-06-05 5:52 ` George Spelvin
2015-06-05 6:16 ` Ingo Molnar
2015-06-05 5:58 ` Ingo Molnar
2015-06-05 8:24 ` George Spelvin
2015-06-05 8:31 ` Ingo Molnar
2015-06-05 20:17 ` George Spelvin
2015-06-06 21:50 ` George Spelvin
2015-06-09 6:54 ` [RFC PATCH] Make quick_pit_calibrate more robust George Spelvin
2015-06-09 9:13 ` Adrian Hunter
2015-06-09 9:54 ` George Spelvin
2015-06-10 7:08 ` Discussion: quick_pit_calibrate is slow George Spelvin
2015-06-10 7:30 ` Ingo Molnar
2015-06-10 8:47 ` George Spelvin
2015-06-10 9:25 ` Ingo Molnar [this message]
2015-06-10 15:43 ` George Spelvin
2015-06-10 15:56 ` Arjan van de Ven
2015-06-10 16:27 ` George Spelvin
2015-06-10 18:38 ` George Spelvin
2015-06-10 19:30 ` Arjan van de Ven
2015-06-10 22:19 ` George Spelvin
2015-06-10 8:13 ` Adrian Hunter
2015-06-10 8:55 ` George Spelvin
2015-06-10 9:12 ` Ingo Molnar
2015-06-10 16:11 ` George Spelvin
2015-06-10 7:32 ` Discussion: quick_pit_calibrate isn't quick George Spelvin
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=20150610092553.GA32269@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@horizon.com \
--cc=luto@amacapital.net \
--cc=penberg@iki.fi \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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).