Re: [RFC][PATCH 0/6] perf: x86 RDPMC and RDTSC support

From: Vince Weaver
Date: Wed Dec 21 2011 - 10:04:18 EST


On Wed, 21 Dec 2011, Peter Zijlstra wrote:

> On Fri, 2011-12-16 at 17:36 -0500, Vince Weaver wrote:
> > Is it possible to read multiple counters at once with this
> > interface, i.e. using FORMAT_GROUP?
>
> No, that's not something that I had considered, I'll see if I can make
> that happen by making an array inside the control page instead of a
> single version.

well it's not strictly necessary, I was just checking. The perfctr
code just does a loop through all available counters too.

At some point PAPI should just abandon using FORMAT_GROUP as it seems to
be more trouble than its worth. Though if we have fast rdpmc-based
counter reads it becomes a little less necessary.

> > Also, am I correct that the counters are set to always counting, so you
> > always have to do a rdpmc() before and a rdpmc() after?
>
> Depending on how you use it, but yes that's how I'd use it, avoids
> having to do ioctl()s

currently when I tried doing a start ioctl then an immediate read, the
counter values returned were a very high value. So unless I did two
rdpmcs and subtracted, the results made no sense.

was I doing something wrong? I'll have to investigate more.

> > If start/stop are truly unnecessary when run with your patch then the
> > "total" results shift in your favor. Otherwise perfmon2 and perfctr still
> > win the self-monitoring overhead race by a lot.
>
> You can of course also do the start/stop/reset in userspace by keeping
> an offset to the counter, avoiding the ioctl()s and simply keeping the
> counter running.

is this guaranteed to work in the face of context switches and/or
multiplexing?

I need to go back and look at the perfctr code and make sure I understand
the games it does to ensure that the values it reads out are valid.

Thanks,

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/