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: Tue, 1 Dec 2026 00:29:12 +0000	[thread overview]
Message-ID: <DM6PR05MB4137F26038663BCAF976D0A0D14D2@DM6PR05MB4137.namprd05.prod.outlook.com> (raw)
In-Reply-To: <ea412dcb-b3e5-4a8e-841d-343699365b84@paulmck-laptop>


On Mon, Nov 30, 2026, Paul E. McKenney wrote:
> I instead suggest keeping your overall algorithm, including your walk
> of the tasks list, and replacing the call to your Tasks-RCU helper
> function with synchronize_rcu_tasks().  This does not wait for tasks
> with preemption disabled that are working towards their last call
> to schedule(), but those can be handled with a subsequent call to
> synchronize_rcu_tasks_rude().

Thanks, and sorry for misreading your first question. I see what you
mean now, and I tried the core of it.

The test kernel is v7.4-rc2 with that change and nothing else from our
series. The transition walks the task list as before, and it does not
walk the exit lists. Once every task it finds has switched,
klp_try_complete_transition() calls synchronize_rcu_tasks() and then
synchronize_rcu_tasks_rude(), just before the cleanup.

To trigger the race, a test-only hook makes exiting tasks sleep after
exit_notify(). Two livepatches that both replace do_exit() replace
each other in a loop, and the old module is removed each time.

With a 2 s sleep, all 12 runs crashed. In every run, an exiting task
woke up and went back into memory that the removed module had used.
That memory was unmapped, filled with int3 after the free, or already
holding the next module's code.

With a 20 ms sleep, all 12 runs finished their cycles, 120 in all,
without a fault. Without the two waits, the same 20 ms test crashed in
11 of 12 runs.

So the waits only delay the cleanup. A short sleep can end in time,
but a long one does not. The reason is that a task asleep in do_exit()
after exit_notify() is in an RCU Tasks quiescent state, so the grace
period does not wait for it. The rude flavor does not help either,
because it does not cover a sleeping task.

That is why the series has the transition find these tasks on the
exit lists and check their stacks, as it does for every other task.

Thanks,
Binoy



  reply	other threads:[~2026-12-01  0:29 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
2026-11-30 19:55       ` Paul E. McKenney
2026-12-01  0:29         ` Ravindran, Binoy [this message]
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=DM6PR05MB4137F26038663BCAF976D0A0D14D2@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®