mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ravindran, Binoy" <binoy@vt.edu>
To: "paulmck@kernel.org" <paulmck@kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>,
	Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
	Joel Fernandes <joelagnelf@nvidia.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Boqun Feng <boqun@kernel.org>,
	Uladzislau Rezki <urezki@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Zqiang <qiang.zhang@linux.dev>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Miroslav Benes <mbenes@suse.cz>, Petr Mladek <pmladek@suse.com>,
	Joe Lawrence <joe.lawrence@redhat.com>,
	Song Liu <song@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	Jiri Kosina <jikos@kernel.org>,
	"rcu@vger.kernel.org" <rcu@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"live-patching@vger.kernel.org" <live-patching@vger.kernel.org>,
	Yafang Shao <laoar.shao@gmail.com>,
	"Shastri, Jaidev" <jaidevshastri@vt.edu>
Subject: Re: [PATCH v4 1/3] rcu-tasks: Add helpers to visit tasks on the exit lists
Date: Mon, 30 Nov 2026 18:17:41 +0000	[thread overview]
Message-ID: <DM6PR05MB41373C11AD718D6D353B5583D14E2@DM6PR05MB4137.namprd05.prod.outlook.com> (raw)
In-Reply-To: <9c5f9c77-95f9-4850-9355-13e9ac0ba6d4@paulmck-laptop>


On Mon, Nov 30, 2026, Paul E. McKenney wrote:
> OK, I will bite...
>
> Why not simply invoke synchronize_rcu_tasks(), after which any of the
> tasks that were missed will have already exited?

That was our first attempt, and it is not enough, for two reasons.

First, the task we miss can be in a quiescent state as far as RCU Tasks
is concerned. It is sleeping voluntarily in do_exit() after
exit_notify(), with a return address into the old patch's code on its
stack. A voluntary context switch is an RCU Tasks quiescent state, and
check_holdout_task() drops a holdout as soon as its nvcsw has changed,
so the grace period can end while the task is still asleep there. When
it wakes, it returns into freed text. With synchronize_rcu_tasks()
before the free of the replaced patch and a 2 s sleep injected after
exit_notify(), 5 of 6 runs still crashed.

Second, the problem is not only the free. The transition must not
switch a task while one of its frames is in a function being patched.
The invisible task is never checked, so klp_try_complete_transition()
can finish while the task still runs the old function, and the
consistency model is broken whether or not anything is freed. A wait
at free cannot repair that, since it runs after the transition has
already completed.

So the transition itself has to see these tasks and check their
stacks, which is what the rest of this series does. In v5, which I
plan to post this week, the two helpers in this patch are replaced by
a single walk of the exit lists that can drop the list lock, using the
same cursor scheme as rcu_tasks_postscan(). If you would prefer a
different interface on the RCU side, I am happy to rework it.

Thanks,
Binoy


  reply	other threads:[~2026-11-30 18:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 16:41 [PATCH v4 0/3] livepatch: Do not lose exiting tasks during a transition Binoy Ravindran via B4 Relay
2026-11-26 16:41 ` [PATCH v4 1/3] rcu-tasks: Add helpers to visit tasks on the exit lists Binoy Ravindran via B4 Relay
2026-11-26 18:52   ` Petr Mladek
2026-11-27 18:56     ` Ravindran, Binoy
2026-11-30 17:42   ` Paul E. McKenney
2026-11-30 18:17     ` Ravindran, Binoy [this message]
2026-11-30 19:55       ` Paul E. McKenney
2026-12-01  0:29         ` Ravindran, Binoy
2026-12-01  1:24           ` Paul E. McKenney
2026-12-02  6:16             ` Ravindran, Binoy
2026-11-26 16:41 ` [PATCH v4 2/3] livepatch: Include exiting tasks in the transition Binoy Ravindran via B4 Relay
2026-11-27 16:10   ` Petr Mladek
2026-11-27 19:30     ` Ravindran, Binoy
2026-11-26 16:41 ` [PATCH v4 3/3] livepatch: Select TASKS_RCU Binoy Ravindran via B4 Relay

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=DM6PR05MB41373C11AD718D6D353B5583D14E2@DM6PR05MB4137.namprd05.prod.outlook.com \
    --to=binoy@vt.edu \
    --cc=boqun@kernel.org \
    --cc=frederic@kernel.org \
    --cc=jaidevshastri@vt.edu \
    --cc=jiangshanlai@gmail.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=joelagnelf@nvidia.com \
    --cc=josh@joshtriplett.org \
    --cc=jpoimboe@kernel.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mbenes@suse.cz \
    --cc=mingo@kernel.org \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=pmladek@suse.com \
    --cc=qiang.zhang@linux.dev \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=song@kernel.org \
    --cc=urezki@gmail.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

all inboxes | Powered by JetHome®