Re: [RFC 4/5] x86, perf: implements lwp-perf-integration (rc1)

From: Ingo Molnar
Date: Tue Dec 20 2011 - 03:58:25 EST



* Benjamin <bebl@xxxxxxxxxx> wrote:

> LWP is highly limited in its ability's to support more than
> one "LWP-Instance" being active for a thread, IOW it is not
> possible.

That's OK, we can deal with various PMU constraints just fine.

> You can't activate LWP from a threads context and
> simultaneously activate lwp-system-wide-profiling in the way
> you suggested it, Ingo. Either do the first xor do the last,

We have other PMU resources that are exclusive in that sense.

> because you only have one xsave-area/msr/lwpcb that is read by
> the hardware and only one LWP-Buffer that is written by the
> hw.

That's similar to PEBS (which we already support), there's only
one Debug Store per CPU, obviously.

> So, if one thread is running LWP, because he wants to
> (selfmonitoring and stuff [like for what lwp was designed])
> and a su or u would activate this system-wide-monitoring, both
> would frequently interfere with the each other. I don't think
> you want this to be possible at all.

THe LWPCB is designed to allow multiple events, and the LWP
ring-buffer is shared between these events.

If the kernel properly manages the lwpcb then no such
'interference' happens during normal use - both outside and
self-installed events can be activated at once, up to the event
limit - similar to how we handle regular PMU events.

[ This is why the threshold IRQ support i requested is key: it
is needed for the flow of events and for the kernel
event-demultiplexer to work transparently. ]

> Frankly, it was already a pain to get LWP running from
> in-kernel, like it is done now. I would expect a much higher
> pain, if you would want to do this with a transparent buffer,
> that gets passed around each scheduling (and this would
> permanently eliminate the "lightweight" in "LWP").

There's no heavyweight 'passing around' of a buffer needed at
context switch time. The buffer context has to be flipped - part
of the job of context switching.

So no, i don't think any of your objections have any merit.

Thanks,

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/