Re: [PATCH] Kwatch: kernel watchpoints using CPU debug registers

From: Roland McGrath
Date: Sat Feb 17 2007 - 22:04:30 EST

> How do you suggest this be handled? Maybe we should just keep track of a
> maximum user priority level for each slot, allowing it to go up but not
> down until all user processes have given up the slot. (I.e., in the
> example above the later kwatch requests would still fail because we would
> continue to remember the high user priority level so long as the first
> process maintained its allocation.) That would be overly pessimistic, but
> it would at least be safe.

I think that is certainly fine to start with. Like I said before, we can
start conservative and then worry about more complexity as the concrete
needs arise. I don't think it will really be any trouble to change some of
these low-level interfaces later to accomodate more sophisticated callers
and implementations.

When the issue does arise, scanning all the necessary tasks may not really
need to be so costly. That is, if rather than scanning all tasks in the
system, it's a list of debugreg allocations. The callers doing fancy
allocation can be responsible for passing in storage for a struct
containing the list structure. That would naturally embed in struct
kwatch. Having the debugreg allocation routines pass in such a structure
would also be useful for another kind of flexibility I'd like to have
eventually. That is, "local" allocations that are local to a group of
tasks rather than just one. For example, a debugger most often actually
wants to share watchpoints among all the threads sharing an address space.
If identical settings are in fact shared, the storage requirements for
using watchpoints in many-threaded processes scale that much better.

I think we have a while before we have to actually figure any of that out
in detail. The simple starting point covers all our immediate concrete


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at