diff options
| author | Tejun Heo <tj@kernel.org> | 2026-04-25 03:31:36 +0300 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-04-25 03:31:36 +0300 |
| commit | 7fb39e4eb4c3db52e4707a6a1cd45362f7e803f5 (patch) | |
| tree | f651e0c7f74c9d3a19458672ee8e8d255e400e9e /include | |
| parent | 2f2ea77092660b53bfcbc4acc590b57ce9ab5dce (diff) | |
| download | linux-7fb39e4eb4c3db52e4707a6a1cd45362f7e803f5.tar.xz | |
sched_ext: Save and restore scx_locked_rq across SCX_CALL_OP
SCX_CALL_OP{,_RET}() unconditionally clears scx_locked_rq_state to NULL on
exit. Correct at the top level, but ops can recurse via
scx_bpf_sub_dispatch(): a parent's ops.dispatch calls the helper, which
invokes the child's ops.dispatch under another SCX_CALL_OP. When the inner
call returns, the NULL clobbers the outer's state. The parent's BPF then
calls kfuncs like scx_bpf_cpuperf_set() which read scx_locked_rq()==NULL and
re-acquire the already-held rq.
Snapshot scx_locked_rq_state on entry and restore on exit. Rename the rq
parameter to locked_rq across all SCX_CALL_OP* macros so the snapshot local
can be typed as 'struct rq *' without colliding with the parameter token in
the expansion. SCX_CALL_OP_TASK{,_RET}() and SCX_CALL_OP_2TASKS_RET() funnel
through the two base macros and inherit the fix.
Fixes: 4f8b122848db ("sched_ext: Add basic building blocks for nested sub-scheduler dispatching")
Reported-by: Chris Mason <clm@meta.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
