diff options
| author | zhidao su <suzhidao@xiaomi.com> | 2026-03-05 14:18:56 +0800 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-03-05 06:05:15 -1000 |
| commit | 0927780c90ce551869fb692279d66387a4b66af5 (patch) | |
| tree | 98a1c096961cad02bc46772c0b9eef035d56de93 /Documentation/console/git@git.tavy.me:linux.git | |
| parent | 6944e6d8a6d4c1e654de1da112da8fef1b30e623 (diff) | |
sched_ext: Use READ_ONCE() for lock-free reads of module param variables
bypass_lb_cpu() reads scx_bypass_lb_intv_us and scx_slice_bypass_us
without holding any lock, in timer callback context where module
parameter writes via sysfs can happen concurrently:
min_delta_us = scx_bypass_lb_intv_us / SCX_BYPASS_LB_MIN_DELTA_DIV;
^^^^^^^^^^^^^^^^^^^^
plain read -- KCSAN data race
if (delta < DIV_ROUND_UP(min_delta_us, scx_slice_bypass_us))
^^^^^^^^^^^^^^^^^
plain read -- KCSAN data race
scx_bypass_lb_intv_us already uses READ_ONCE() in scx_bypass_lb_timerfn()
and scx_bypass() for its other lock-free read sites, leaving
bypass_lb_cpu() inconsistent. scx_slice_bypass_us has the same
lock-free access pattern in the same function.
Fix both plain reads by using READ_ONCE() to complete the concurrent
access annotation and make the code KCSAN-clean.
Signed-off-by: zhidao su <suzhidao@xiaomi.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'Documentation/console/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
