[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fdc643c4-6298-d337-1d8d-3f28f6c1acfc@linaro.org>
Date: Mon, 19 Jun 2023 18:16:25 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: Michael Kelley <mikelley@...rosoft.com>, kys@...rosoft.com,
haiyangz@...rosoft.com, wei.liu@...nel.org, decui@...rosoft.com,
tglx@...utronix.de, linux-kernel@...r.kernel.org,
linux-hyperv@...r.kernel.org
Subject: Re: [PATCH 1/1] clocksource: hyper-v: Rework clocksource and sched
clock setup
On 09/06/2023 17:47, Michael Kelley wrote:
> Current code assigns either the Hyper-V TSC page or MSR-based ref counter
> as the sched clock. This may be sub-optimal in two cases. First, if there
> is hardware support to ensure consistent TSC frequency across live
> migrations and Hyper-V is using that support, the raw TSC is a faster
> source of time than the Hyper-V TSC page. Second, the MSR-based ref
> counter is relatively slow because reads require a trap to the hypervisor.
> As such, it should never be used as the sched clock. The native sched
> clock based on the raw TSC or jiffies is much better.
>
> Rework the sched clock setup so it is set to the TSC page only if
> Hyper-V indicates that the TSC may have inconsistent frequency across
> live migrations. Also, remove the code that sets the sched clock to
> the MSR-based ref counter. In the cases where it is not set, the sched
> clock will then be the native sched clock.
>
> As part of the rework, always enable both the TSC page clocksource and
> the MSR-based ref counter clocksource. Set the ratings so the TSC page
> clocksource is preferred. While the MSR-based ref counter clocksource
> is unlikely to ever be the default, having it available for manual
> selection is convenient for development purposes.
>
> Signed-off-by: Michael Kelley <mikelley@...rosoft.com>
The patch does not apply, does it depend on another patch?
Rejected chunk:
--- drivers/clocksource/hyperv_timer.c
+++ drivers/clocksource/hyperv_timer.c
@@ -485,15 +485,9 @@ static u64 notrace read_hv_clock_msr_cs(struct
clocksource *arg)
return read_hv_clock_msr();
}
-static u64 noinstr read_hv_sched_clock_msr(void)
-{
- return (read_hv_clock_msr() - hv_sched_clock_offset) *
- (NSEC_PER_SEC / HV_CLOCK_HZ);
-}
-
static struct clocksource hyperv_cs_msr = {
.name = "hyperv_clocksource_msr",
- .rating = 500,
+ .rating = 495,
.read = read_hv_clock_msr_cs,
.mask = CLOCKSOURCE_MASK(64),
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Powered by blists - more mailing lists