All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Joel Fernandes <joel@joelfernandes.org>
Cc: Will Deacon <will@kernel.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Zhouyi Zhou <zhouzhouyi@gmail.com>,
	"moderated list:ARM/STM32 ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	Marc Zyngier <maz@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	rcu <rcu@vger.kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>
Subject: Re: arm64 torture test hotplug failures (offlining causes -EBUSY)
Date: Thu, 19 Jan 2023 09:12:48 +0000	[thread overview]
Message-ID: <Y8kJkMp/oZRJxXUp@FVFF77S0Q05N> (raw)
In-Reply-To: <CAEXW_YQ=v0u+NFCwUcvMcYfsMXknb8YJrfGgKSW=dCA56Q+a0A@mail.gmail.com>

Hi Joel, Will,

On Wed, Jan 18, 2023 at 10:01:07PM +0000, Joel Fernandes wrote:
> On Wed, Jan 18, 2023 at 4:51 PM Will Deacon <will@kernel.org> wrote:
> > On Tue, Jan 17, 2023 at 08:00:58PM -0800, Paul E. McKenney wrote:
> > > On Wed, Jan 18, 2023 at 02:17:06AM +0000, Joel Fernandes wrote:
> > >
> > > I would be happier to forgive failure to offline housekeeping CPUs than
> > > blanket forgiveness of CPU 0.  Especially given that I recently got
> > > burned by a non-zero boot cpu.  ;-)
> > >
> > > But wouldn't it be even better for cpu_is_hotpluggable() to know the
> > > NO_HZ_FULL rules of the road?
> > >
> > > > Adding Frederic to CC as well as we are talking about
> > > > housekeeping/isolation stuff.
> > >
> > > But as you say, perhaps Frederic has a better idea.
> > >
> > > > > And topology_init() sets this based on platform_can_hotplug_cpu(cpu).
> > > > > And this function sets CPU 0 as !cpu_is_hotpluggable() unless the
> > > > > architecture specifies a .cpu_can_disable() function.
> > > >
> > > > Ah, that is 32-bit ARM code only. This issue is on 64-bit ARM (arch/arm64/).
> > >
> > > Apologies!  I will look more carefully at the pathnames next time!
> > >
> > > But maybe arm64 needs something similar?
> >
> > Just chiming quickly from the arm64 side here, but there's nothing in the
> > architecture that precludes offlining CPU 0 and it certainly works on some
> > platforms, so I'd be hesitant to rule it out entirely for testing.
> >
> > One reason why hotplug can fail in practice is if a trusted OS (i.e. code
> > running on the secure side of the fence outside of Linux's view of the
> > world) is resident on a core and rejects firmware requests to power it
> > off. The PSCI code (drivers/firmware/psci/) should detect this and return
> > -EPERM, although earlier in this thread there was mention of -EBUSY so it
> > sounds like something else...
> 
> Thank you for the heads up on that. To give you context, I am
> currently testing rcutorture on stable kernels 5.10, 5.15, 6.1 on my
> ARM64 QC7180 board. I certainly don't want to hit the -EPERM in the
> future on this or other ARM64 hardware. It would be great if
> cpu_psci_cpu_can_disable() in arm64 can return false if hotplugging
> causes -EPERM indefinitely. Then we do not need to make any changes.

That should already be the case, and I think we're good on that front.

A trusted OS (which blocks offlining a CPU) will always be resident on a
specific CPU (since we don't have any code to migrate trusted OSs across CPUs
as this is not standardised, and we don't have code to instantiate a trusted OS
from Linux). Where a non-migrateable trusted OS is present, it's going to have
been instantiated prior to booting Linux, and therefore will be on CPU0 (or a
CPU that Linux is not using at all).

Given the above, the return value of cpu_psci_cpu_can_disable() should not
change for a given CPU, and it should only be able to return false on CPU0.
Most systems don't have a trusted OS blocking PSCI CPU_OFF, and CPU0 can be
offlined.

Thanks,
Mark.

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Joel Fernandes <joel@joelfernandes.org>
Cc: Will Deacon <will@kernel.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Zhouyi Zhou <zhouzhouyi@gmail.com>,
	"moderated list:ARM/STM32 ARCHITECTURE"
	<linux-arm-kernel@lists.infradead.org>,
	Marc Zyngier <maz@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	rcu <rcu@vger.kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>
Subject: Re: arm64 torture test hotplug failures (offlining causes -EBUSY)
Date: Thu, 19 Jan 2023 09:12:48 +0000	[thread overview]
Message-ID: <Y8kJkMp/oZRJxXUp@FVFF77S0Q05N> (raw)
In-Reply-To: <CAEXW_YQ=v0u+NFCwUcvMcYfsMXknb8YJrfGgKSW=dCA56Q+a0A@mail.gmail.com>

Hi Joel, Will,

On Wed, Jan 18, 2023 at 10:01:07PM +0000, Joel Fernandes wrote:
> On Wed, Jan 18, 2023 at 4:51 PM Will Deacon <will@kernel.org> wrote:
> > On Tue, Jan 17, 2023 at 08:00:58PM -0800, Paul E. McKenney wrote:
> > > On Wed, Jan 18, 2023 at 02:17:06AM +0000, Joel Fernandes wrote:
> > >
> > > I would be happier to forgive failure to offline housekeeping CPUs than
> > > blanket forgiveness of CPU 0.  Especially given that I recently got
> > > burned by a non-zero boot cpu.  ;-)
> > >
> > > But wouldn't it be even better for cpu_is_hotpluggable() to know the
> > > NO_HZ_FULL rules of the road?
> > >
> > > > Adding Frederic to CC as well as we are talking about
> > > > housekeeping/isolation stuff.
> > >
> > > But as you say, perhaps Frederic has a better idea.
> > >
> > > > > And topology_init() sets this based on platform_can_hotplug_cpu(cpu).
> > > > > And this function sets CPU 0 as !cpu_is_hotpluggable() unless the
> > > > > architecture specifies a .cpu_can_disable() function.
> > > >
> > > > Ah, that is 32-bit ARM code only. This issue is on 64-bit ARM (arch/arm64/).
> > >
> > > Apologies!  I will look more carefully at the pathnames next time!
> > >
> > > But maybe arm64 needs something similar?
> >
> > Just chiming quickly from the arm64 side here, but there's nothing in the
> > architecture that precludes offlining CPU 0 and it certainly works on some
> > platforms, so I'd be hesitant to rule it out entirely for testing.
> >
> > One reason why hotplug can fail in practice is if a trusted OS (i.e. code
> > running on the secure side of the fence outside of Linux's view of the
> > world) is resident on a core and rejects firmware requests to power it
> > off. The PSCI code (drivers/firmware/psci/) should detect this and return
> > -EPERM, although earlier in this thread there was mention of -EBUSY so it
> > sounds like something else...
> 
> Thank you for the heads up on that. To give you context, I am
> currently testing rcutorture on stable kernels 5.10, 5.15, 6.1 on my
> ARM64 QC7180 board. I certainly don't want to hit the -EPERM in the
> future on this or other ARM64 hardware. It would be great if
> cpu_psci_cpu_can_disable() in arm64 can return false if hotplugging
> causes -EPERM indefinitely. Then we do not need to make any changes.

That should already be the case, and I think we're good on that front.

A trusted OS (which blocks offlining a CPU) will always be resident on a
specific CPU (since we don't have any code to migrate trusted OSs across CPUs
as this is not standardised, and we don't have code to instantiate a trusted OS
from Linux). Where a non-migrateable trusted OS is present, it's going to have
been instantiated prior to booting Linux, and therefore will be on CPU0 (or a
CPU that Linux is not using at all).

Given the above, the return value of cpu_psci_cpu_can_disable() should not
change for a given CPU, and it should only be able to return false on CPU0.
Most systems don't have a trusted OS blocking PSCI CPU_OFF, and CPU0 can be
offlined.

Thanks,
Mark.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-01-19  9:13 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 17:03 arm64 torture test hotplug failures (offlining causes -EBUSY) Joel Fernandes
2023-01-16 17:03 ` Joel Fernandes
2023-01-16 18:03 ` Marc Zyngier
2023-01-16 18:03   ` Marc Zyngier
2023-01-16 22:43   ` Joel Fernandes
2023-01-16 22:43     ` Joel Fernandes
2023-01-16 18:32 ` Zhouyi Zhou
2023-01-16 18:32   ` Zhouyi Zhou
2023-01-16 22:38   ` Joel Fernandes
2023-01-16 22:38     ` Joel Fernandes
2023-01-17  0:15     ` Joel Fernandes
2023-01-17  0:15       ` Joel Fernandes
2023-01-17  0:37       ` Zhouyi Zhou
2023-01-17  0:37         ` Zhouyi Zhou
2023-01-17  1:45         ` Joel Fernandes
2023-01-17  1:45           ` Joel Fernandes
2023-01-17  3:15           ` Zhouyi Zhou
2023-01-17  3:15             ` Zhouyi Zhou
2023-01-17  4:34             ` Joel Fernandes
2023-01-17  4:34               ` Joel Fernandes
2023-01-17 11:42               ` Zhouyi Zhou
2023-01-17 11:42                 ` Zhouyi Zhou
2023-01-17 19:50                 ` Joel Fernandes
2023-01-17 19:50                   ` Joel Fernandes
2023-01-18 10:15                 ` Zhouyi Zhou
2023-01-18 10:15                   ` Zhouyi Zhou
2023-01-18 15:51                   ` Joel Fernandes
2023-01-18 15:51                     ` Joel Fernandes
2023-01-17  4:30       ` Paul E. McKenney
2023-01-17  4:30         ` Paul E. McKenney
2023-01-17  4:36         ` Joel Fernandes
2023-01-17  4:36           ` Joel Fernandes
2023-01-17  4:54           ` Paul E. McKenney
2023-01-17  4:54             ` Paul E. McKenney
2023-01-17 20:02             ` Joel Fernandes
2023-01-17 20:02               ` Joel Fernandes
2023-01-17 20:42               ` Paul E. McKenney
2023-01-17 20:42                 ` Paul E. McKenney
2023-01-18  2:17                 ` Joel Fernandes
2023-01-18  2:17                   ` Joel Fernandes
2023-01-18  4:00                   ` Paul E. McKenney
2023-01-18  4:00                     ` Paul E. McKenney
2023-01-18 16:51                     ` Will Deacon
2023-01-18 16:51                       ` Will Deacon
2023-01-18 17:56                       ` Paul E. McKenney
2023-01-18 17:56                         ` Paul E. McKenney
2023-01-18 22:01                       ` Joel Fernandes
2023-01-18 22:01                         ` Joel Fernandes
2023-01-19  9:12                         ` Mark Rutland [this message]
2023-01-19  9:12                           ` Mark Rutland
2023-01-18 22:37                     ` Joel Fernandes
2023-01-18 22:37                       ` Joel Fernandes
2023-01-18 22:39                       ` Joel Fernandes
2023-01-18 22:39                         ` Joel Fernandes
2023-01-19  0:15                         ` Paul E. McKenney
2023-01-19  0:15                           ` Paul E. McKenney
2023-01-19  0:53                           ` Joel Fernandes
2023-01-19  0:53                             ` Joel Fernandes
2023-01-19  3:21                         ` Zhouyi Zhou
2023-01-19  3:21                           ` Zhouyi Zhou
2023-01-19  8:26                           ` Joel Fernandes
2023-01-19  8:26                             ` Joel Fernandes
2023-01-19 12:17                             ` Zhouyi Zhou
2023-01-19 12:17                               ` Zhouyi Zhou
2023-01-19 13:57                       ` Frederic Weisbecker
2023-01-19 13:57                         ` Frederic Weisbecker
2023-01-19 20:25                         ` Joel Fernandes
2023-01-19 20:25                           ` Joel Fernandes

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=Y8kJkMp/oZRJxXUp@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=frederic@kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=will@kernel.org \
    --cc=zhouzhouyi@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 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.