From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Will Deacon <will.deacon@arm.com>
Cc: mark.rutland@arm.com, catalin.marinas@arm.com,
james.morse@arm.com, linux-arm-kernel@lists.infradead.org,
dave.martin@arm.com, Cristian Marussi <cristian.marussi@arm.com>
Subject: Re: [PATCH] arm64: smp: fix smp_send_stop() behaviour
Date: Tue, 18 Jun 2019 13:54:13 +0100 [thread overview]
Message-ID: <20190618125413.7la4mg3mojfshw6n@shell.armlinux.org.uk> (raw)
In-Reply-To: <20190617180913.GN30800@fuggles.cambridge.arm.com>
On Mon, Jun 17, 2019 at 07:09:13PM +0100, Will Deacon wrote:
> [+James M]
>
> On Thu, Jun 13, 2019 at 01:21:46PM +0100, Cristian Marussi wrote:
> > On a 2-CPUs system, when one CPU is already online if the other
> > panics while starting-up, smp_send_stop() will fail to send any
> > STOP message to the other already online core, resulting in a
> > system still responsive and alive at the end of the panic procedure.
> > This patch makes smp_send_stop() account also for the online status
> > of the calling CPU while evaluating how many CPUs are effectively
> > online: this way, an adequate number of STOPs is sent, so enforcing
> > a proper freeze of the system at the end of panic even under the
> > above conditions.
> >
> > Reported-by: Dave Martin <Dave.Martin@arm.com>
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> >
> > This peculiar panic-procedure behaviour was exposed hitting a BUG()
> > while running a KSFT cpu-hotplug test on a 2-core ARMv8 model.
> > Such trigger-BUG() was fixed by a distinct commit already included
> > in Linux 5.2-rc4 [0]
> >
> > [0] https://lore.kernel.org/linux-arm-kernel/1559576102-12156-1-git-send-email-Dave.Martin@arm.com/
> > ---
> > arch/arm64/kernel/smp.c | 12 +++++++++---
> > 1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> > index bb4b3f07761a..c7d604427883 100644
> > --- a/arch/arm64/kernel/smp.c
> > +++ b/arch/arm64/kernel/smp.c
> > @@ -971,8 +971,14 @@ void tick_broadcast(const struct cpumask *mask)
> > void smp_send_stop(void)
> > {
> > unsigned long timeout;
> > + unsigned int this_cpu_online = cpu_online(smp_processor_id());
> >
> > - if (num_online_cpus() > 1) {
> > + /*
> > + * If this CPU isn't fully online, it will not be counted in
> > + * num_online_cpus(): on a 2-CPU system this situation will
> > + * result in no message being sent to the other already online CPU.
> > + */
> > + if (num_online_cpus() > this_cpu_online) {
> > cpumask_t mask;
> >
> > cpumask_copy(&mask, cpu_online_mask);
> > @@ -985,10 +991,10 @@ void smp_send_stop(void)
> >
> > /* Wait up to one second for other CPUs to stop */
> > timeout = USEC_PER_SEC;
> > - while (num_online_cpus() > 1 && timeout--)
> > + while (num_online_cpus() > this_cpu_online && timeout--)
> > udelay(1);
> >
> > - if (num_online_cpus() > 1)
> > + if (num_online_cpus() > this_cpu_online)
> > pr_warning("SMP: failed to stop secondary CPUs %*pbl\n",
> > cpumask_pr_args(cpu_online_mask));
>
> Whilst this looks ok to me, I'm worried about whether or not we have this
> sort of logic elsewhere. For example, do we need to fix
> crash_smp_send_stop() (and possibly machine_kexec()) too?
What about other architectures? This, or very similar code, is present
on other architectures too.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-18 13:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 12:21 [PATCH] arm64: smp: fix smp_send_stop() behaviour Cristian Marussi
2019-06-17 18:09 ` Will Deacon
2019-06-18 9:36 ` James Morse
2019-06-18 9:58 ` Cristian Marussi
2019-06-18 9:41 ` Cristian Marussi
2019-06-18 12:46 ` Will Deacon
2019-06-18 12:54 ` Russell King - ARM Linux admin [this message]
2019-06-18 17:40 ` Cristian Marussi
[not found] ` <CANW9uyt1_Jt=Lk_Y7OQOEnSx7rZg5J5gQYcZcxU8TeZRYYHLCQ@mail.gmail.com>
2019-06-18 9:56 ` Cristian Marussi
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=20190618125413.7la4mg3mojfshw6n@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=catalin.marinas@arm.com \
--cc=cristian.marussi@arm.com \
--cc=dave.martin@arm.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=will.deacon@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).