Skip to content

Commit 9e0333a

Browse files
andrea-parridlezcano
authored andcommitted
clocksource/drivers/hyper-v: Set TSC clocksource as default w/ InvariantTSC
Change the Hyper-V clocksource ratings to 250, below the TSC clocksource rating of 300. In configurations where Hyper-V offers an InvariantTSC, the TSC is not marked "unstable", so the TSC clocksource is available and preferred. With the higher rating, it will be the default. On older hardware and Hyper-V versions, the TSC is marked "unstable", so no TSC clocksource is created and the selected Hyper-V clocksource will be the default. Signed-off-by: Andrea Parri <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0af3e13 commit 9e0333a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/clocksource/hyperv_timer.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,14 @@ EXPORT_SYMBOL_GPL(hv_stimer_global_cleanup);
302302
* the other that uses the TSC reference page feature as defined in the
303303
* TLFS. The MSR version is for compatibility with old versions of
304304
* Hyper-V and 32-bit x86. The TSC reference page version is preferred.
305+
*
306+
* The Hyper-V clocksource ratings of 250 are chosen to be below the
307+
* TSC clocksource rating of 300. In configurations where Hyper-V offers
308+
* an InvariantTSC, the TSC is not marked "unstable", so the TSC clocksource
309+
* is available and preferred. With the higher rating, it will be the
310+
* default. On older hardware and Hyper-V versions, the TSC is marked
311+
* "unstable", so no TSC clocksource is created and the selected Hyper-V
312+
* clocksource will be the default.
305313
*/
306314

307315
u64 (*hv_read_reference_counter)(void);
@@ -363,7 +371,7 @@ static void resume_hv_clock_tsc(struct clocksource *arg)
363371

364372
static struct clocksource hyperv_cs_tsc = {
365373
.name = "hyperv_clocksource_tsc_page",
366-
.rating = 400,
374+
.rating = 250,
367375
.read = read_hv_clock_tsc_cs,
368376
.mask = CLOCKSOURCE_MASK(64),
369377
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
@@ -395,7 +403,7 @@ static u64 read_hv_sched_clock_msr(void)
395403

396404
static struct clocksource hyperv_cs_msr = {
397405
.name = "hyperv_clocksource_msr",
398-
.rating = 400,
406+
.rating = 250,
399407
.read = read_hv_clock_msr_cs,
400408
.mask = CLOCKSOURCE_MASK(64),
401409
.flags = CLOCK_SOURCE_IS_CONTINUOUS,

0 commit comments

Comments
 (0)