aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2008-03-17 00:27:09 -0400
committerPaul Mackerras <paulus@samba.org>2008-03-19 19:14:55 -0400
commit44387e9ff25267c78a99229aca55ed750e9174c7 (patch)
tree84485e031d4a97898e3a80b5dc1c5a09b2e6e222 /arch/powerpc
parentc2372eb9bcafdd149b26987a8c25bbed92fd2775 (diff)
[POWERPC] Fix PMU + soft interrupt disable bug
Since the PMU is an NMI now, it can come at any time we are only soft disabled. We must hard disable around the two places we allow the kernel stack SLB and r1 to go out of sync. Otherwise the PMU exception can force a kernel stack SLB into another slot, which can lead to it getting evicted, which can lead to a nasty unrecoverable SLB miss in the exception entry code. Signed-off-by: Anton Blanchard <anton@samba.org> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/process.c6
-rw-r--r--arch/powerpc/mm/slb.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 4846bf543a8c..59311ec0d422 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -353,6 +353,12 @@ struct task_struct *__switch_to(struct task_struct *prev,
353 account_process_vtime(current); 353 account_process_vtime(current);
354 calculate_steal_time(); 354 calculate_steal_time();
355 355
356 /*
357 * We can't take a PMU exception inside _switch() since there is a
358 * window where the kernel stack SLB and the kernel stack are out
359 * of sync. Hard disable here.
360 */
361 hard_irq_disable();
356 last = _switch(old_thread, new_thread); 362 last = _switch(old_thread, new_thread);
357 363
358 local_irq_restore(flags); 364 local_irq_restore(flags);
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index 47b06bad24ad..906daeda59a8 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -124,6 +124,12 @@ void slb_flush_and_rebolt(void)
124 ksp_vsid_data = get_slb_shadow()->save_area[2].vsid; 124 ksp_vsid_data = get_slb_shadow()->save_area[2].vsid;
125 } 125 }
126 126
127 /*
128 * We can't take a PMU exception in the following code, so hard
129 * disable interrupts.
130 */
131 hard_irq_disable();
132
127 /* We need to do this all in asm, so we're sure we don't touch 133 /* We need to do this all in asm, so we're sure we don't touch
128 * the stack between the slbia and rebolting it. */ 134 * the stack between the slbia and rebolting it. */
129 asm volatile("isync\n" 135 asm volatile("isync\n"