public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Wander Lairson Costa <wander@redhat.com>
Cc: "Christian Brauner (Microsoft)" <brauner@kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Mike Christie <michael.christie@oracle.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Guo Ren <guoren@kernel.org>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Suren Baghdasaryan <surenb@google.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Andrei Vagin <avagin@gmail.com>,
	open list <linux-kernel@vger.kernel.org>,
	Hu Chunyu <chuhu@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Paul McKenney <paulmck@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH v8] kernel/fork: beware of __put_task_struct calling context
Date: Mon, 15 May 2023 20:08:52 +0200	[thread overview]
Message-ID: <20230515180851.GD10759@redhat.com> (raw)
In-Reply-To: <CAAq0SUkHDf6Tnhrc5ys4rOGWtepFfdv3=d6GiA=BB7yvDUj8vw@mail.gmail.com>

On 05/15, Wander Lairson Costa wrote:
> On Mon, May 15, 2023 at 1:43 PM Oleg Nesterov <oleg@redhat.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.

	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 ;)

Oleg.


  reply	other threads:[~2023-05-15 18:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15 16:22 [PATCH v8] kernel/fork: beware of __put_task_struct calling context Wander Lairson Costa
2023-05-15 16:43 ` Oleg Nesterov
2023-05-15 17:14   ` Wander Lairson Costa
2023-05-15 18:08     ` Oleg Nesterov [this message]
2023-05-15 18:58       ` Wander Lairson Costa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230515180851.GD10759@redhat.com \
    --to=oleg@redhat.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=brauner@kernel.org \
    --cc=chuhu@redhat.com \
    --cc=guoren@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=michael.christie@oracle.com \
    --cc=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=surenb@google.com \
    --cc=vschneid@redhat.com \
    --cc=wander@redhat.com \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox