linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/clock: Init generic clock with CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
@ 2025-07-23  2:03 Zhang Qiao
  2025-07-30 13:21 ` Zhang Qiao
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Qiao @ 2025-07-23  2:03 UTC (permalink / raw)
  To: tglx, frederic, anna-maria, jstultz, peterz, namcao
  Cc: linux-kernel, zhangqiao22, yuanlulu4, tanghui20

The sched_clock_timer is used to prevent the sched clock wrapped, this
timer is initialized in generic_sched_clock_init();

When CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y, generic_sched_clock_init() is
not called and sched_clock_timer is not initialized, causing the
sched clock to wrap.

To fix this issue, call generic_sched_clock_init() in sched_clock_init()
to initialize the sched_clock_timer.

Fixes: 5d2a4e91a541 ("sched/clock: Move sched clock initialization and merge with generic clock")
Reported-by: yuanlulu <yuanlulu4@huawei.com>
Signed-off-by: Zhang Qiao <zhangqiao22@huawei.com>
---
 kernel/sched/clock.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
index a09655b481402..13e76cfb59f23 100644
--- a/kernel/sched/clock.c
+++ b/kernel/sched/clock.c
@@ -213,6 +213,7 @@ void __init sched_clock_init(void)
 	 */
 	local_irq_disable();
 	__sched_clock_gtod_offset();
+	generic_sched_clock_init();
 	local_irq_enable();
 
 	static_branch_inc(&sched_clock_running);
-- 
2.18.0.huawei.25


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

* Re: [PATCH] sched/clock: Init generic clock with CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
  2025-07-23  2:03 [PATCH] sched/clock: Init generic clock with CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y Zhang Qiao
@ 2025-07-30 13:21 ` Zhang Qiao
  0 siblings, 0 replies; 2+ messages in thread
From: Zhang Qiao @ 2025-07-30 13:21 UTC (permalink / raw)
  To: tglx, frederic, anna-maria, jstultz, peterz, namcao
  Cc: linux-kernel, yuanlulu4, tanghui20

ping...

在 2025/7/23 10:03, Zhang Qiao 写道:
> The sched_clock_timer is used to prevent the sched clock wrapped, this
> timer is initialized in generic_sched_clock_init();
> 
> When CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y, generic_sched_clock_init() is
> not called and sched_clock_timer is not initialized, causing the
> sched clock to wrap.
> 
> To fix this issue, call generic_sched_clock_init() in sched_clock_init()
> to initialize the sched_clock_timer.
> 
> Fixes: 5d2a4e91a541 ("sched/clock: Move sched clock initialization and merge with generic clock")
> Reported-by: yuanlulu <yuanlulu4@huawei.com>
> Signed-off-by: Zhang Qiao <zhangqiao22@huawei.com>
> ---
>  kernel/sched/clock.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
> index a09655b481402..13e76cfb59f23 100644
> --- a/kernel/sched/clock.c
> +++ b/kernel/sched/clock.c
> @@ -213,6 +213,7 @@ void __init sched_clock_init(void)
>  	 */
>  	local_irq_disable();
>  	__sched_clock_gtod_offset();
> +	generic_sched_clock_init();
>  	local_irq_enable();
>  
>  	static_branch_inc(&sched_clock_running);
> 

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

end of thread, other threads:[~2025-07-30 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-23  2:03 [PATCH] sched/clock: Init generic clock with CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y Zhang Qiao
2025-07-30 13:21 ` Zhang Qiao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).