[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAq0SUkrF12gQpb6Qq-P5r4eobcajF=c_oGGTeOfwVNY8rppww@mail.gmail.com>
Date: Mon, 15 May 2023 15:58:09 -0300
From: Wander Lairson Costa <wander@...hat.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: "Christian Brauner (Microsoft)" <brauner@...nel.org>,
"Michael S. Tsirkin" <mst@...hat.com>,
Mike Christie <michael.christie@...cle.com>,
Peter Zijlstra <peterz@...radead.org>,
Guo Ren <guoren@...nel.org>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Nicholas Piggin <npiggin@...il.com>,
Andrei Vagin <avagin@...il.com>,
open list <linux-kernel@...r.kernel.org>,
Hu Chunyu <chuhu@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Paul McKenney <paulmck@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH v8] kernel/fork: beware of __put_task_struct calling context
On Mon, May 15, 2023 at 3:09 PM Oleg Nesterov <oleg@...hat.com> wrote:
>
> On 05/15, Wander Lairson Costa wrote:
> > On Mon, May 15, 2023 at 1:43 PM Oleg Nesterov <oleg@...hat.com> wrote:
> > >
> > > Certainly I have missed something...
> > >
> > > but,
> > >
> > > On 05/15, Wander Lairson Costa wrote:
> > > >
> > > > -extern void __put_task_struct(struct task_struct *t);
> > > > +extern void ___put_task_struct(struct task_struct *t);
> > > > +extern void __put_task_struct_rcu_cb(struct rcu_head *rhp);
> > >
> > > I don't understand these renames, why can't you simply put this fix
> > > into put_task_struct() ?
> > >
> >
> > No particular reason, it was just a matter of style and keep the parts simple.
>
> Well, to me a single/simple change in put_task_struct() makes more
> sense, but I won't argue.
>
My initial thought was to break the code in smaller functions, but
maybe just changing put_task_struct() could be better.
> static inline void put_task_struct(struct task_struct *t)
> {
> if (!refcount_dec_and_test(...))
> return;
>
> if (IS_ENABLED(PREEMPT_RT) && ...)
> return call_rcu(...);
>
> ...
> __put_task_struct();
> ...
> }
>
> > > > +static inline void __put_task_struct(struct task_struct *tsk)
> > > > +{
> > > ...
> > > > + if (IS_ENABLED(CONFIG_PREEMPT_RT) && !preemptible())
> > > > + call_rcu(&tsk->rcu, __put_task_struct_rcu_cb);
> > > > + else
> > > > + ___put_task_struct(tsk);
> > > > +}
> > >
> > > did you see the emails from Peter? In particular, this one:
> > >
> > > https://lore.kernel.org/lkml/20230505133902.GC38236@hirez.programming.kicks-ass.net/
> > >
> >
> > I didn't notice the lock_acquire/lock_release part. However, I tested
> > the patch with CONFIG_PROVE_RAW_LOCK_NESTING and there was no warning.
>
> Hmm. I tend to trust the Sebastian's analysis in
>
> https://lore.kernel.org/all/Y+zFNrCjBn53%2F+Q2@linutronix.de/
>
> I'll try to look at it later, although I hope Sebastian or Peter
> can explain this before I try ;)
>
The inability to see and reproduce the potential issue is part of my
confusion about addressing this property.
> Oleg.
>
Powered by blists - more mailing lists