[PATCH] x86/hyperv: Fix stale comments after stimer message mode removal

Jiangshan Yi posted 1 patch 3 weeks, 4 days ago
arch/x86/hyperv/hv_init.c |  4 ++--
drivers/hv/vmbus_drv.c    | 18 +++++++-----------
2 files changed, 9 insertions(+), 13 deletions(-)
[PATCH] x86/hyperv: Fix stale comments after stimer message mode removal
Posted by Jiangshan Yi 3 weeks, 4 days ago
The removal of stimer message mode in commit be0cfab740e5 ("clocksource:
hyper-v: Remove support for stimer interrupts in message mode") left a
few comments out of date. hv_stimer_setup_percpu_clockev() picked up two
typos ("afters", "to allows"), and the hv_synic_suspend() comment still
references the deleted hv_stimer_legacy_cleanup(), the legacy non-Direct
Mode configuration, and clockevents_unbind_device(), which is no longer
on the cleanup path.

Update the typos and rewrite the hv_synic_suspend() comment to describe
the current Direct Mode path: non-boot CPU stimers are cleaned up via
the cpuhp teardown callback hv_stimer_cleanup(), and CPU0's stimer is
left alone because it is harmless (interrupts stay disabled across the
suspend/resume window) and is shut down later by the timekeeping code.

Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
---
 arch/x86/hyperv/hv_init.c |  4 ++--
 drivers/hv/vmbus_drv.c    | 18 +++++++-----------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 0b4a1c0b0b16..690f95295ee4 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -426,7 +426,7 @@ static void __init hv_stimer_setup_percpu_clockev(void)
 	int ret;
 
 	/*
-	 * Continue afters errors in setting up stimer clockevents
+	 * Continue after errors in setting up stimer clockevents
 	 * as we can run with the LAPIC timer as a fallback.
 	 */
 	ret = hv_stimer_alloc(false);
@@ -434,7 +434,7 @@ static void __init hv_stimer_setup_percpu_clockev(void)
 		pr_warn("stimer setup failed with error %d\n", ret);
 
 	/*
-	 * Still register the LAPIC timer to allows users
+	 * Still register the LAPIC timer to allow users
 	 * to switch to LAPIC timer via /sys, if they want to.
 	 */
 	if (old_setup_percpu_clockev)
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 5ebdbe24b5a1..c1edc3a5b673 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -2923,23 +2923,19 @@ static void hv_crash_handler(struct pt_regs *regs)
 static int hv_synic_suspend(void *data)
 {
 	/*
-	 * When we reach here, all the non-boot CPUs have been offlined.
-	 * If we're in a legacy configuration where stimer Direct Mode is
-	 * not enabled, the stimers on the non-boot CPUs have been unbound
-	 * in hv_synic_cleanup() -> hv_stimer_legacy_cleanup() ->
-	 * hv_stimer_cleanup() -> clockevents_unbind_device().
+	 * When we reach here, all the non-boot CPUs have been offlined,
+	 * and their stimers have been cleaned up by the cpuhp teardown
+	 * callback hv_stimer_cleanup().
 	 *
 	 * hv_synic_suspend() only runs on CPU0 with interrupts disabled.
-	 * Here we do not call hv_stimer_legacy_cleanup() on CPU0 because:
-	 * 1) it's unnecessary as interrupts remain disabled between
-	 * syscore_suspend() and syscore_resume(): see create_image() and
+	 * The stimer on CPU0 is not explicitly cleaned up here because:
+	 * 1) it's harmless as interrupts remain disabled between
+	 * syscore_suspend() and syscore_resume(), so the stimer cannot
+	 * fire during this window: see create_image() and
 	 * resume_target_kernel()
 	 * 2) the stimer on CPU0 is automatically disabled later by
 	 * syscore_suspend() -> timekeeping_suspend() -> tick_suspend() -> ...
 	 * -> clockevents_shutdown() -> ... -> hv_ce_shutdown()
-	 * 3) a warning would be triggered if we call
-	 * clockevents_unbind_device(), which may sleep, in an
-	 * interrupts-disabled context.
 	 */
 
 	hv_hyp_synic_disable_regs(0);
-- 
2.25.1
Re: [PATCH] x86/hyperv: Fix stale comments after stimer message mode removal
Posted by Wei Liu 1 week, 5 days ago
On Tue, Sep 01, 2026 at 11:32:01AM +0800, Jiangshan Yi wrote:
> The removal of stimer message mode in commit be0cfab740e5 ("clocksource:
> hyper-v: Remove support for stimer interrupts in message mode") left a
> few comments out of date. hv_stimer_setup_percpu_clockev() picked up two
> typos ("afters", "to allows"), and the hv_synic_suspend() comment still
> references the deleted hv_stimer_legacy_cleanup(), the legacy non-Direct
> Mode configuration, and clockevents_unbind_device(), which is no longer
> on the cleanup path.
> 
> Update the typos and rewrite the hv_synic_suspend() comment to describe
> the current Direct Mode path: non-boot CPU stimers are cleaned up via
> the cpuhp teardown callback hv_stimer_cleanup(), and CPU0's stimer is
> left alone because it is harmless (interrupts stay disabled across the
> suspend/resume window) and is shut down later by the timekeeping code.
> 
> Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>

Applied. Thanks.