From: Anton Blanchard Allow the oprofile module to be unloaded, before we never removed the oprofile specific interrupt handler. Handle the pending exception case in the dummy interrupt handler instead. Signed-off-by: Anton Blanchard Signed-off-by: Andrew Morton --- 25-akpm/arch/ppc64/kernel/traps.c | 7 +++++++ 25-akpm/arch/ppc64/oprofile/common.c | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff -puN arch/ppc64/kernel/traps.c~ppc64-allow-oprofile-module-to-be-safely-unloaded arch/ppc64/kernel/traps.c --- 25/arch/ppc64/kernel/traps.c~ppc64-allow-oprofile-module-to-be-safely-unloaded 2004-08-16 11:55:06.386222408 -0700 +++ 25-akpm/arch/ppc64/kernel/traps.c 2004-08-16 11:55:06.392221496 -0700 @@ -520,8 +520,15 @@ void AltivecUnavailableException(struct die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT); } +/* Ensure exceptions are disabled */ +#define MMCR0_PMXE (1UL << (31 - 5)) + static void dummy_perf(struct pt_regs *regs) { + unsigned int mmcr0 = mfspr(SPRN_MMCR0); + + mmcr0 &= ~MMCR0_PMXE; + mtspr(SPRN_MMCR0, mmcr0); } void (*perf_irq)(struct pt_regs *) = dummy_perf; diff -puN arch/ppc64/oprofile/common.c~ppc64-allow-oprofile-module-to-be-safely-unloaded arch/ppc64/oprofile/common.c --- 25/arch/ppc64/oprofile/common.c~ppc64-allow-oprofile-module-to-be-safely-unloaded 2004-08-16 11:55:06.387222256 -0700 +++ 25-akpm/arch/ppc64/oprofile/common.c 2004-08-16 11:55:06.393221344 -0700 @@ -52,17 +52,10 @@ static int op_ppc64_setup(void) static void op_ppc64_shutdown(void) { - /* - * We need to be sure we have cleared all pending exceptions before - * removing the interrupt handler. For the moment we play it safe and - * leave it in - */ -#if 0 mb(); /* Remove our interrupt handler. We may be removing this module. */ perf_irq = save_perf_irq; -#endif } static void op_ppc64_cpu_start(void *dummy) _