linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Hardware watchpoints on Cell/B.E. broken
@ 2007-11-09 18:54 Ulrich Weigand
  2007-11-09 21:08 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrich Weigand @ 2007-11-09 18:54 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: arnd

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@de.ibm.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Hardware watchpoints on Cell/B.E. broken
  2007-11-09 18:54 Hardware watchpoints on Cell/B.E. broken Ulrich Weigand
@ 2007-11-09 21:08 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-09 21:08 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: linuxppc-dev, arnd


On Fri, 2007-11-09 at 19:54 +0100, Ulrich Weigand wrote:
> 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 ...

Hrm, ok, something we missed, I'll have a look. The whole DABR / debug
register handling need work anyway.

Ben.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-09 21:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-09 18:54 Hardware watchpoints on Cell/B.E. broken Ulrich Weigand
2007-11-09 21:08 ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).