Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] Hyper-V VMs with an invariant TSC but no frequency MSRs lose the 
X86_FEATURE_TSC_RELIABLE capability.
--

commit 0c0fbc4f0451c30c0e87e0e3591ea4f487eff75c
Author: Sean Christopherson <[email protected]>

x86/tsc: Pass KNOWN_FREQ and RELIABLE as params to registration

This commit adds a tsc_properties parameter to the paravirtual TSC
calibration registration routine to consolidate feature flag tracking.
It updates various hypervisor initialization paths to pass combined flags
instead of manually setting the CPU capabilities.

> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -516,8 +516,13 @@ static void __init ms_hyperv_init_platform(void)
>  
>       if (ms_hyperv.features & HV_ACCESS_FREQUENCY_MSRS &&
>           ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) {
> -             tsc_register_calibration_routines(hv_get_tsc_khz, 
> hv_get_tsc_khz);
> -             setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
> +             enum tsc_properties tsc_properties = TSC_FREQUENCY_KNOWN;
> +
> +             if (ms_hyperv.features & HV_ACCESS_TSC_INVARIANT)
> +                     tsc_properties = TSC_FREQ_KNOWN_AND_RELIABLE;
> +
> +             tsc_register_calibration_routines(hv_get_tsc_khz, 
> hv_get_tsc_khz,
> +                                               tsc_properties);
>       }

[ ... ]

> @@ -629,7 +634,6 @@ static void __init ms_hyperv_init_platform(void)
>                * is called.
>                */
>               wrmsrq(HV_X64_MSR_TSC_INVARIANT_CONTROL, 
> HV_EXPOSE_INVARIANT_TSC);
> -             setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE);
>       }

If a Hyper-V VM exposes an invariant TSC but lacks the frequency MSRs,
does it bypass the tsc_register_calibration_routines() block entirely?

Without the standalone setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE) call
here, it looks like these VMs will lose the reliable flag.

Will this inadvertently enable the TSC watchdog, potentially causing a
performance regression if the system falsely marks the TSC as unstable due
to virtualization scheduling delays?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=31

Reply via email to