Re: [patch 01/11] Introducing generic hardware breakpoint handlerinterfaces

From: Ingo Molnar
Date: Wed Mar 11 2009 - 09:36:24 EST



* K.Prasad <prasad@xxxxxxxxxxxxxxxxxx> wrote:

> For the benefit of continuing discussion on this topic, here's
> an extract from an old mail
> (http://lkml.org/lkml/2007/2/5/465) from Roland, explaining
> the need for prioritisation of requests. It must have been
> utrace as a potential user that made him suggest this.
>
> "I am all in favor of a facility to manage shared use of the
> debug registers, such as your debugreg.h additions. I just
> think it needs to be a little more flexible. An unobtrusive
> kernel facility has to get out of the way when user-mode
> decides to use all its debug registers. It's not immediately
> important what it's going to about it when contention arises,
> but there has to be a way for the user-mode facilities to say
> they need to allocate debugregs with priority and evict other
> squatters. So, something like code allocating a debugreg can
> supply a callback that's made when its allocation has to taken
> by something with higher priority.
>
> Even after utrace, there will always be the possibility of a
> traditional uncoordinated user of the raw debug registers, if
> nothing else ptrace compatibility will always be there for old
> users. So anything new and fancy needs to be prepared to back
> out of the way gracefully. In the case of kwatch, it can just
> have a handler function given by the caller to start with.
> It's OK if individual callers can specially declare "I am not
> well-behaved" and eat debugregs so that well-behaved
> high-priority users like ptrace just have to lose (breaking
> compatibility). But no well-behaved caller of kwatch will do
> that.
>
> I certainly intend for later features based on utrace to
> include higher-level treatment of watchpoints so that user
> debugging facilities can also become responsive to debugreg
> allocation pressure. (Eventually, the user facilities might
> have easier ways of falling back to other methods and getting
> out of the way of kernel debugreg consumers, than can be done
> for the kernel-mode-tracing facilities.) To that end, I'd
> like to see a clear and robust interface for debugreg sharing,
> below the level of kwatch."

This argument ignores the reality of debug registers:
overcommitted usage of them causes silent failures and
unobvious behavior.

I think the simple reservation scheme i outlined in the
previous mail is the minimum amount of complexity that
still gets kernel-space hw-breakpoints going robustly.
If we add anything more fancy we want it based on actual
need and desire.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/