Re: [PATCH] x86/tsc: Add tsc_guess flag disabling CPUID.16h use for tsc calibration

From: Andy Lutomirski
Date: Wed Jan 15 2020 - 15:15:51 EST


On Tue, Jan 14, 2020 at 6:39 AM Krzysztof Piecuch
<piecuch@xxxxxxxxxxxxxx> wrote:
>
> Changing base clock frequency directly impacts tsc hz but not CPUID.16h
> values. An overclocked CPU supporting CPUID.16h and partial CPUID.15h
> support will set tsc hz according to "best guess" given by CPUID.16h
> relying on tsc_refine_calibration_work to give better numbers later.
> tsc_refine_calibration_work will refuse to do its work when the outcome is
> off the early tsc hz value by more than 1% which is certain to happen on an
> overclocked system.
>
> Signed-off-by: Krzysztof Piecuch <piecuch@xxxxxxxxxxxxxx>
> ---
> Documentation/admin-guide/kernel-parameters.txt | 6 ++++++
> arch/x86/kernel/tsc.c | 12 ++++++++++--
> 2 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index ade4e6ec23e0..54ae9e153a19 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -4905,6 +4905,12 @@
> interruptions from clocksource watchdog are not
> acceptable).
>
> + tsc_guess= [X86,INTEL] Don't use data provided by CPUID.16h during
> + early tsc calibration. Disabling this may be useful for
> + CPUs with altered base clocks.
> + Format: <bool> (1/Y/y=enable, 0/N/n=disable)
> + default: enabled

This has more negatives than makes sense. I also think it's wrong. How about:

tsc_guess= ... Use data provided by CPUID.16h ...