All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: Valentin Schneider <valentin.schneider@arm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Question about a8ea6fc9b089 ("sched: Stop PF_NO_SETAFFINITY from being inherited by various init system threads")
Date: Fri, 11 Jun 2021 10:11:38 -0700	[thread overview]
Message-ID: <20210611171138.GF4397@paulmck-ThinkPad-P17-Gen-1> (raw)
In-Reply-To: <20210611124212.GB143945@lothringen>

On Fri, Jun 11, 2021 at 02:42:12PM +0200, Frederic Weisbecker wrote:
> On Thu, Jun 10, 2021 at 01:17:13PM -0700, Paul E. McKenney wrote:
> > On Thu, Jun 10, 2021 at 07:28:57PM +0100, Valentin Schneider wrote:
> > > On 10/06/21 10:04, Paul E. McKenney wrote:
> > > 
> > > Hi,
> > > > Hello, Frederic,
> > > >
> > > > This commit works well, but has the unfortunate side-effect of making
> > > > smp_processor_id() complain when used in a preemptible region even
> > > > though the kthread has been pinned onto a single CPU by a call to
> > > > set_cpus_allowed_ptr().  (Which did return success.)
> > > >
> > > 
> > > On which tree are you encountering this?
> > 
> > I bisected to this commit in -next tag next-20210609, and this commit
> > could of course be an innocent bystander caught in the crossfire.
> > 
> > > Looking at check_preemption_disabled() and CPU affinity, v5.13-rc5 has:
> > > 
> > >         /*
> > >          * Kernel threads bound to a single CPU can safely use
> > >          * smp_processor_id():
> > >          */
> > >         if (current->nr_cpus_allowed == 1)
> > >                 goto out;
> > > 
> > > tip/sched/core additionally hinges that on PF_NO_SETAFFINITY:
> > > 
> > >   570a752b7a9b ("lib/smp_processor_id: Use is_percpu_thread() instead of nr_cpus_allowed")
> > > 
> > > The former shouldn't be affected by Frederic's patch, and the latter should
> > > only cause warnings if the pinned task isn't a "proper" kthread (thus
> > > doesn't have PF_NO_SETAFFINITY)... Exceptions that come to mind are things
> > > like UMH which doesn't use kthread_create().
> > 
> > And reverting 570a752b7a9b ("lib/smp_processor_id: Use is_percpu_thread()
> > instead of nr_cpus_allowed") causes the kernel to once again be OK with
> > smp_processor_id(), so thank you!  And apologies to Frederic for the
> > false alarm.
> > 
> > Added Yejune on CC.  Thoughts?
> 
> There is also that:
> 
>       15faafc6b449777a85c0cf82dd8286c293fed4eb ("sched,init: Fix DEBUG_PREEMPT
>       vs early boot")
> 
> Not sure if that will help but just in case.

Thank you for the pointer!  These tasks start later well after
kthreadd_done, so I believe that I dodged this particular bullet.  ;-)

						Thanx, Paul

      reply	other threads:[~2021-06-11 17:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 17:04 Question about a8ea6fc9b089 ("sched: Stop PF_NO_SETAFFINITY from being inherited by various init system threads") Paul E. McKenney
2021-06-10 18:28 ` Valentin Schneider
2021-06-10 20:17   ` Paul E. McKenney
2021-06-11 10:12     ` Valentin Schneider
2021-06-11 13:52       ` Paul E. McKenney
2021-06-11 14:19         ` Valentin Schneider
2021-06-11 17:10           ` Paul E. McKenney
2021-06-11 12:42     ` Frederic Weisbecker
2021-06-11 17:11       ` Paul E. McKenney [this message]

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=20210611171138.GF4397@paulmck-ThinkPad-P17-Gen-1 \
    --to=paulmck@kernel.org \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=valentin.schneider@arm.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 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.