Skip to content

Commit ee6e44d

Browse files
author
Peter Zijlstra (Intel)
committed
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 4ae8d9a ("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 [sshegde: wrote the changelog and tested it] Fixes: 4ae8d9a ("sched/deadline: Fix dl_server getting stuck") Closes: https://lore.kernel.org/all/[email protected] Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reported-by: Venkat Rao Bagalkote <[email protected]> Signed-off-by: Shrikanth Hegde <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Tested-by: Shrikanth Hegde <[email protected]>
1 parent 3a86608 commit ee6e44d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

kernel/sched/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8571,10 +8571,12 @@ int sched_cpu_dying(unsigned int cpu)
85718571
sched_tick_stop(cpu);
85728572

85738573
rq_lock_irqsave(rq, &rf);
8574+
update_rq_clock(rq);
85748575
if (rq->nr_running != 1 || rq_has_pinned_tasks(rq)) {
85758576
WARN(true, "Dying CPU not properly vacated!");
85768577
dump_rq_tasks(rq, KERN_WARNING);
85778578
}
8579+
dl_server_stop(&rq->fair_server);
85788580
rq_unlock_irqrestore(rq, &rf);
85798581

85808582
calc_load_migrate(rq);

kernel/sched/deadline.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,9 @@ void dl_server_start(struct sched_dl_entity *dl_se)
15821582
if (!dl_server(dl_se) || dl_se->dl_server_active)
15831583
return;
15841584

1585+
if (WARN_ON_ONCE(!cpu_online(cpu_of(rq))))
1586+
return;
1587+
15851588
dl_se->dl_server_active = 1;
15861589
enqueue_dl_entity(dl_se, ENQUEUE_WAKEUP);
15871590
if (!dl_task(dl_se->rq->curr) || dl_entity_preempt(dl_se, &rq->curr->dl))

0 commit comments

Comments
 (0)