Currently __this_cpu_inc() is used to increment elements of both the rcu_torture_count[] and rcu_torture_batch[] arrays. However, this can fail when the increments can happen in interrupt handlers, as recently became possible. This commit therefore upgrades the uses of __this_cpu_inc() to the interrupt-safe this_cpu_inc().
KCSAN located this issue. Signed-off-by: Paul E. McKenney <[email protected]> --- kernel/rcu/rcutorture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 8514fef3ec10b6..9180016d87c0ce 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2565,13 +2565,13 @@ static void rcu_torture_one_read_end(struct rcu_torture_one_read_state *rtorsp, rtorsp->ts, rtorsp->started, completed); rcu_ftrace_dump(DUMP_ALL); } - __this_cpu_inc(rcu_torture_count[pipe_count]); + this_cpu_inc(rcu_torture_count[pipe_count]); completed = rcutorture_seq_diff(completed, rtorsp->started); if (completed > RCU_TORTURE_PIPE_LEN) { /* Should not happen, but... */ completed = RCU_TORTURE_PIPE_LEN; } - __this_cpu_inc(rcu_torture_batch[completed]); + this_cpu_inc(rcu_torture_batch[completed]); preempt_enable(); if (rtorsp->checkpolling) { if (cur_ops->get_gp_state && cur_ops->poll_gp_state) -- 2.40.1

