[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dcea0803-7f9d-4d27-af68-1efb9015dbff@paulmck-laptop>
Date: Fri, 23 Feb 2024 16:28:19 -0800
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: Boqun Feng <boqun.feng@...il.com>, linux-kernel@...r.kernel.org,
rcu@...r.kernel.org, Neeraj Upadhyay <Neeraj.Upadhyay@....com>,
Chen Zhongjin <chenzhongjin@...wei.com>,
Yang Jihong <yangjihong1@...wei.com>,
Neeraj Upadhyay <quic_neeraju@...cinc.com>,
Joel Fernandes <joel@...lfernandes.org>,
Josh Triplett <josh@...htriplett.org>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Zqiang <qiang.zhang1211@...il.com>
Subject: Re: [PATCH v2 4/6] rcu-tasks: Maintain lists to eliminate
RCU-tasks/do_exit() deadlocks
On Fri, Feb 23, 2024 at 01:19:42PM +0100, Frederic Weisbecker wrote:
> On Fri, Feb 16, 2024 at 05:27:39PM -0800, Boqun Feng wrote:
> > -void exit_tasks_rcu_start(void) __acquires(&tasks_rcu_exit_srcu)
> > +void exit_tasks_rcu_start(void)
> > {
> > - current->rcu_tasks_idx = __srcu_read_lock(&tasks_rcu_exit_srcu);
> > + unsigned long flags;
> > + struct rcu_tasks_percpu *rtpcp;
> > + struct task_struct *t = current;
> > +
> > + WARN_ON_ONCE(!list_empty(&t->rcu_tasks_exit_list));
> > + preempt_disable();
> > + rtpcp = this_cpu_ptr(rcu_tasks.rtpcpu);
> > + t->rcu_tasks_exit_cpu = smp_processor_id();
> > + raw_spin_lock_irqsave_rcu_node(rtpcp, flags);
> > + if (!rtpcp->rtp_exit_list.next)
>
> And then you might want to turn that into a WARN_ONCE.
Excellent point, thank you!
I am queueing a separate patch for this with your Reported-by. (This
change can lag behind, just in case this series needs to go in quickly.)
Thanx, Paul
> Thanks.
>
> > + INIT_LIST_HEAD(&rtpcp->rtp_exit_list);
> > + list_add(&t->rcu_tasks_exit_list, &rtpcp->rtp_exit_list);
> > + raw_spin_unlock_irqrestore_rcu_node(rtpcp, flags);
> > + preempt_enable();
> > }
Powered by blists - more mailing lists