All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sparc64: fatal trap should stop all cpus
@ 2014-12-29 23:23 Dave Kleikamp
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Kleikamp @ 2014-12-29 23:23 UTC (permalink / raw)
  To: sparclinux

"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   |   12 +++++++++---
 arch/sparc/kernel/traps_64.c |    2 ++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 32d4b3b..37d5789 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1406,11 +1406,17 @@ 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.
- */
+void stop_this_cpu(void *dummy)
+{
+	set_cpu_online(smp_processor_id(), false);
+
+	local_irq_disable();
+	while (1) ;
+}
+
 void smp_send_stop(void)
 {
+	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 e7ecf15..720be08 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -2408,6 +2408,8 @@ void 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] 2+ messages in thread
* Re: [PATCH] sparc64: fatal trap should stop all cpus
@ 2015-01-05  4:58 David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-01-05  4:58 UTC (permalink / raw)
  To: sparclinux

From: Dave Kleikamp <dave.kleikamp@oracle.com>
Date: Mon, 29 Dec 2014 17:23:10 -0600

> +	while (1) ;

Like the powerpc implementation, please correctly format this as:

	while (1)
		;

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.

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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-05  4:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-29 23:23 [PATCH] sparc64: fatal trap should stop all cpus Dave Kleikamp
  -- strict thread matches above, loose matches on Subject: below --
2015-01-05  4:58 David Miller

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.