Commit c0e96acf authored by Dexuan Cui's avatar Dexuan Cui Committed by Wei Liu

clocksource: hyper-v: make sure Invariant-TSC is used if it is available

If Hyper-V TSC page is unavailable and Invariant-TSC is available,
currently hyperv_cs_msr (rather than Invariant-TSC) is used by default.

Use Invariant-TSC by default by downgrading hyperv_cs_msr.rating in
hv_init_tsc_clocksource(), if Invariant-TSC is available.
Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20230408210339.15085-1-decui@microsoft.comSigned-off-by: default avatarWei Liu <wei.liu@kernel.org>
parent 2c6ba421
...@@ -517,9 +517,6 @@ static bool __init hv_init_tsc_clocksource(void) ...@@ -517,9 +517,6 @@ static bool __init hv_init_tsc_clocksource(void)
{ {
union hv_reference_tsc_msr tsc_msr; union hv_reference_tsc_msr tsc_msr;
if (!(ms_hyperv.features & HV_MSR_REFERENCE_TSC_AVAILABLE))
return false;
/* /*
* If Hyper-V offers TSC_INVARIANT, then the virtualized TSC correctly * If Hyper-V offers TSC_INVARIANT, then the virtualized TSC correctly
* handles frequency and offset changes due to live migration, * handles frequency and offset changes due to live migration,
...@@ -536,6 +533,9 @@ static bool __init hv_init_tsc_clocksource(void) ...@@ -536,6 +533,9 @@ static bool __init hv_init_tsc_clocksource(void)
hyperv_cs_msr.rating = 250; hyperv_cs_msr.rating = 250;
} }
if (!(ms_hyperv.features & HV_MSR_REFERENCE_TSC_AVAILABLE))
return false;
hv_read_reference_counter = read_hv_clock_tsc; hv_read_reference_counter = read_hv_clock_tsc;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment