[PATCH] [ppc64] allow oprofile module to be safely unloaded

Anton Blanchard anton at samba.org
Tue Aug 17 04:11:34 EST 2004


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 <anton at samba.org>

diff -puN arch/ppc64/kernel/traps.c~oprofile-3 arch/ppc64/kernel/traps.c
--- linux-2.5/arch/ppc64/kernel/traps.c~oprofile-3	2004-08-15 06:04:59.800226959 +1000
+++ linux-2.5-anton/arch/ppc64/kernel/traps.c	2004-08-15 06:17:33.918867410 +1000
@@ -492,8 +492,15 @@ static inline void emulate_single_step(s
 		SingleStepException(regs);
 }

+/* 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/op_model_power4.c~oprofile-3 arch/ppc64/oprofile/op_model_power4.c
diff -puN arch/ppc64/oprofile/common.c~oprofile-3 arch/ppc64/oprofile/common.c
--- linux-2.5/arch/ppc64/oprofile/common.c~oprofile-3	2004-08-15 06:18:15.778542250 +1000
+++ linux-2.5-anton/arch/ppc64/oprofile/common.c	2004-08-15 06:19:13.001083615 +1000
@@ -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)

_

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list