* [PATCH V2] sparc64: fatal trap should stop all cpus
@ 2015-01-05 23:17 Dave Kleikamp
2015-01-06 22:23 ` David Miller
2015-01-06 23:34 ` Dave Kleikamp
0 siblings, 2 replies; 3+ messages in thread
From: Dave Kleikamp @ 2015-01-05 23:17 UTC (permalink / raw)
To: sparclinux
On 01/04/2015 10:58 PM, David Miller wrote:
> However I also have to wonder if we should be doing a hypervisor
> or firmware CPU stop call in that handler.
>
> That's what the XEN x86 implementation does.
That probably makes sense. I had created the patch a while back and
had forgotten about it. I don't remember exactly what I followed as
an example.
> It should logically do something like:
>
> if (tlb_type = hypervisor) {
> if (ldom_domaining_enabled)
> sun4v_stop_cpu(cpuid);
> else
> prom_stopcpu_cpuid(cpuid);
> } else
> smp_call_function(wrapper_around_prom_stopself, NULL, 0);
>
The below patch works with the hypervisor. I'm not sure if the calls
to set_cpu_online are really needed, but I left them in for now.
"echo c > /proc/sysrq-trigger" does not result in a system crash. There
are two problems. One is that the trap handler ignores the global
variable, panic_on_oops. The other is that smp_send_stop() is a no-op
which leaves the other cpus running normally when one cpu panics.
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
---
arch/sparc/kernel/smp_64.c | 30 +++++++++++++++++++++++++++---
arch/sparc/kernel/traps_64.c | 2 ++
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index da6f1a7..0064e3f 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1406,11 +1406,35 @@ void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs)
scheduler_ipi();
}
-/* This is a nop because we capture all other cpus
- * anyways when making the PROM active.
- */
+static void stop_this_cpu(void *dummy)
+{
+ set_cpu_online(smp_processor_id(), false);
+
+ prom_stopself();
+}
+
void smp_send_stop(void)
{
+ int cpu;
+
+ if (tlb_type = hypervisor) {
+ for_each_online_cpu(cpu) {
+ if (cpu = smp_processor_id())
+ continue;
+ set_cpu_online(cpu, false);
+#ifdef CONFIG_SUN_LDOMS
+ if (ldom_domaining_enabled) {
+ unsigned long hv_err;
+ hv_err = sun4v_cpu_stop(cpu);
+ if (hv_err)
+ printk(KERN_ERR "sun4v_cpu_stop() "
+ "failed err=%lu\n", hv_err);
+ } else
+#endif
+ prom_stopcpu_cpuid(cpu);
+ }
+ } else
+ smp_call_function(stop_this_cpu, NULL, 0);
}
/**
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index 981a769..5555dd6 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -2427,6 +2427,8 @@ void __noreturn die_if_kernel(char *str, struct pt_regs *regs)
}
user_instruction_dump ((unsigned int __user *) regs->tpc);
}
+ if (panic_on_oops)
+ panic("Fatal exception");
if (regs->tstate & TSTATE_PRIV)
do_exit(SIGKILL);
do_exit(SIGSEGV);
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] sparc64: fatal trap should stop all cpus
2015-01-05 23:17 [PATCH V2] sparc64: fatal trap should stop all cpus Dave Kleikamp
@ 2015-01-06 22:23 ` David Miller
2015-01-06 23:34 ` Dave Kleikamp
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-01-06 22:23 UTC (permalink / raw)
To: sparclinux
From: Dave Kleikamp <dave.kleikamp@oracle.com>
Date: Mon, 05 Jan 2015 17:17:23 -0600
> The below patch works with the hypervisor. I'm not sure if the calls
> to set_cpu_online are really needed, but I left them in for now.
I don't see any other implementation of smp_send_stop() doing this.
I'd rather you leave it out.
Please also submit new versions of patches properly, as fresh
list postings.
Otherwise I have to edit out the commit message and that's more
work for me.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] sparc64: fatal trap should stop all cpus
2015-01-05 23:17 [PATCH V2] sparc64: fatal trap should stop all cpus Dave Kleikamp
2015-01-06 22:23 ` David Miller
@ 2015-01-06 23:34 ` Dave Kleikamp
1 sibling, 0 replies; 3+ messages in thread
From: Dave Kleikamp @ 2015-01-06 23:34 UTC (permalink / raw)
To: sparclinux
On 01/06/2015 04:23 PM, David Miller wrote:
> From: Dave Kleikamp <dave.kleikamp@oracle.com>
> Date: Mon, 05 Jan 2015 17:17:23 -0600
>
>> The below patch works with the hypervisor. I'm not sure if the calls
>> to set_cpu_online are really needed, but I left them in for now.
>
> I don't see any other implementation of smp_send_stop() doing this.
>
> I'd rather you leave it out.
Okay. I'm fine with that.
> Please also submit new versions of patches properly, as fresh
> list postings.
>
> Otherwise I have to edit out the commit message and that's more
> work for me.
No problem
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-06 23:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-05 23:17 [PATCH V2] sparc64: fatal trap should stop all cpus Dave Kleikamp
2015-01-06 22:23 ` David Miller
2015-01-06 23:34 ` Dave Kleikamp
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.