Linux-HyperV List
 help / color / mirror / Atom feed
* [PATCH] x86/hyperv: Fix stale comments after stimer message mode removal
@ 2026-09-01  3:32 Jiangshan Yi
  2026-09-01 21:49 ` Michael Kelley
  2026-09-13 22:35 ` Wei Liu
  0 siblings, 2 replies; 3+ messages in thread
From: Jiangshan Yi @ 2026-09-01  3:32 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, longli, tglx, mingo, bp,
	dave.hansen, x86
  Cc: hpa, linux-hyperv, linux-kernel, 13667453960, Jiangshan Yi

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] x86/hyperv: Fix stale comments after stimer message mode removal
  2026-09-01  3:32 [PATCH] x86/hyperv: Fix stale comments after stimer message mode removal Jiangshan Yi
@ 2026-09-01 21:49 ` Michael Kelley
  2026-09-13 22:35 ` Wei Liu
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Kelley @ 2026-09-01 21:49 UTC (permalink / raw)
  To: Jiangshan Yi, kys@microsoft.com, haiyangz@microsoft.com,
	wei.liu@kernel.org, decui@microsoft.com, longli@microsoft.com,
	tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org
  Cc: hpa@zytor.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, 13667453960@163.com

From: Jiangshan Yi <yijiangshan@kylinos.cn> Sent: Monday, August 31, 2026 8:32 PM
> 
> 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
> 

Thanks for cleaning up after my changes!

Reviewed-by: Michael Kelley <mhklinux@outlook.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/hyperv: Fix stale comments after stimer message mode removal
  2026-09-01  3:32 [PATCH] x86/hyperv: Fix stale comments after stimer message mode removal Jiangshan Yi
  2026-09-01 21:49 ` Michael Kelley
@ 2026-09-13 22:35 ` Wei Liu
  1 sibling, 0 replies; 3+ messages in thread
From: Wei Liu @ 2026-09-13 22:35 UTC (permalink / raw)
  To: Jiangshan Yi
  Cc: kys, haiyangz, wei.liu, decui, longli, tglx, mingo, bp,
	dave.hansen, x86, hpa, linux-hyperv, linux-kernel, 13667453960

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-13 22:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01  3:32 [PATCH] x86/hyperv: Fix stale comments after stimer message mode removal Jiangshan Yi
2026-09-01 21:49 ` Michael Kelley
2026-09-13 22:35 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox