Messages in this thread | | | Date | Sat, 7 Nov 2009 21:03:00 +1100 | From | Paul Mackerras <> | Subject | Re: [PATCH 4/6] hw-breakpoints: Rewrite the hw-breakpoints layer on top of perf events |
| |
Frederic Weisbecker writes:
> On Thu, Nov 05, 2009 at 10:59:44AM +1100, Paul Mackerras wrote: > > What I haven't managed to understand yet is how you provide reliable > > breakpoints for debugging purposes. If I'm debugging a program and I > > have set a breakpoint, I'll be very unhappy if the breakpoint should > > trigger but doesn't because the perf_event infrastructure has decided > > it can't schedule that breakpoint in. If the breakpoint isn't going > > to work then I want to know that at the time that I set it. > > > > That won't happen because of the set of constraints we have. > We never overcommit the debug register resources, except in > the case of non-pinned counter, but that's in their nature :)
Suppose you have 4 breakpoint registers per cpu and there are two pinned per-cpu breakpoint events, three non-pinned per-cpu breakpoint events, and one pinned per-task breakpoint event. I believe your constraints will allow that situation.
What will happen is that the two pinned per-cpu breakpoint events will use two of the hardware registers, and the three non-pinned per-cpu breakpoint events will get round-robined onto the other two hardware registers. The per-task breakpoint will never get to use a hardware register, because the code in perf_event.c schedules per-cpu events before it schedules per-task events (see for example perf_event_task_tick()).
We will have to make the event scheduling in kernel/perf_event.c a bit more sophisticated before we can guarantee that a pinned breakpoint event will always get to use a hardware register.
Paul.
| |