linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix CPU hotplug when using the SLB shadow buffer
@ 2008-01-10  6:49 Michael Neuling
  2008-01-10  7:11 ` Michael Neuling
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Neuling @ 2008-01-10  6:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Nathan Lynch

Before we register the SLB shadow buffer, we need to invalidate the
entries in the buffer otherwise we can end up stale entries from when we
offlined the CPU.

This patch does this invalidate as well as unregistering the buffer with
PHYP before we offline the cpu.  Tested and fixes crashes seen on 970MP
(thanks to tonyb) and POWER5.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
paulus: This, or some variant of it, is probably 2.6.24 material.

 arch/powerpc/mm/slb.c                        |    2 +-
 arch/powerpc/platforms/pseries/hotplug-cpu.c |    2 ++
 arch/powerpc/platforms/pseries/lpar.c        |    6 ++++++
 3 files changed, 9 insertions(+), 1 deletion(-)

Index: linux-2.6-ozlabs/arch/powerpc/mm/slb.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/mm/slb.c
+++ linux-2.6-ozlabs/arch/powerpc/mm/slb.c
@@ -77,7 +77,7 @@ static inline void slb_shadow_update(uns
 	get_slb_shadow()->save_area[entry].esid = mk_esid_data(ea, ssize, entry);
 }
 
-static inline void slb_shadow_clear(unsigned long entry)
+void slb_shadow_clear(unsigned long entry)
 {
 	get_slb_shadow()->save_area[entry].esid = 0;
 }
Index: linux-2.6-ozlabs/arch/powerpc/platforms/pseries/hotplug-cpu.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ linux-2.6-ozlabs/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -29,6 +29,7 @@
 #include <asm/vdso_datapage.h>
 #include <asm/pSeries_reconfig.h>
 #include "xics.h"
+#include "plpar_wrappers.h"
 
 /* This version can't take the spinlock, because it never returns */
 static struct rtas_args rtas_stop_self_args = {
@@ -58,6 +59,7 @@ static void pseries_mach_cpu_die(void)
 	local_irq_disable();
 	idle_task_exit();
 	xics_teardown_cpu(0);
+	unregister_slb_shadow(smp_processor_id(), __pa(get_slb_shadow()));
 	rtas_stop_self();
 	/* Should never get here... */
 	BUG();
Index: linux-2.6-ozlabs/arch/powerpc/platforms/pseries/lpar.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/platforms/pseries/lpar.c
+++ linux-2.6-ozlabs/arch/powerpc/platforms/pseries/lpar.c
@@ -248,16 +248,22 @@ out:
 	of_node_put(stdout_node);
 }
 
+extern void slb_shadow_clear(unsigned long entry);
+
 void vpa_init(int cpu)
 {
 	int hwcpu = get_hard_smp_processor_id(cpu);
 	unsigned long addr;
 	long ret;
+	int i;
 
 	if (cpu_has_feature(CPU_FTR_ALTIVEC))
 		lppaca[cpu].vmxregs_in_use = 1;
 
 	addr = __pa(&lppaca[cpu]);
+	for (i = 0; i < SLB_NUM_BOLTED; i++){
+		slb_shadow_clear(i);
+	}
 	ret = register_vpa(hwcpu, addr);
 
 	if (ret) {

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

end of thread, other threads:[~2008-01-11  3:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-10  6:49 [PATCH] Fix CPU hotplug when using the SLB shadow buffer Michael Neuling
2008-01-10  7:11 ` Michael Neuling
2008-01-11  0:47   ` Michael Neuling
2008-01-11  1:12     ` Nathan Lynch
2008-01-11  2:59       ` Michael Neuling
2008-01-11  3:02       ` Michael Neuling

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