* [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize sch->disable_irq_work
@ 2026-05-08 11:50 Zqiang
2026-05-08 15:14 ` Tejun Heo
2026-05-08 20:47 ` sashiko-bot
0 siblings, 2 replies; 3+ messages in thread
From: Zqiang @ 2026-05-08 11:50 UTC (permalink / raw)
To: tj, void, arighi, changwoo, yphbchou0911
Cc: sched-ext, linux-kernel, qiang.zhang
For built with PREEMPT_RT kernels, the scx_disable_irq_workfn() is
called from per-cpu irq_work kthreads context, this means that
when call the scx_dump_state() in the scx_disable_irq_workfn() to
output current->comm/pid, it always output current irq_work kthread's
comm/pid. this commit therefore use the IRQ_WORK_INIT_HARD() to
initialize sch->disable_irq_work to make scx_disable_irq_workfn() is
called from hardirq context.
Signed-off-by: Zqiang <qiang.zhang@linux.dev>
---
kernel/sched/ext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index d5be34e7b8ae..ef4e8e6addd1 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -6770,7 +6770,7 @@ static struct scx_sched *scx_alloc_and_add_sched(struct scx_enable_cmd *cmd,
sch->slice_dfl = SCX_SLICE_DFL;
atomic_set(&sch->exit_kind, SCX_EXIT_NONE);
- init_irq_work(&sch->disable_irq_work, scx_disable_irq_workfn);
+ sch->disable_irq_work = IRQ_WORK_INIT_HARD(scx_disable_irq_workfn);
kthread_init_work(&sch->disable_work, scx_disable_workfn);
timer_setup(&sch->bypass_lb_timer, scx_bypass_lb_timerfn, 0);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize sch->disable_irq_work
2026-05-08 11:50 [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize sch->disable_irq_work Zqiang
@ 2026-05-08 15:14 ` Tejun Heo
2026-05-08 20:47 ` sashiko-bot
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2026-05-08 15:14 UTC (permalink / raw)
To: Zqiang; +Cc: void, arighi, changwoo, yphbchou0911, sched-ext, linux-kernel
Hello,
Applied to sched_ext/for-7.1-fixes with the following Fixes: tag added:
Fixes: f4a6c506d118 ("sched_ext: Always bounce scx_disable() through irq_work")
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize sch->disable_irq_work
2026-05-08 11:50 [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize sch->disable_irq_work Zqiang
2026-05-08 15:14 ` Tejun Heo
@ 2026-05-08 20:47 ` sashiko-bot
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-05-08 20:47 UTC (permalink / raw)
To: Zqiang; +Cc: sched-ext
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch forces scx_disable_irq_workfn to run in hardirq context, causing unbounded execution time with interrupts disabled, which severely breaks PREEMPT_RT latency guarantees.
--
commit 3f0e90ad5f7a3132810aa08d6137cba68235020c
Author: Zqiang <qiang.zhang@linux.dev>
sched_ext: Use IRQ_WORK_INIT_HARD() to initialize sch->disable_irq_work
This commit changes the initialization of the disable_irq_work in sched_ext
to use IRQ_WORK_INIT_HARD(). The intention is to force
scx_disable_irq_workfn() to run in hardirq context rather than a threaded
kthread on PREEMPT_RT, so that scx_dump_state() captures the expected
comm and pid.
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 345aa11b84b28..c6b6038a97010 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
[ ... ]
> @@ -6559,7 +6559,7 @@ static struct scx_sched *scx_alloc_and_add_sched(struct sched_ext_ops *ops,
>
> sch->slice_dfl = SCX_SLICE_DFL;
> atomic_set(&sch->exit_kind, SCX_EXIT_NONE);
> - init_irq_work(&sch->disable_irq_work, scx_disable_irq_workfn);
> + sch->disable_irq_work = IRQ_WORK_INIT_HARD(scx_disable_irq_workfn);
Will executing this in hardirq context cause severe latency spikes or hard
lockups on PREEMPT_RT?
scx_disable_irq_workfn() calls scx_dump_state(), which performs a heavy
workload. It iterates over all possible CPUs, takes their raw_spinlock_t
runqueue locks, formats sequence buffers, saves stack traces, and executes
BPF dump callbacks.
Performing this work with interrupts entirely disabled can break PREEMPT_RT
latency guarantees.
Instead of moving the entire dump to hardirq context, could the original
task's comm and pid be captured and stored in scx_exit_info during
scx_vexit()?
This would allow the heavy dump workload to remain safely deferred to the
threaded kthread execution.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260508115045.23739-1-qiang.zhang@linux.dev?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-08 20:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08 11:50 [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize sch->disable_irq_work Zqiang
2026-05-08 15:14 ` Tejun Heo
2026-05-08 20:47 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox