[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <af7db745-97c6-467d-9ed2-798ef8b686ba@paulmck-laptop>
Date: Wed, 14 Aug 2024 09:13:22 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Neeraj Upadhyay <Neeraj.Upadhyay@...nel.org>
Cc: rcu@...r.kernel.org, linux-kernel@...r.kernel.org, kernel-team@...a.com,
rostedt@...dmis.org, Zqiang <qiang.zhang1211@...il.com>
Subject: Re: [PATCH rcu 1/6] rcu/tasks: Check processor-ID assumptions
On Wed, Aug 14, 2024 at 05:46:54PM +0530, Neeraj Upadhyay wrote:
> Hi Paul,
>
> On Thu, Aug 01, 2024 at 05:34:21PM -0700, Paul E. McKenney wrote:
> > The current mapping of smp_processor_id() to a CPU processing Tasks-RCU
> > callbacks makes some assumptions about layout. This commit therefore
> > adds a WARN_ON() to check these assumptions.
> >
> > Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
> > ---
> > kernel/rcu/tasks.h | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> > index b6fcf744af75d..d473846a572aa 100644
> > --- a/kernel/rcu/tasks.h
> > +++ b/kernel/rcu/tasks.h
> > @@ -355,6 +355,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func,
> > rcu_read_lock();
> > ideal_cpu = smp_processor_id() >> READ_ONCE(rtp->percpu_enqueue_shift);
> > chosen_cpu = cpumask_next(ideal_cpu - 1, cpu_possible_mask);
> > + WARN_ON_ONCE(chosen_cpu >= nr_cpu_ids);
>
> I have changed this s/nr_cpu_ids/rcu_task_cpu_ids/ , as there is a
> another commit fd70e9f1d85f "rcu-tasks: Fix access non-existent percpu
> rtpcp variable in rcu_tasks_need_gpcb()" which is included in the tree
> here [1]. Please let me know if something looks incorrect.
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/neeraj.upadhyay/linux-rcu.git/log/?h=next.14.08.24a
Good catch, looks good, and thank you!
Thanx, Paul
> - Neeraj
>
> > rtpcp = per_cpu_ptr(rtp->rtpcpu, chosen_cpu);
> > if (!raw_spin_trylock_rcu_node(rtpcp)) { // irqs already disabled.
> > raw_spin_lock_rcu_node(rtpcp); // irqs already disabled.
> > --
> > 2.40.1
> >
Powered by blists - more mailing lists