LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Christoph Hellwig <hch@infradead.org>
Cc: Andrew Morton <akpm@osdl.org>,
Prasanna S Panchamukhi <prasanna@in.ibm.com>,
Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Kwatch: kernel watchpoints using CPU debug registers
Date: Wed, 17 Jan 2007 11:33:58 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.44L0.0701171117540.2381-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <20070116233528.GA19834@infradead.org>
On Tue, 16 Jan 2007, Christoph Hellwig wrote:
> Fir4st I'd say thanks a lot for forward-porting this, it's really useful
> feature for all kinds of nasty debugging.
>
> I think you should split this into two patches, one for the debugreg
> infrastructure, and one for the actual kwatch code.
>
> Also I think you provide one (or even a few) example wathes for
> trivial things, say updating i_ino for an inode given through debugfs.
>
> Some comments on the code below:
Many thanks for your detailed comments and suggestions. It probably was
obvious that most of the things you picked up on were inherited from the
original Kwatch patch. I'll update my patch in accordance with your
suggestions.
Responses to just a couple of the comments:
> I suspect this should be replaced wit ha global and local variant
> to fix the above mentioned issue. It's a tiny bit duplicated code,
> but seems much cleaner.
It would indeed be cleaner. And in fact the local variant would have a
large amount of dead code, which could be left out entirely (at least from
the initial version). That's because the only current user of local debug
register allocations is ptrace.
> > +static void write_dr(int debugreg, unsigned long addr)
> > +{
> > + switch (debugreg) {
> > + case 0: set_debugreg(addr, 0); break;
> > + case 1: set_debugreg(addr, 1); break;
> > + case 2: set_debugreg(addr, 2); break;
> > + case 3: set_debugreg(addr, 3); break;
> > + case 6: set_debugreg(addr, 6); break;
> > + case 7: set_debugreg(addr, 7); break;
> > + }
> > +}
>
> What's the point of this wrapper?
It is called from two different places, and it's better than including
the "switch" in each place.
> I think large parts of this header should go into a new linux/kwatch.h
> so that generic code can use kwatches.
In the long run that may well be true. For now, I'm a little hesitant to
put something which works only on i386 under include/linux.
> > +config KWATCH
> > + bool "Kwatch points (EXPERIMENTAL)"
> > + depends on EXPERIMENTAL
> > + help
> > + Kwatch enables kernel-space data watchpoints using the processor's
> > + debug registers. It can be very useful for kernel debugging.
> > + If in doubt, say "N".
>
> I think we want different options for debugregs and kwatch. The debugreg
> one probably doesn't have to be actually user-visible, though.
It's easier to start out like this and then change it later when someone
comes up with another use for debugregs. Or perhaps by then the whole
thing will have been moved over to utrace, making the issue academic.
Alan Stern
next prev parent reply other threads:[~2007-01-17 16:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-16 16:55 Alan Stern
2007-01-16 23:35 ` Christoph Hellwig
2007-01-17 16:33 ` Alan Stern [this message]
2007-01-17 9:44 ` Ingo Molnar
2007-01-17 16:17 ` Alan Stern
2007-01-18 0:12 ` Christoph Hellwig
2007-01-18 7:31 ` Ingo Molnar
2007-01-18 15:37 ` Alan Stern
2007-01-18 22:33 ` Christoph Hellwig
2007-01-22 16:54 ` [PATCH - revised] " Alan Stern
2007-02-06 4:25 ` [PATCH] " Roland McGrath
[not found] <20070206042153.66AB418005D@magilla.sf.frob.com>
2007-02-06 19:58 ` Alan Stern
2007-02-07 2:56 ` Roland McGrath
[not found] <20070207025008.1B11118005D@magilla.sf.frob.com>
2007-02-07 19:22 ` Alan Stern
2007-02-07 22:08 ` Bob Copeland
2007-02-09 10:21 ` Roland McGrath
2007-02-09 15:54 ` Alan Stern
2007-02-09 23:31 ` Roland McGrath
2007-02-10 4:32 ` Alan Stern
2007-02-18 3:03 ` Roland McGrath
2007-02-21 20:35 ` Alan Stern
2007-02-22 11:43 ` S. P. Prasanna
2007-02-23 2:19 ` Roland McGrath
2007-02-23 16:55 ` Alan Stern
2007-02-24 0:08 ` Roland McGrath
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=Pine.LNX.4.44L0.0701171117540.2381-100000@iolanthe.rowland.org \
--to=stern@rowland.harvard.edu \
--cc=akpm@osdl.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=prasanna@in.ibm.com \
--subject='Re: [PATCH] Kwatch: kernel watchpoints using CPU debug registers' \
/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
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).