Skip to content

Commit

Permalink
[POWERPC] Fix PMU + soft interrupt disable bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Anton Blanchard authored and Paul Mackerras committed Mar 19, 2008
1 parent c2372eb commit 44387e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/powerpc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ struct task_struct *__switch_to(struct task_struct *prev,
account_process_vtime(current);
calculate_steal_time();

/*
* We can't take a PMU exception inside _switch() since there is a
* window where the kernel stack SLB and the kernel stack are out
* of sync. Hard disable here.
*/
hard_irq_disable();
last = _switch(old_thread, new_thread);

local_irq_restore(flags);
Expand Down
6 changes: 6 additions & 0 deletions arch/powerpc/mm/slb.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ void slb_flush_and_rebolt(void)
ksp_vsid_data = get_slb_shadow()->save_area[2].vsid;
}

/*
* We can't take a PMU exception in the following code, so hard
* disable interrupts.
*/
hard_irq_disable();

/* We need to do this all in asm, so we're sure we don't touch
* the stack between the slbia and rebolting it. */
asm volatile("isync\n"
Expand Down

0 comments on commit 44387e9

Please sign in to comment.