[PATCH] sched/clock: Init generic clock with CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y

Zhang Qiao posted 1 patch 2 months, 2 weeks ago
kernel/sched/clock.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] sched/clock: Init generic clock with CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
Posted by Zhang Qiao 2 months, 2 weeks ago
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
Re: [PATCH] sched/clock: Init generic clock with CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
Posted by Zhang Qiao 2 months, 1 week ago
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);
>