From: Andrew Morton <akpm@linux-foundation.org>
To: Phil Carmody <ext-phil.2.carmody@nokia.com>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org, sboyd@codeaurora.org
Subject: Re: [PATCH 3/4] calibrate: retry with wider bounds when converge seems to fail
Date: Fri, 11 Mar 2011 15:27:44 -0800 [thread overview]
Message-ID: <20110311152744.ad5ef129.akpm@linux-foundation.org> (raw)
In-Reply-To: <1299768487-13200-4-git-send-email-ext-phil.2.carmody@nokia.com>
On Thu, 10 Mar 2011 16:48:06 +0200
Phil Carmody <ext-phil.2.carmody@nokia.com> wrote:
> Systems with unmaskable interrupts such as SMIs may massively underestimate
> loops_per_jiffy, and fail to converge anywhere near the real value. A case
> seen on x86_64 was an initial estimate of 256<<12, which converged to 511<<12
> where the real value should have been over 630<<12. This admitedly requires
> bypassing the TSC calibration (lpj_fine), and a failure to settle in the
> direct calibration too, but is physically possible. This failure does not
> depend on my previous calibration optimisation, but by luck is easy to fix
> with the optimisation in place with a trivial retry loop.
>
> In the context of the optimised converging method, as we can no longer trust
> the starting estimate, enlarge the search bounds exponentially so that the
> number of retries is logarithmically bounded.
>
> ...
>
> @@ -165,6 +169,16 @@ static unsigned long __cpuinit calibrate_delay_converge(void)
> lpj -= loopadd;
> loopadd >>= 1;
> }
> + /*
> + * If we incremented every single time possible, presume we've
> + * massively underestimated initially, and retry with a higher
> + * start, and larger range. (Only seen on x86_64.)
> + */
> + if (lpj + loopadd * 2 == lpj_base + loopadd_base * 2) {
> + lpj_base = lpj;
> + loopadd_base <<= 2;
> + goto recalibrate;
> + }
This is more informative, no?
--- a/init/calibrate.c~calibrate-retry-with-wider-bounds-when-converge-seems-to-fail-fix
+++ a/init/calibrate.c
@@ -172,7 +172,7 @@ recalibrate:
/*
* If we incremented every single time possible, presume we've
* massively underestimated initially, and retry with a higher
- * start, and larger range. (Only seen on x86_64.)
+ * start, and larger range. (Only seen on x86_64, due to SMIs)
*/
if (lpj + loopadd * 2 == lpj_base + loopadd_base * 2) {
lpj_base = lpj;
_
next prev parent reply other threads:[~2011-03-11 23:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-10 14:48 [PATCHv3 0/4] Improve fallback LPJ calculation Phil Carmody
2011-03-10 14:48 ` [PATCH 1/4] calibrate: extract fall-back calculation into own helper Phil Carmody
2011-03-10 14:48 ` [PATCH 2/4] calibrate: home in on correct lpj value more quickly Phil Carmody
2011-03-10 14:48 ` [PATCH 3/4] calibrate: retry with wider bounds when converge seems to fail Phil Carmody
2011-03-10 14:48 ` [PATCH 4/4] DO NOT INTEGRATE: test-only timing Phil Carmody
2011-03-11 23:27 ` Andrew Morton [this message]
2011-03-12 2:10 ` [PATCH 3/4] calibrate: retry with wider bounds when converge seems to fail Phil Carmody
2011-03-11 23:26 ` [PATCHv3 0/4] Improve fallback LPJ calculation Andrew Morton
2011-03-18 22:40 ` Stephen Boyd
2011-03-22 9:41 ` Phil Carmody
-- strict thread matches above, loose matches on Subject: below --
2010-09-28 10:44 [PATCHv2 " Phil Carmody
2010-09-28 10:44 ` [PATCH 1/4] calibrate: extract fall-back calculation into own helper Phil Carmody
2010-09-28 10:44 ` [PATCH 2/4] calibrate: home in on correct lpj value more quickly Phil Carmody
2010-09-28 10:44 ` [PATCH 3/4] calibrate: retry with wider bounds when converge seems to fail Phil Carmody
2010-09-28 10:44 ` Phil Carmody
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=20110311152744.ad5ef129.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ext-phil.2.carmody@nokia.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.