Re: perf: is PERF_COUNT_SW_CONTEXT_SWITCHES a kernel or user event?

From: Peter Zijlstra
Date: Mon Jun 27 2011 - 06:48:03 EST


On Fri, 2011-06-24 at 17:03 -0400, Vince Weaver wrote:
> Hello
>
> the commit included in 2.6.34:
> perf: Use hot regs with software sched switch/migrate events
> e49a5bd38159dfb1928fd25b173bc9de4bbadb21
>
> Changes the behavior of the PERF_COUNT_SW_CONTEXT_SWITCHES
> counter.
>
> Before 2.6.34 all of the PERF_COUNT_SW_CONTEXT_SWITCHES events were
> counted as happening in userspace (they show up in "perf stat -e cs:u")
> but after the commit they always happen in kernelspace ("perf stat -e
> cs:k").
>
> Was this intended behavior?
> I'm writing a validation test for this and want to make sure I get it
> right.
>
> This can be confusing if your tool defaults to userspace only counts (PAPI
> does this).

hurm, difficult case, like the changelog explains the previous behaviour
wasn't ideal either. Seems like we want somewhat of a middle ground
there, but I'm not quite sure how to make that happen.

Let me ponder things for a bit.
--
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/