All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: paulmck@kernel.org,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	rcu@vger.kernel.org, Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Joel Fernandes <joel@joelfernandes.org>
Subject: Re: [PATCH] rcu/nocb: Extend checks for offloaded rdp by migrate_disable
Date: Wed, 28 Jul 2021 13:50:54 +0200	[thread overview]
Message-ID: <20210728115054.GB293265@lothringen> (raw)
In-Reply-To: <87mtq63khy.ffs@nanos.tec.linutronix.de>

On Wed, Jul 28, 2021 at 10:34:01AM +0200, Thomas Gleixner wrote:
> On Wed, Jul 28 2021 at 01:32, Frederic Weisbecker wrote:
> > On Tue, Jul 27, 2021 at 09:33:42PM +0200, Thomas Gleixner wrote:
> >> On Tue, Jul 27 2021 at 10:23, Paul E. McKenney wrote:
> >> > On Tue, Jul 27, 2021 at 06:38:15PM +0200, Sebastian Andrzej Siewior wrote:
> >> >> One thing that has been overseen is that a task within a migrate-disable
> >> >> region (as on PREEMPT_RT with disabled BH) is fully preemptible but may
> >> >> not be migrated to another CPU which should be enough to guarantee that
> >> >> rdp remains stable.
> >> >> 
> >> >> Check also disabled migration of the task if the RCU data pointer is
> >> >> from current CPU. Put the whole check within an SMP ifdef block since
> >> >> without SMP there are not CPU migrations to worry about (also
> >> >> task_struct::migration_disabled is missing).
> >> >> 
> >> >> Cc: Frederic Weisbecker <frederic@kernel.org>
> >> >> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> >> >> ---
> >> >> I don't fully understand why the CPU-hotplug lock matters here but this
> >> >> is beside the point ;)
> >> >
> >> > If I remember correctly, any attempt to change the offloaded state
> >> > must hold off CPU-hotplug operations.  So if the current thread is
> >> > holding off CPU-hotplug operations, no other thread can be doing
> >> > an offload or de-offload operation.
> >> 
> >> It only prevents unplugging of a CPU, but not plugging a CPU.
> >
> > Hmm, but both _cpu_down() and _cpu_up() do cpus_write_lock().
> > What did I overlook?
> 
> I meant, that preemption disable does not prevent plugging a CPU, but
> the final unplug step is prevented because the stomp machine thread
> cannot run. Similar for migrate_disable(). The final unplug step can
> only happen when all non-pinned tasks have left the migrate disabled
> section.

Ah ok so that should be fine since we rely on cpu_hotplug_lock to protect
against CPU hotplug here, preemption disabled is there for other purposes.

Thanks.

  reply	other threads:[~2021-07-28 11:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 16:38 [PATCH] rcu/nocb: Extend checks for offloaded rdp by migrate_disable Sebastian Andrzej Siewior
2021-07-27 17:23 ` Paul E. McKenney
2021-07-27 19:26   ` Sebastian Andrzej Siewior
2021-07-27 23:26     ` Frederic Weisbecker
2021-07-27 19:33   ` Thomas Gleixner
2021-07-27 23:32     ` Frederic Weisbecker
2021-07-28  8:34       ` Thomas Gleixner
2021-07-28 11:50         ` Frederic Weisbecker [this message]
2021-07-27 23:20   ` 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=20210728115054.GB293265@lothringen \
    --to=frederic@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.