Re: [perf] enable raw OFFCORE_EVENTS for non-perf userspace

From: Vince Weaver
Date: Mon Nov 07 2011 - 13:30:24 EST


On Thu, 4 Aug 2011, Peter Zijlstra wrote:

> On Wed, 2011-08-03 at 12:05 -0400, Vince Weaver wrote:
> > Hello
> >
> > I propose we just enable raw OFFCORE_EVENT support and get it over with.
> >
> > There is a lot of demand for this from PAPI users, and so we encourage
> > them to apply the below patch. PAPI supports this out of the box.
> >
> > The current "block" against using this feature *DOES NOT WORK*.
> > It silently fails if you try to use the config1 field to set it.
> >
> > Even worse, if some previous user has set the OFFCORE_RSP_0 msr
> > (say by running "perf stat -e LLC-load-misses") then
> > the msr *stays set* and if you try to set the config1 field on your own
> > it looks like it worked, but instead it is using whatever value the
> > kernel last used.
> >
> > So there's a lot of userspace confusion about this, and you can't even
> > reliably tell if the feature is turned off or not because it fails
> > silently in unpredictable ways.

Is there any hope for either the patch that enables raw offcore_response,
or the other patch that properly disables it?

Currently as mentioned the OFFCORE_RSP_0 msr value is leaked if a
generalized event is using offcore response, thus it is not possible to
properly detect availability of raw offcore response.

Since this MSR leakage has been in at least two released kernels now, it's
tempting to assume it's the published ABI and start hacking up PAPI so
it can use it as a backdoor to enable RAW offcore response without needing
the kernel patches.

Vince

--
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/