sched/deadline: stop dl_server before CPU goes offline
PATCH 1/1 sched/deadline: stop dl_server before CPU goes offline
From: Peter Zijlstra (Intel) <[email protected]>
IBM CI tool reported kernel warning[1] when running a CPU removal operation through drmgr[2]. i.e "drmgr -c cpu -r -q 1"
WARNING: CPU: 0 PID: 0 at kernel/sched/cpudeadline.c:219 cpudl_set+0x58/0x170 NIP [c0000000002b6ed8] cpudl_set+0x58/0x170 LR [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 Call Trace: [c000000002c2f8c0] init_stack+0x78c0/0x8000 (unreliable) [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 [c00000000034df84] __hrtimer_run_queues+0x1a4/0x390 [c00000000034f624] hrtimer_interrupt+0x124/0x300 [c00000000002a230] timer_interrupt+0x140/0x320
Git bisects to: commit 4ae8d9aa9f9d ("sched/deadline: Fix dl_server getting stuck")
This happens since:
- dl_server hrtimer gets enqueued close to cpu offline, when kthread_park enqueues a fair task.
- CPU goes offline and drmgr removes it from cpu_present_mask.
- hrtimer fires and warning is hit.
Fix it by stopping the dl_server before CPU is marked dead.
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://github.com/ibm-power-utilities/powerpc-utils/tree/next/src/drmgr
--- kernel/sched/core.c | 2 ++ kernel/sched/deadline.c | 3 +++ 2 files changed, 5 insertions(+)
kernel/sched/core.c +2 -0
@@ -8571,10 +8571,12 @@ int sched_cpu_dying(unsigned int cpu)sched_tick_stop (cpu);rq_lock_irqsave (rq, &rf); +update_rq_clock (rq);if (rq->nr_running !=1 ||rq_has_pinned_tasks (rq)) {WARN (true,"Dying CPU not properly vacated!" );dump_rq_tasks (rq,KERN_WARNING ); } +dl_server_stop (&rq->fair_server);rq_unlock_irqrestore (rq, &rf);calc_load_migrate (rq);
kernel/sched/deadline.c +3 -0
@@ -1582,6 +1582,9 @@ void dl_server_start(struct sched_dl_entity *dl_se)if (!dl_server (dl_se) || dl_se->dl_server_active)return ; +if (WARN_ON_ONCE (!cpu_online (cpu_of (rq)))) +return ; + dl_se->dl_server_active =1 ;enqueue_dl_entity (dl_se,ENQUEUE_WAKEUP );if (!dl_task (dl_se->rq->curr) ||dl_entity_preempt (dl_se, &rq->curr->dl))
Signature · 1 line
2.47.3
Quoted 25 lines · Shrikanth Hegde
From: Peter Zijlstra (Intel) <[email protected]>
IBM CI tool reported kernel warning[1] when running a CPU removal operation through drmgr[2]. i.e "drmgr -c cpu -r -q 1"
WARNING: CPU: 0 PID: 0 at kernel/sched/cpudeadline.c:219 cpudl_set+0x58/0x170 NIP [c0000000002b6ed8] cpudl_set+0x58/0x170 LR [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 Call Trace: [c000000002c2f8c0] init_stack+0x78c0/0x8000 (unreliable) [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 [c00000000034df84] __hrtimer_run_queues+0x1a4/0x390 [c00000000034f624] hrtimer_interrupt+0x124/0x300 [c00000000002a230] timer_interrupt+0x140/0x320Git bisects to: commit
4ae8d9aa9f9d("sched/deadline: Fixdl_servergetting stuck")This happens since:
-dl_serverhrtimer gets enqueued close to cpu offline, whenkthread_parkenqueues a fair task.
- CPU goes offline and drmgr removes it fromcpu_present_mask.
- hrtimer fires and warning is hit.Fix it by stopping the
dl_serverbefore CPU is marked dead.
Quoted 7 lines
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://github.com/ibm-power-utilities/powerpc-utils/tree/next/src/drmgr[sshegde: wrote the changelog and tested it]Fixes 4ae8d9aa9f9d ("sched/deadline: Fix dl_server getting stuck")Reported-by Venkat Rao Bagalkote <[email protected]>
Closes:
https://lore.kernel.org/all/[email protected]/
Quoted 31 lines
Signed-off-by Peter Zijlstra (Intel) <[email protected]>Signed-off-by Shrikanth Hegde <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Shrikanth Hegde <[email protected]>--- kernel/sched/core.c | 2 ++ kernel/sched/deadline.c | 3 +++ 2 files changed, 5 insertions(+)kernel/sched/core.c +2
-0@@ -8571,10 +8571,12 @@ int sched_cpu_dying(unsigned int cpu)sched_tick_stop (cpu);rq_lock_irqsave (rq, &rf); +update_rq_clock (rq);if (rq->nr_running !=1 ||rq_has_pinned_tasks (rq)) {WARN (true,"Dying CPU not properly vacated!" );dump_rq_tasks (rq,KERN_WARNING ); } +dl_server_stop (&rq->fair_server);rq_unlock_irqrestore (rq, &rf);calc_load_migrate (rq);kernel/sched/deadline.c +0
-0
kernel/sched/deadline.c void dl_server_start(struct sched_dl_entity *dl_se) · line 1590
Quoted 9 lines
kernel/sched/deadline.c +3
-0@@ -1582,6 +1582,9 @@ void dl_server_start(struct sched_dl_entity *dl_se)if (!dl_server (dl_se) || dl_se->dl_server_active)return ; +if (WARN_ON_ONCE (!cpu_online (cpu_of (rq)))) +return ; + dl_se->dl_server_active =1 ;enqueue_dl_entity (dl_se,ENQUEUE_WAKEUP );if (!dl_task (dl_se->rq->curr) ||dl_entity_preempt (dl_se, &rq->curr->dl))
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Quoted 32 lines · Shrikanth Hegde
From: Peter Zijlstra (Intel) <[email protected]>
IBM CI tool reported kernel warning[1] when running a CPU removal operation through drmgr[2]. i.e "drmgr -c cpu -r -q 1"
WARNING: CPU: 0 PID: 0 at kernel/sched/cpudeadline.c:219 cpudl_set+0x58/0x170 NIP [c0000000002b6ed8] cpudl_set+0x58/0x170 LR [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 Call Trace: [c000000002c2f8c0] init_stack+0x78c0/0x8000 (unreliable) [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 [c00000000034df84] __hrtimer_run_queues+0x1a4/0x390 [c00000000034f624] hrtimer_interrupt+0x124/0x300 [c00000000002a230] timer_interrupt+0x140/0x320Git bisects to: commit
4ae8d9aa9f9d("sched/deadline: Fixdl_servergetting stuck")This happens since:
-dl_serverhrtimer gets enqueued close to cpu offline, whenkthread_parkenqueues a fair task.
- CPU goes offline and drmgr removes it fromcpu_present_mask.
- hrtimer fires and warning is hit.Fix it by stopping the
dl_serverbefore CPU is marked dead.[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://github.com/ibm-power-utilities/powerpc-utils/tree/next/src/drmgr
Quoted 8 lines
[sshegde: wrote the changelog and tested it]Fixes 4ae8d9aa9f9d ("sched/deadline: Fix dl_server getting stuck")Reported-by Venkat Rao Bagalkote <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Signed-off-by Shrikanth Hegde <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Shrikanth Hegde <[email protected]>
This patch fixes reported issue. Please add below tag.
Regards,
Venkat.
Quoted 39 lines
---
kernel/sched/core.c| 2 ++kernel/sched/deadline.c| 3 +++2 files changed, 5 insertions(+)kernel/sched/core.c +2
-0@@ -8571,10 +8571,12 @@ int sched_cpu_dying(unsigned int cpu)sched_tick_stop (cpu);rq_lock_irqsave (rq, &rf); +update_rq_clock (rq);if (rq->nr_running !=1 ||rq_has_pinned_tasks (rq)) {WARN (true,"Dying CPU not properly vacated!" );dump_rq_tasks (rq,KERN_WARNING ); } +dl_server_stop (&rq->fair_server);rq_unlock_irqrestore (rq, &rf);calc_load_migrate (rq);kernel/sched/deadline.c +3
-0@@ -1582,6 +1582,9 @@ void dl_server_start(struct sched_dl_entity *dl_se)if (!dl_server (dl_se) || dl_se->dl_server_active)return ; +if (WARN_ON_ONCE (!cpu_online (cpu_of (rq)))) +return ; + dl_se->dl_server_active =1 ;enqueue_dl_entity (dl_se,ENQUEUE_WAKEUP );if (!dl_task (dl_se->rq->curr) ||dl_entity_preempt (dl_se, &rq->curr->dl))Signature · 1 line
2.47.3
Hello,
Quoted 28 lines · Shrikanth Hegde
From: Peter Zijlstra (Intel) <[email protected]>
IBM CI tool reported kernel warning[1] when running a CPU removal operation through drmgr[2]. i.e "drmgr -c cpu -r -q 1"
WARNING: CPU: 0 PID: 0 at kernel/sched/cpudeadline.c:219 cpudl_set+0x58/0x170 NIP [c0000000002b6ed8] cpudl_set+0x58/0x170 LR [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 Call Trace: [c000000002c2f8c0] init_stack+0x78c0/0x8000 (unreliable) [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 [c00000000034df84] __hrtimer_run_queues+0x1a4/0x390 [c00000000034f624] hrtimer_interrupt+0x124/0x300 [c00000000002a230] timer_interrupt+0x140/0x320Git bisects to: commit
4ae8d9aa9f9d("sched/deadline: Fixdl_servergetting stuck")This happens since:
-dl_serverhrtimer gets enqueued close to cpu offline, whenkthread_parkenqueues a fair task.
- CPU goes offline and drmgr removes it fromcpu_present_mask.
- hrtimer fires and warning is hit.Fix it by stopping the
dl_serverbefore CPU is marked dead.[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://github.com/ibm-power-utilities/powerpc-utils/tree/next/src/drmgr
Quoted 8 lines
[sshegde: wrote the changelog and tested it]Fixes 4ae8d9aa9f9d ("sched/deadline: Fix dl_server getting stuck")Reported-by Venkat Rao Bagalkote <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Signed-off-by Shrikanth Hegde <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Shrikanth Hegde <[email protected]>
Looks good to me.
Thanks!
Juri
Quoted 40 lines · Juri Lelli
Hello,
Quoted 28 lines · Shrikanth Hegde
From: Peter Zijlstra (Intel) <[email protected]>
IBM CI tool reported kernel warning[1] when running a CPU removal operation through drmgr[2]. i.e "drmgr -c cpu -r -q 1"
WARNING: CPU: 0 PID: 0 at kernel/sched/cpudeadline.c:219 cpudl_set+0x58/0x170 NIP [c0000000002b6ed8] cpudl_set+0x58/0x170 LR [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 Call Trace: [c000000002c2f8c0] init_stack+0x78c0/0x8000 (unreliable) [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 [c00000000034df84] __hrtimer_run_queues+0x1a4/0x390 [c00000000034f624] hrtimer_interrupt+0x124/0x300 [c00000000002a230] timer_interrupt+0x140/0x320Git bisects to: commit
4ae8d9aa9f9d("sched/deadline: Fixdl_servergetting stuck")This happens since:
-dl_serverhrtimer gets enqueued close to cpu offline, whenkthread_parkenqueues a fair task.
- CPU goes offline and drmgr removes it fromcpu_present_mask.
- hrtimer fires and warning is hit.Fix it by stopping the
dl_serverbefore CPU is marked dead.[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://github.com/ibm-power-utilities/powerpc-utils/tree/next/src/drmgrQuoted 8 lines
[sshegde: wrote the changelog and tested it]Fixes 4ae8d9aa9f9d ("sched/deadline: Fix dl_server getting stuck")Reported-by Venkat Rao Bagalkote <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Signed-off-by Shrikanth Hegde <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Shrikanth Hegde <[email protected]>
Quoted 7 lines
Looks good to me.
Acked-by Juri Lelli <[email protected]>Thanks!
Juri
Hi All,
Could we expect this patch to address the following issue as well?
https://lore.kernel.org/all/[email protected]/
Thanks,
Youngmin.
Juri Lelli
maintainerQuoted 49 lines · Youngmin Nam
Quoted 40 lines · Juri Lelli
Hello,
Quoted 28 lines · Shrikanth Hegde
From: Peter Zijlstra (Intel) <[email protected]>
IBM CI tool reported kernel warning[1] when running a CPU removal operation through drmgr[2]. i.e "drmgr -c cpu -r -q 1"
WARNING: CPU: 0 PID: 0 at kernel/sched/cpudeadline.c:219 cpudl_set+0x58/0x170 NIP [c0000000002b6ed8] cpudl_set+0x58/0x170 LR [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 Call Trace: [c000000002c2f8c0] init_stack+0x78c0/0x8000 (unreliable) [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 [c00000000034df84] __hrtimer_run_queues+0x1a4/0x390 [c00000000034f624] hrtimer_interrupt+0x124/0x300 [c00000000002a230] timer_interrupt+0x140/0x320Git bisects to: commit
4ae8d9aa9f9d("sched/deadline: Fixdl_servergetting stuck")This happens since:
-dl_serverhrtimer gets enqueued close to cpu offline, whenkthread_parkenqueues a fair task.
- CPU goes offline and drmgr removes it fromcpu_present_mask.
- hrtimer fires and warning is hit.Fix it by stopping the
dl_serverbefore CPU is marked dead.[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://github.com/ibm-power-utilities/powerpc-utils/tree/next/src/drmgrQuoted 8 lines
[sshegde: wrote the changelog and tested it]Fixes 4ae8d9aa9f9d ("sched/deadline: Fix dl_server getting stuck")Reported-by Venkat Rao Bagalkote <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Signed-off-by Shrikanth Hegde <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Shrikanth Hegde <[email protected]>Quoted 7 lines
Looks good to me.
Acked-by Juri Lelli <[email protected]>Thanks!
Juri
Quoted 5 lines
Hi All,
Could we expect this patch to address the following issue as well?
I don't think I see a direct connection with it.
Thanks,
Juri
[tip: sched/urgent] sched/deadline: Stop dl_server before CPU goes offline
In reply to Shrikanth HegdeThe following commit has been merged into the sched/urgent branch of tip:
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: ee6e44dfe6e50b4a5df853d933a96bdff5309e6e Gitweb: https://git.kernel.org/tip/ee6e44dfe6e50b4a5df853d933a96bdff5309e6e Author: Peter Zijlstra (Intel) <[email protected]> AuthorDate: Fri, 10 Oct 2025 00:17:27 +05:30 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 14 Oct 2025 13:43:08 +02:00
sched/deadline: Stop dl_server before CPU goes offline
IBM CI tool reported kernel warning[1] when running a CPU removal operation through drmgr[2]. i.e "drmgr -c cpu -r -q 1"
WARNING: CPU: 0 PID: 0 at kernel/sched/cpudeadline.c:219 cpudl_set+0x58/0x170 NIP [c0000000002b6ed8] cpudl_set+0x58/0x170 LR [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 Call Trace: [c000000002c2f8c0] init_stack+0x78c0/0x8000 (unreliable) [c0000000002b7cb8] dl_server_timer+0x168/0x2a0 [c00000000034df84] __hrtimer_run_queues+0x1a4/0x390 [c00000000034f624] hrtimer_interrupt+0x124/0x300 [c00000000002a230] timer_interrupt+0x140/0x320
Git bisects to: commit 4ae8d9aa9f9d ("sched/deadline: Fix dl_server getting stuck")
This happens since:
- dl_server hrtimer gets enqueued close to cpu offline, when kthread_park enqueues a fair task.
- CPU goes offline and drmgr removes it from cpu_present_mask.
- hrtimer fires and warning is hit.
Fix it by stopping the dl_server before CPU is marked dead.
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://github.com/ibm-power-utilities/powerpc-utils/tree/next/src/drmgr
--- kernel/sched/core.c | 2 ++ kernel/sched/deadline.c | 3 +++ 2 files changed, 5 insertions(+)
kernel/sched/core.c +2 -0
@@ -8571,10 +8571,12 @@ int sched_cpu_dying(unsigned int cpu)sched_tick_stop (cpu);rq_lock_irqsave (rq, &rf); +update_rq_clock (rq);if (rq->nr_running !=1 ||rq_has_pinned_tasks (rq)) {WARN (true,"Dying CPU not properly vacated!" );dump_rq_tasks (rq,KERN_WARNING ); } +dl_server_stop (&rq->fair_server);rq_unlock_irqrestore (rq, &rf);calc_load_migrate (rq);
kernel/sched/deadline.c +3 -0
@@ -1582,6 +1582,9 @@ void dl_server_start(struct sched_dl_entity *dl_se)if (!dl_server (dl_se) || dl_se->dl_server_active)return ; +if (WARN_ON_ONCE (!cpu_online (cpu_of (rq)))) +return ; + dl_se->dl_server_active =1 ;enqueue_dl_entity (dl_se,ENQUEUE_WAKEUP );if (!dl_task (dl_se->rq->curr) ||dl_entity_preempt (dl_se, &rq->curr->dl))