From: Alan Stern <stern@rowland.harvard.edu>
To: Roland McGrath <roland@redhat.com>
Cc: 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, 7 Feb 2007 14:22:13 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.44L0.0702071356580.4502-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <20070207025008.1B11118005D@magilla.sf.frob.com>
On Tue, 6 Feb 2007, Roland McGrath wrote:
> > So for the sake of argument, let's assume that debug registers can be
> > assigned with priority values ranging from 0 to 7 (overkill, but who
> > cares?). By fiat, ptrace assignments use priority 4. Then kwatch callers
> > can request whatever priority they like. The well-behaved cases you've
> > been discussing will use priority 0, and the invasive cases can use
> > priority 7. (With appropriate symbolic names instead of raw numeric
> > values, naturally.)
>
> Sure. Or make it signed with lower value wins, have ptrace use -1 and the
> average bear use 0 or something especially unobtrusive use >0, and
> something very obtrusive use -many.
I wonder where this convention of using lower numbers to indicate higher
priorities comes from... It seems to be quite prevalent even though it's
obviously backwards.
> Unless you are really going to pack it
> into a few bits somewhere, I'd make it an arbitrary int rather than a
> special small range; it's just for sort order comparison. Bottom line, I
> don't really care about the numerology. Just so "break ptrace", "don't
> break ptrace", and "readily get out of the way on demand" can be expressed.
> We can always fine-tune it later as there are more concrete users.
Okay; I'm not fixated on any particular size.
> > Or maybe that's too complicated. Perhaps all userspace assignments should
> > always use the same priority level.
>
> No, I want priorities among user-mode watchpoint users too. ptrace is
> rigid, but newer facilities can coexist with ptrace on the same thread and
> with kwatch, and do fancy new things to fall back when there is debugreg
> allocation pressure. Future user facilities might be able to do VM tricks
> that are harder to make workable for kernel mode, for example.
All right. However this means thread_struct will have to grow in order to
hold each task's debug-register allocations and priorities. Would that be
acceptable? (This might be a good reason to keep the number of bits
down.)
Another question: How can a program using the ptrace API ever give up a
debug-register allocation? Disabling the register isn't sufficient; a
user program should be able to store a watchpoint address in dr1, enable
it in dr7, disable it in dr7, and then re-enable it in the expectation
that the address stored in dr1 hasn't been overwritten. As far as I can
see, ptrace-type allocations have to be permanent (until the task exits or
execs, or uses some other to-be-determined API to do the de-allocation.)
Alan Stern
next parent reply other threads:[~2007-02-07 19:22 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070207025008.1B11118005D@magilla.sf.frob.com>
2007-02-07 19:22 ` Alan Stern [this message]
2007-02-07 22:08 ` [PATCH] Kwatch: kernel watchpoints using CPU debug registers 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
2007-03-02 17:19 ` [RFC] hwbkpt: Hardware breakpoints (was Kwatch) Alan Stern
2007-03-05 7:01 ` Roland McGrath
2007-03-05 13:36 ` Christoph Hellwig
2007-03-05 16:16 ` Alan Stern
2007-03-05 16:49 ` Christoph Hellwig
2007-03-05 22:04 ` Roland McGrath
2007-03-05 17:25 ` Alan Stern
2007-03-06 3:13 ` Roland McGrath
2007-03-06 15:23 ` Alan Stern
2007-03-07 3:49 ` Roland McGrath
2007-03-07 19:11 ` Alan Stern
2007-03-09 6:52 ` Roland McGrath
2007-03-09 18:40 ` Alan Stern
2007-03-13 8:00 ` Roland McGrath
2007-03-13 13:07 ` Alan Cox
2007-03-13 18:56 ` Alan Stern
2007-03-14 3:00 ` Roland McGrath
2007-03-14 19:11 ` Alan Stern
2007-03-28 21:39 ` Roland McGrath
2007-03-29 21:35 ` Alan Stern
2007-04-13 21:09 ` Alan Stern
2007-05-11 15:25 ` Alan Stern
2007-05-13 10:39 ` Roland McGrath
2007-05-14 15:42 ` Alan Stern
2007-05-14 21:25 ` Roland McGrath
2007-05-16 19:03 ` Alan Stern
2007-05-23 8:47 ` Roland McGrath
2007-06-01 19:39 ` Alan Stern
2007-06-14 6:48 ` Roland McGrath
2007-06-19 20:35 ` Alan Stern
2007-06-25 10:52 ` Roland McGrath
2007-06-25 15:36 ` Alan Stern
2007-06-26 20:49 ` Roland McGrath
2007-06-27 3:26 ` Alan Stern
2007-06-27 21:04 ` Roland McGrath
2007-06-29 3:00 ` Alan Stern
2007-07-11 6:59 ` Roland McGrath
2007-06-28 3:02 ` Roland McGrath
2007-06-25 11:32 ` Roland McGrath
2007-06-25 15:37 ` Alan Stern
2007-06-25 20:51 ` Alan Stern
2007-06-26 18:17 ` Roland McGrath
2007-06-27 2:43 ` Alan Stern
2007-05-17 20:39 ` Alan Stern
2007-03-16 21:07 ` Alan Stern
2007-03-22 19:44 ` Alan Stern
[not found] <20070206042153.66AB418005D@magilla.sf.frob.com>
2007-02-06 19:58 ` [PATCH] Kwatch: kernel watchpoints using CPU debug registers Alan Stern
2007-02-07 2:56 ` Roland McGrath
2007-01-16 16:55 Alan Stern
2007-01-16 23:35 ` Christoph Hellwig
2007-01-17 16:33 ` Alan Stern
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-02-06 4:25 ` 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.0702071356580.4502-100000@iolanthe.rowland.org \
--to=stern@rowland.harvard.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=prasanna@in.ibm.com \
--cc=roland@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).