linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Eric W. Biederman" <ebiederm@xmission.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: "Paul E . McKenney" <paulmck@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Neeraj Upadhyay <quic_neeraju@quicinc.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Pengfei Xu <pengfei.xu@intel.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	rcu@vger.kernel.org
Subject: Re: [PATCH 3/3] rcu-tasks: Fix synchronize_rcu_tasks() VS zap_pid_ns_processes()
Date: Fri, 02 Dec 2022 17:28:54 -0600	[thread overview]
Message-ID: <87ilitpeq1.fsf@email.froward.int.ebiederm.org> (raw)
In-Reply-To: <20221202225428.GA1754872@lothringen> (Frederic Weisbecker's message of "Fri, 2 Dec 2022 23:54:28 +0100")

Frederic Weisbecker <frederic@kernel.org> writes:

> On Wed, Nov 30, 2022 at 12:37:15PM -0600, Eric W. Biederman wrote:
>> Frederic Weisbecker <frederic@kernel.org> writes:
>> Two questions.
>> 
>> 1) Is there any chance you need the exit_task_rcu_stop() and
>>    exit_tasks_rcu_start() around schedule in the part of this code that
>>    calls kernel_wait4.
>
> Indeed it could be relaxed there too if necessary.

I was just wondering how you tell if it is necessary and if perhaps
the kernel_wait4 was overlooked.

>> 2) I keep thinking zap_pid_ns_processes() should be changed so that
>>    after it sends SIGKILL to all of the relevant processes to not wait,
>>    and instead have wait_consider_task simply not allow the 
>>    init process of the pid namespace to be reaped.
>> 
>>    Am I right in thinking that such a change were to be made it would
>>    make remove the deadlock without having to have any special code?
>> 
>>    It is just tricky enough to do that I don't want to discourage your
>>    simpler change but this looks like a case that makes the pain of
>>    changing zap_pid_ns_processes worthwhile in the practice.
>
> So you mean it still reaps those that were EXIT_ZOMBIE before ignoring
> SIGCHLD (the kernel_wait4() call) but it doesn't sleep anymore on those
> that autoreap (or get reaped by a parent outside that namespace) after
> ignoring SIGCHLD? Namely it doesn't do the schedule() loop I'm working
> around here and proceeds with exit_notify() and notifies its parent?

Yes.  A change to make it work like when the thread group leader exits
before the other threads.  So any actual sleeping happens in the reaper
of the init process when the reaper calls wait(2).

> And then in this case the responsibility of sleeping, until the init_process
> of the namespace is the last task in the namespace, goes to the parent while
> waiting that init_process, right?
>
> But what if the init_process of the given namespace autoreaps? Should it then
> wait itself until the namespace is empty? And then aren't we back to the initial
> issue?

The idea is that we only care when the userspace cares.  I don't think
there is any kernel code that fundamentally cares.  There might be a few
bits that accidentally care and those would need to be take care of when
making the proposed change.  The wait would only exist for userspace so
the same semantics are observed.

Eric

  reply	other threads:[~2022-12-02 23:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 13:54 [PATCH 0/3] rcu-tasks: Fix race against exiting pid_ns Frederic Weisbecker
2022-11-25 13:54 ` [PATCH 1/3] rcu-tasks: Improve comments explaining tasks_rcu_exit_srcu purpose Frederic Weisbecker
2022-11-25 13:54 ` [PATCH 2/3] rcu-tasks: Remove preemption disablement around srcu_read_[un]lock() calls Frederic Weisbecker
2022-11-25 13:55 ` [PATCH 3/3] rcu-tasks: Fix synchronize_rcu_tasks() VS zap_pid_ns_processes() Frederic Weisbecker
2022-11-30 18:37   ` Eric W. Biederman
2022-12-02 19:51     ` Paul E. McKenney
2022-12-02 22:54     ` Frederic Weisbecker
2022-12-02 23:28       ` Eric W. Biederman [this message]
2022-12-04  0:03         ` Frederic Weisbecker
2022-12-06 16:49     ` Oleg Nesterov
2022-12-07 14:34       ` Paul E. McKenney
2022-12-07 20:01       ` Frederic Weisbecker
2022-12-07 20:39         ` Oleg Nesterov
2022-12-09 20:26           ` Frederic Weisbecker
2022-11-29  0:22 ` [PATCH 0/3] rcu-tasks: Fix race against exiting pid_ns Paul E. McKenney
2022-11-29  9:55   ` Frederic Weisbecker
2022-11-29 14:48     ` Paul E. McKenney
2022-12-02 22:55       ` Frederic Weisbecker

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=87ilitpeq1.fsf@email.froward.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=boqun.feng@gmail.com \
    --cc=frederic@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=pengfei.xu@intel.com \
    --cc=quic_neeraju@quicinc.com \
    --cc=rcu@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).