Hardware watchpoints on Cell/B.E. broken

Ulrich Weigand uweigand at de.ibm.com
Sat Nov 10 05:54:19 EST 2007


Hello,

I've noticed that GDB hardware watchpoints do not work at all on Cell/B.E.
(when running without hypervisor); the kernel accepts the PTRACE_SET_DEBUGREG
call without error, but watchpoints never trigger.

This turns out to be caused by a new hardware feature in the PowerPC 2.02
architecture level: the DABRX register.  This register controls in which
modes of operation (problem state, privileged state, hypervisor state)
the DABR register takes effect.  (See Book III v 2.02 page 40.)

The default setting of that register on Cell/B.E. (at least on IBM blades),
which the Linux kernel currently never modifies, is to ignore DABR in all
modes -- thus watchpoints do not work at all.

The following hack sets the bit in the DABRX that enables the DABR for
problem state, whenever the DABR is set.  With this patch on top of the
current Fedora 8 update kernel (kernel-2.6.23.1-48.fc8) watchpoints work
again -- all relevant test cases in the GDB test suite now pass.

Obviously, the patch cannot be applied as-is; we need to make sure we are
on a machine that supports the DABRX feature.  Arnd asked me to post this
anyway as a heads-up on that problem ...

Bye,
Ulrich


--- linux-2.6.23.ppc64/arch/powerpc/kernel/process.c.orig
+++ linux-2.6.23.ppc64/arch/powerpc/kernel/process.c
@@ -229,6 +229,7 @@
 	/* XXX should we have a CPU_FTR_HAS_DABR ? */
 #if defined(CONFIG_PPC64) || defined(CONFIG_6xx)
 	mtspr(SPRN_DABR, dabr);
+	mtspr(1015, 1);  /* enable DABR for user space */
 #endif
 	return 0;
 }
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand at de.ibm.com



More information about the Linuxppc-dev mailing list