Skip to content

Commit 541959b

Browse files
Zqianggregkh
authored andcommitted
sched_ext: Fix possible deadlock in the deferred_irq_workfn()
[ Upstream commit a257e97 ] For PREEMPT_RT=y kernels, the deferred_irq_workfn() is executed in the per-cpu irq_work/* task context and not disable-irq, if the rq returned by container_of() is current CPU's rq, the following scenarios may occur: lock(&rq->__lock); <Interrupt> lock(&rq->__lock); This commit use IRQ_WORK_INIT_HARD() to replace init_irq_work() to initialize rq->scx.deferred_irq_work, make the deferred_irq_workfn() is always invoked in hard-irq context. Signed-off-by: Zqiang <qiang.zhang@linux.dev> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Chen Yu <xnguchen@sina.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fc9ce76 commit 541959b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/sched/ext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6044,7 +6044,7 @@ void __init init_sched_ext_class(void)
60446044
BUG_ON(!zalloc_cpumask_var(&rq->scx.cpus_to_kick_if_idle, GFP_KERNEL));
60456045
BUG_ON(!zalloc_cpumask_var(&rq->scx.cpus_to_preempt, GFP_KERNEL));
60466046
BUG_ON(!zalloc_cpumask_var(&rq->scx.cpus_to_wait, GFP_KERNEL));
6047-
init_irq_work(&rq->scx.deferred_irq_work, deferred_irq_workfn);
6047+
rq->scx.deferred_irq_work = IRQ_WORK_INIT_HARD(deferred_irq_workfn);
60486048
init_irq_work(&rq->scx.kick_cpus_irq_work, kick_cpus_irq_workfn);
60496049

60506050
if (cpu_online(cpu))

0 commit comments

Comments
 (0)