[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241230113611.GKZ3KFq-Xm_5W40P2M@fat_crate.local>
Date: Mon, 30 Dec 2024 12:36:11 +0100
From: Borislav Petkov <bp@...en8.de>
To: Nikunj A Dadhania <nikunj@....com>
Cc: linux-kernel@...r.kernel.org, thomas.lendacky@....com, x86@...nel.org,
kvm@...r.kernel.org, mingo@...hat.com, tglx@...utronix.de,
dave.hansen@...ux.intel.com, pgonda@...gle.com, seanjc@...gle.com,
pbonzini@...hat.com, Alexey Makhalov <alexey.makhalov@...adcom.com>,
Juergen Gross <jgross@...e.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>
Subject: Re: [PATCH v15 10/13] tsc: Upgrade TSC clocksource rating
On Tue, Dec 03, 2024 at 02:30:42PM +0530, Nikunj A Dadhania wrote:
> In virtualized environments running on modern CPUs, the underlying
> platforms guarantees to have a stable, always running TSC, i.e. that the
> TSC is a superior timesource as compared to other clock sources (such as
> kvmclock, HPET, ACPI timer, APIC, etc.).
That paragraph sounds like marketing fluff and can't be more far away from the
truth. We still can't have a stable clocksource in the currently ending 2024
without someone f*cking with it.
> Upgrade the rating of the early and regular clock source to prefer TSC over
> other clock sources when TSC is invariant, non-stop and stable.
I don't think so...
Have you read all that gunk in check_system_tsc_reliable() and the commits
touching that logic which disables the TSC clocksource watchdog caused by all
the hw crap that is being produced?
> Cc: Alexey Makhalov <alexey.makhalov@...adcom.com>
> Cc: Juergen Gross <jgross@...e.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
> Suggested-by: Thomas Gleixner <tglx@...utronix.de>
> Signed-off-by: Nikunj A Dadhania <nikunj@....com>
> ---
> arch/x86/kernel/tsc.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
> index c0eef924b84e..900edcde0c9e 100644
> --- a/arch/x86/kernel/tsc.c
> +++ b/arch/x86/kernel/tsc.c
> @@ -1265,6 +1265,21 @@ static void __init check_system_tsc_reliable(void)
> tsc_disable_clocksource_watchdog();
> }
>
> +static void __init upgrade_clock_rating(struct clocksource *tsc_early,
> + struct clocksource *tsc)
> +{
> + /*
> + * Upgrade the clock rating for TSC early and regular clocksource when
> + * the underlying platform provides non-stop, invaraint and stable TSC.
Unknown word [invaraint] in comment.
Suggestions: ['invariant', 'inerrant', 'invent', 'intranet', 'infant', 'unvaried', 'informant', 'ingrained', 'entrant', 'inherent', 'unafraid', 'infuriate', 'inferring', 'univalent', 'infringe', 'infringed', 'infuriating']
Spellchecker pls.
> + */
> + if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
> + boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
check_for_deprecated_apis: WARNING: arch/x86/kernel/tsc.c:1275: Do not use boot_cpu_has() - use cpu_feature_enabled() instead.
check_for_deprecated_apis: WARNING: arch/x86/kernel/tsc.c:1276: Do not use boot_cpu_has() - use cpu_feature_enabled() instead.
> + !tsc_unstable) {
> + tsc_early->rating = 449;
> + tsc->rating = 450;
> + }
> +}
> +
> /*
> * Make an educated guess if the TSC is trustworthy and synchronized
> * over all CPUs.
> @@ -1566,6 +1581,8 @@ void __init tsc_init(void)
> if (tsc_clocksource_reliable || no_tsc_watchdog)
> tsc_disable_clocksource_watchdog();
>
> + upgrade_clock_rating(&clocksource_tsc_early, &clocksource_tsc);
> +
> clocksource_register_khz(&clocksource_tsc_early, tsc_khz);
> detect_art();
> }
> --
> 2.34.1
>
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists