summaryrefslogtreecommitdiff
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorDexuan Cui <decui@microsoft.com>2023-04-09 00:03:39 +0300
committerWei Liu <wei.liu@kernel.org>2023-04-17 22:19:05 +0300
commitc0e96acf884a1ce91c9bdd692c6a425b83c90285 (patch)
tree02216621dc40f08f0e1cd0b26ecbd79e229054fc /drivers/clocksource
parent2c6ba4216844ca7918289b49ed5f3f7138ee2402 (diff)
downloadlinux-c0e96acf884a1ce91c9bdd692c6a425b83c90285.tar.xz
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: Dexuan Cui <decui@microsoft.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20230408210339.15085-1-decui@microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/hyperv_timer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c
index f32948c8a96f..bcd9042a0c9f 100644
--- a/drivers/clocksource/hyperv_timer.c
+++ b/drivers/clocksource/hyperv_timer.c
@@ -517,9 +517,6 @@ static bool __init hv_init_tsc_clocksource(void)
{
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
* handles frequency and offset changes due to live migration,
@@ -536,6 +533,9 @@ static bool __init hv_init_tsc_clocksource(void)
hyperv_cs_msr.rating = 250;
}
+ if (!(ms_hyperv.features & HV_MSR_REFERENCE_TSC_AVAILABLE))
+ return false;
+
hv_read_reference_counter = read_hv_clock_tsc;
/*