• Phil Carmody's avatar
    calibrate: retry with wider bounds when converge seems to fail · b1b5f65e
    Phil Carmody authored
    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.
    [akpm@linux-foundation.org: mention x86_64 SMIs in comment]
    Signed-off-by: default avatarPhil Carmody <ext-phil.2.carmody@nokia.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Tested-by: default avatarStephen Boyd <sboyd@codeaurora.org>
    Cc: Greg KH <greg@kroah.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
calibrate.c 5.83 KB