From: Andreas Schwab <schwab@suse.de>
To: linux-riscv@lists.infradead.org
Subject: [PATCH] riscv: don't stop itself in smp_send_stop
Date: Thu, 29 Nov 2018 17:32:03 +0100 [thread overview]
Message-ID: <mvmbm67etfg.fsf@suse.de> (raw)
Only run ipi_stop on other cpus, not itself. Don't wait for ipi_stop to
return, since it never does. Also, mark each cpu offline.
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
arch/riscv/kernel/smp.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c
index 57b1383e5e..5c6bb5fe5a 100644
--- a/arch/riscv/kernel/smp.c
+++ b/arch/riscv/kernel/smp.c
@@ -23,6 +23,7 @@
#include <linux/smp.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
+#include <linux/delay.h>
#include <asm/sbi.h>
#include <asm/tlbflush.h>
@@ -148,13 +149,27 @@ void arch_send_call_function_single_ipi(int cpu)
static void ipi_stop(void *unused)
{
+ set_cpu_online (smp_processor_id(), false);
while (1)
wait_for_interrupt();
}
void smp_send_stop(void)
{
- on_each_cpu(ipi_stop, NULL, 1);
+ unsigned long timeout;
+ struct cpumask mask;
+
+ cpumask_copy (&mask, cpu_online_mask);
+ cpumask_clear_cpu (smp_processor_id (), &mask);
+ on_each_cpu_mask(&mask, ipi_stop, NULL, 0);
+
+ /* Wait up to one second for other CPUs to stop */
+ timeout = USEC_PER_SEC;
+ while (num_online_cpus() > 1 && timeout--)
+ udelay(1);
+
+ if (num_online_cpus() > 1)
+ pr_warn("SMP: failed to stop secondary CPUs\n");
}
void smp_send_reschedule(int cpu)
--
2.19.2
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2018-11-29 16:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-29 16:32 Andreas Schwab [this message]
2018-11-29 18:52 ` [PATCH] riscv: don't stop itself in smp_send_stop Atish Patra
2018-12-10 10:58 ` Andreas Schwab
2018-12-11 0:06 ` Atish Patra
2018-12-11 10:20 ` [PATCH v2] " Andreas Schwab
2018-12-13 23:27 ` Atish Patra
2019-01-03 19:22 ` Palmer Dabbelt
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=mvmbm67etfg.fsf@suse.de \
--to=schwab@suse.de \
--cc=linux-riscv@lists.infradead.org \
/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.