public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "K.Prasad" <prasad@linux.vnet.ibm.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Roland McGrath <roland@redhat.com>,
	richardj_moore@uk.ibm.com, jason.wessel@windriver.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	prasad@linux.vnet.ibm.com
Subject: [Patch 00/10] Hardware Breakpoint interfaces
Date: Sun, 15 Feb 2009 16:00:08 +0530	[thread overview]
Message-ID: <20090215103008.GA6855@in.ibm.com> (raw)

[Re-posting the patches with LKML included as a recipient]

Hi Ingo,
	Please find the patches that introduce interfaces to access
Hardware Breakpoint (or watchpoint) registers and an arch-specific
implementation for x86/x86_64 architecture. The patches have been
re-based to -tip tree (commit 4e3bae758b552d6bd094fb36e78a4d738cb42257)

A short description of the framework and interfaces is provided
below. Some of the details will be specific to x86/x86_64 architecture
and may vary depending upon the support provided by the target
processor.

Kindly accept these patches to become a part of -tip tree.

Description
-------------
The Hardware Breakpoint registers can be used for tracing changes to a
variable or data location (even I/O ports in x86/x86_64) and will be
extremely helpful in debugging problems such as memory corruption. While
these registers have been used by user-space debuggers for long (through
'ptrace' syscalls), Kgdb exploited them for kernel-space addresses.

The proposed framework, introduces interfaces to use them directly on
both  user- and kernel-space addresses apart from arbitrating requests
from various such users for the limited number of registers.

The interfaces are:

int register_kernel_hw_breakpoint(struct hw_breakpoint *);
void unregister_kernel_hw_breakpoint(struct hw_breakpoint *bp);

int register_user_hw_breakpoint(struct task_struct *tsk,
                                 struct hw_breakpoint *bp);
void unregister_user_hw_breakpoint(struct task_struct *tsk,
                struct hw_breakpoint *bp);

The 'struct hw_breakpoint' will be the anchor data-structure containing
all the necessary information such as name or address, type, length,
priority and pointers to handler functions (some of which are
arch-specific). More information about the role of each field, the
handler
functions and their return values can be found in the descriptive
comments
preceding these functions and in "include/asm-generic/hw_breakpoint.h".

While (un)register_user_hw_breakpoint() isn't exported yet, its
worker-routine __register_user-hw_breakpoint() is used by ptrace syscall
for all breakpoint register requirements. For the kernel-space, a simple
use case to trace 'write' operations on a kernel variable can be found
in samples/hw_breakpoint/data_breakpoint.c.

In the current patchset, support is provided only for read and
read-write breakpoints on data locations, which can be later expand to
include instruction and I/O breakpoints for x86/x86_64.

There is pending integration with 'KGDB' without which mutual exclusion
between them (KGDB and HW breakpoint use through above interfaces) needs
to be observed.

Thanks,
K.Prasad


             reply	other threads:[~2009-02-15 10:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-15 10:30 K.Prasad [this message]
2009-02-15 10:31 ` [Patch 1/10] Introducing generic hardware breakpoint handler interfaces K.Prasad
2009-02-15 10:32 ` [Patch 2/10] x86 architecture implementation of Hardware Breakpoint interfaces K.Prasad
2009-02-15 10:33 ` [Patch 3/10] Modifying generic debug exception to use virtual debug registers K.Prasad
2009-02-15 10:33 ` [Patch 4/10] Introduce virtual debug register in thread_struct and wrapper-routines around process related functions K.Prasad
2009-02-15 10:34 ` [Patch 5/10] Use wrapper routines around debug registers in processor " K.Prasad
2009-02-15 10:34 ` [Patch 6/10] Use virtual debug registers in process/thread handling code K.Prasad
2009-02-15 10:34 ` [Patch 7/10] Modify signal handling code to refrain from re-enabling HW Breakpoints K.Prasad
2009-02-15 10:35 ` [Patch 8/10] Modify Ptrace routines to access breakpoint registers K.Prasad
2009-02-15 10:35 ` [Patch 9/10] Cleanup HW Breakpoint registers before kexec K.Prasad
2009-02-15 10:36 ` [Patch 10/10] Sample HW breakpoint over kernel data address K.Prasad
  -- strict thread matches above, loose matches on Subject: below --
2009-02-13 14:53 [Patch 00/10] Hardware Breakpoint interfaces K.Prasad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090215103008.GA6855@in.ibm.com \
    --to=prasad@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=richardj_moore@uk.ibm.com \
    --cc=roland@redhat.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox