Re: [PATCH/RFC 2/2] perfcounters: add an mmap method to allowuserspace to read hardware counters

From: Paul Mackerras
Date: Tue Mar 17 2009 - 05:24:55 EST


Peter Zijlstra writes:

> Ah, right. I think some of the intel chips can do similar things with
> rdpmc instructions.

Ah OK, I didn't know that. Cool.

> > Ingo has talked about reusing some of the tracing infrastructure for
> > reporting perf_counter events to userspace. That sounds like an
> > excellent idea to me, and that is why I didn't bother with putting the
> > event queue into the mmapped page at this stage. If it makes sense to
> > add it, it can be added later.
>
> Yeah, I've been looking into that, but so far I'm a bit at a loss, all
> that tracing stuff is per-cpu, and that's massive overkill for us, since
> we're dealing with single cpu streams.

I almost certainly know less about the tracing infrastructure than
you. :) Per-cpu buffers does indeed sound like overkill for what we
want - though we might actually want per-cpu buffers if we have
inherited sampling counters and a deep process hierarchy.

> One worry though, supposedly we want to mmap() such buffers too at some
> point, how would that interact with that you proposed?

I think we just have separate pages for the event ring buffer and the
info for reading the counter in userspace, and then there isn't any
interaction. We can do that either by having two fds and mmapping on
each, or by using the file offset argument to mmap.

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