public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces
@ 2008-10-20  9:33 Albert Cahalan
  2008-10-20  9:52 ` K.Prasad
  0 siblings, 1 reply; 16+ messages in thread
From: Albert Cahalan @ 2008-10-20  9:33 UTC (permalink / raw)
  To: prasad, linux-kernel

I'd just like to point out that not all hardware breakpoints
involve addresses. For example:

The OLPC XO uses an x86 processor called the Geode.
It supports a breakpoint that traps based on the opcode.
For example, one could set it to trap on arpl instructions.

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces
@ 2008-12-18 16:34 Richard J Moore
  0 siblings, 0 replies; 16+ messages in thread
From: Richard J Moore @ 2008-12-18 16:34 UTC (permalink / raw)
  To: linux-kernel


"K.Prasad" <prasad@linux.vnet.ibm.com> wrote on 17/12/2008 03:47:03:

> [image removed]
>
> Re: [RFC Patch 1/9] Introducing generic hardware breakpoint handler
interfaces
>
> K.Prasad
>
> to:.
>
> David Daney
>
> 17/12/2008 03:47
>
> Cc:
>
> Linux Kernel Mailing List, Alan Stern, Roland McGrath, akpm, mingo,
> Richard J Moore>
>
> Please respond to prasad
>
> On Thu, Dec 04, 2008 at 11:38:17AM -0800, David Daney wrote:
> > K.Prasad wrote:
> > [...]
> >> + * len and type values are defined in include/asm/hw_breakpoint.h.
> >> + * Available values vary according to the architecture.  On i386 the
> >> + * possibilities are:
> >> + *
> >> + *   HW_BREAKPOINT_LEN_1
> >> + *   HW_BREAKPOINT_LEN_2
> >> + *   HW_BREAKPOINT_LEN_4
> >> + *   HW_BREAKPOINT_LEN_EXECUTE
> >> + *   HW_BREAKPOINT_RW
> >> + *   HW_BREAKPOINT_READ
> >> + *   HW_BREAKPOINT_EXECUTE
> >> + *
> >> + * On other architectures HW_BREAKPOINT_LEN_8 may be available, and
the
> >> + * 1-, 2-, and 4-byte lengths may be unavailable.  There also may be
> >> + * HW_BREAKPOINT_WRITE.  You can use #ifdef to check at compile time.
> >> + */
> >
> > On MIPS we support breakpoint lengths that are powers of 2 between 8
and
> > 4096.  Do you really want symbolic values for these?  The debuggers
have
> > to do calculations with the length values, so translating between the
> > symbolic values and numeric values would be tedious at best.
> >
> >
> > David Daney
>
> Given that the possible values for length are finite and small on
> x86(just three of them), it was chosen to be defined as constants.
>
> For architectures such as MIPS where a range of lengths can be possibly
> monitored using HW Breakpoints, the arch_validate_hwbkpt_settings()
> maybe suitably written to validate the input and the 'length' may also
> be specified in numeric terms to the kernel interface (say
> register_kernel_hw_breakpoint()).
>
> Thanks,
> K.Prasad
>

I think you need to cater for an arch-specific filter that validates the
appearance of breakpoint interrupt. On the System Z, for example, one
specifies a range using the pair of control registers, one for the start
and the other of the end. You might think that this limits you to having
only one contiguous range of addresses which generate a h/w bp interrupt.
Not so. We use an algorithm, which employes a wrapping range
(i.e start addr > end addr) and we continually resize the gap, whenever we
take a BP interrupt, to begin at the next valid BP. That way we avoid too
many erroneous interrupts and we also benignly filter the erroneous ones.

Other architectures that employ a variable range could do something
similar.
I'm thinking here of IA64 for example.

The other thing that occurs to me is whether you should also include
HW_BREAKPOINT_IO for completeness. Of course not everyone supports
breakpointing the I/O address space, but some do, so it ought to be catered

for.


Richard
zVM CP Development


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [RFC Patch 0/9] Hardware Breakpoint interfaces - v2
@ 2008-12-04 19:08 K.Prasad
  2008-12-04 19:11 ` [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces K.Prasad
  0 siblings, 1 reply; 16+ messages in thread
From: K.Prasad @ 2008-12-04 19:08 UTC (permalink / raw)
  To: Linux Kernel Mailing List
  Cc: Alan Stern, Roland McGrath, akpm, mingo, richardj_moore, prasad

Hi All,
	Please find the latest set of patches that introduce kernel
interfaces to use Hardware Breakpoint registers and an implementation
for x86 (and x86_64) architecture.

The patches have undergone changes to incorporate the suggestions for
the previous patchset - including removal of support for instruction
breakpoint, and are based off 2.6.28-rc7. The patches have been tested
on x86 architecture along with kprobes, however they're posted as RFC
owing to the many pending tasks (refer
http://lkml.org/lkml/2008/10/7/127 for details).

Thanks,
K.Prasad


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [RFC Patch 0/9] Hardware Breakpoint interfaces - v2
@ 2008-10-08 19:20 K.Prasad
  2008-10-08 19:23 ` [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces K.Prasad
  0 siblings, 1 reply; 16+ messages in thread
From: K.Prasad @ 2008-10-08 19:20 UTC (permalink / raw)
  To: Linux Kernel Mailing List
  Cc: Alan Stern, Roland McGrath, akpm, mingo, jason.wessel, avi,
	richardj_moore, prasad

Hi All,
	I'm posting a new revision of the patches for using HW
Breakpoint registers (first version posted y'day:
http://lkml.org/lkml/2008/10/7/127).

This patch includes changes which were agreed upon, following the
comments from Alan Stern. The patches which are still marked as RFC
(pending much larger discussion and interest) is based on 2.6.27-rc9.

Thanks,
K.Prasad


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [RFC Patch 0/9] Hardware Breakpoint interfaces
@ 2008-10-07 11:38 K.Prasad
  2008-10-07 11:40 ` [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces K.Prasad
  0 siblings, 1 reply; 16+ messages in thread
From: K.Prasad @ 2008-10-07 11:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alan Stern, Roland McGrath, akpm, mingo, jason.wessel, avi,
	richardj_moore, prasad

Hi All,
	In the ensuing mails, please find the patches that provide
interfaces to use Hardware Breakpoint (or Hardware watchpoint registers)
for addresses in kernel- and user-space.

This work is primarily based on the patches that were discussed earlier
on Linux Kernel Mailing List (http://lkml.org/lkml/2007/3/2/221) through
a discussion initiated by Alan Stern and carried forward with extensive
help from Roland McGrath (copied). They now ported to the most recent
kernel version (2.6.27-rc9) along with changes to the invocation of
'@triggered' function (presently split into pre_ and post_handler
routines).

These patches add a new feature to the kernel i.e. use HW breakpoint
registers to watch kernel-space data (for read/write operations) and
kernel instructions for execute operations. The interfaces introduced
through these patches for handling HW Breakpoint registers, namely
(un)register_<kernel/user>_hw_breakpoint() are intended to serve as
core-routines that will interact with the hardware registers directly,
while the users of breakpoint registers will do so through these
interfaces. Given the large number of such users in the kernel (such
as KGDB, KVM for kernel-space), not all of them have been modified
to use the proposed interfaces - atleast in this iteration of patches.

The patches are marked as [RFC], meaning that there is plenty of
'work-in-progress' and here is a near-exhaustive list of them:

- Enable KGDB and KVM to use the register_kernel_hw_breakpoint()
  interface for their HW Breakpoint usage, in the absence of which
  they will be broken during simultaneous use.
- Stress test the patches to study the behaviour during multiple
  requests from various sources/requests beyond available number of
  registers.
- Support multiple handlers for a given breakpoint in kernel- or
  user-space address.
- Provide complete breakpoint functionality in x86 i.e. include
  breakpoints on I/O operations.
- Addition of Documentation/hw_bkpt.txt and samples/hw_breakpoint/*.c
  files for better readability.
- Code re-arrangement to avoid the #include of kernel/hw_breakpoint.c in
  arch/x86/kernel/hw_breakpoint.c

Thanks,
K.Prasad


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

end of thread, other threads:[~2008-12-18 16:34 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-20  9:33 [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces Albert Cahalan
2008-10-20  9:52 ` K.Prasad
  -- strict thread matches above, loose matches on Subject: below --
2008-12-18 16:34 Richard J Moore
2008-12-04 19:08 [RFC Patch 0/9] Hardware Breakpoint interfaces - v2 K.Prasad
2008-12-04 19:11 ` [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces K.Prasad
2008-12-04 19:38   ` David Daney
2008-12-17  3:47     ` K.Prasad
2008-10-08 19:20 [RFC Patch 0/9] Hardware Breakpoint interfaces - v2 K.Prasad
2008-10-08 19:23 ` [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces K.Prasad
2008-10-16  2:49   ` Roland McGrath
2008-10-16  3:45     ` K.Prasad
2008-10-18  0:34       ` Roland McGrath
2008-10-16 14:38     ` Alan Stern
2008-10-17 23:58       ` Roland McGrath
2008-10-18 15:23         ` Alan Stern
2008-10-07 11:38 [RFC Patch 0/9] Hardware Breakpoint interfaces K.Prasad
2008-10-07 11:40 ` [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces K.Prasad
2008-10-07 15:21   ` Alan Stern
2008-10-07 16:49     ` K.Prasad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox