From: Sasha Levin Date: Mon, 30 Mar 2020 16:24:29 +0000 (-0400) Subject: Fixes for 5.5 X-Git-Tag: v5.6.1~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1f2c9a35a346a795263c2f1a24a754fb6b82bb4e;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.5 Signed-off-by: Sasha Levin --- diff --git a/queue-5.5/clocksource-drivers-hyper-v-untangle-stimers-and-tim.patch b/queue-5.5/clocksource-drivers-hyper-v-untangle-stimers-and-tim.patch new file mode 100644 index 00000000000..2dc945bb110 --- /dev/null +++ b/queue-5.5/clocksource-drivers-hyper-v-untangle-stimers-and-tim.patch @@ -0,0 +1,60 @@ +From 4f791412488571fd65fc85243f595a9cdcaac7f1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Mar 2020 19:11:59 -0700 +Subject: clocksource/drivers/hyper-v: Untangle stimers and timesync from + clocksources + +From: Yubo Xie + +[ Upstream commit 0af3e137c144377fbaf5025ba784ff5ba7ad40c9 ] + +hyperv_timer.c exports hyperv_cs, which is used by stimers and the +timesync mechanism. However, the clocksource dependency is not +needed: these mechanisms only depend on the partition reference +counter (which can be read via a MSR or via the TSC Reference Page). + +Introduce the (function) pointer hv_read_reference_counter, as an +embodiment of the partition reference counter read, and export it +in place of the hyperv_cs pointer. The latter can be removed. + +This should clarify that there's no relationship between Hyper-V +stimers & timesync and the Linux clocksource abstractions. No +functional or semantic change. + +Suggested-by: Michael Kelley +Signed-off-by: Andrea Parri +Reviewed-by: Michael Kelley +Signed-off-by: Daniel Lezcano +Link: https://lore.kernel.org/r/20200109160650.16150-2-parri.andrea@gmail.com +Signed-off-by: Sasha Levin +--- + drivers/clocksource/hyperv_timer.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c +index 287d8d58c21ac..0d29b05d8889f 100644 +--- a/drivers/clocksource/hyperv_timer.c ++++ b/drivers/clocksource/hyperv_timer.c +@@ -327,7 +327,8 @@ static u64 notrace read_hv_clock_tsc(struct clocksource *arg) + + static u64 read_hv_sched_clock_tsc(void) + { +- return read_hv_clock_tsc(NULL) - hv_sched_clock_offset; ++ return (read_hv_clock_tsc(NULL) - hv_sched_clock_offset) * ++ (NSEC_PER_SEC / HV_CLOCK_HZ); + } + + static struct clocksource hyperv_cs_tsc = { +@@ -352,7 +353,8 @@ static u64 notrace read_hv_clock_msr(struct clocksource *arg) + + static u64 read_hv_sched_clock_msr(void) + { +- return read_hv_clock_msr(NULL) - hv_sched_clock_offset; ++ return (read_hv_clock_msr(NULL) - hv_sched_clock_offset) * ++ (NSEC_PER_SEC / HV_CLOCK_HZ); + } + + static struct clocksource hyperv_cs_msr = { +-- +2.20.1 + diff --git a/queue-5.5/series b/queue-5.5/series index 33f00ed3684..406b2a6c22a 100644 --- a/queue-5.5/series +++ b/queue-5.5/series @@ -144,3 +144,4 @@ bpf-sockmap-remove-bucket-lock-from-sock_-hash-map-_free.patch arm-dts-sun8i-a83t-tbs-a711-fix-usb-otg-mode-detection.patch vti6-fix-memory-leak-of-skb-if-input-policy-check-fails.patch r8169-fix-phy-driver-check-on-platforms-w-o-module-softdeps.patch +clocksource-drivers-hyper-v-untangle-stimers-and-tim.patch