Re: [PATCH] perfcounters: Make s/w counters in a group only countwhen group is on

From: Peter Zijlstra
Date: Fri Mar 13 2009 - 06:24:26 EST


On Fri, 2009-03-13 at 12:59 +1100, Paul Mackerras wrote:
> Impact: bug fix
>
> If one has a group that has one or more hardware counters in it and also
> a software counter, the software counter should count only when the
> hardware counters are on the PMU. At present, the software counters
> count all the time, even when the hardware counters can't go on the PMU.
>
> Fundamentally, the problem is that currently we are using sched-out for
> two distinct things: one is "take the counters off because this task
> is being taken off the CPU" and the other is "take the counters off
> because this group can't go on, or because we're changing things around".

> In the first case we need the software counters to keep counting, and in
> the second case we need them to stop, but currently we use sched_out
> functions for both.

I'm not getting it.

The latter case first -- we seem to agree on that:

In group_sched_in() we first call hw_perf_group_sched_in(), which can
validate if the group is at all schedulable.

Then we simply iterate the group counter list and add each counter, if
one, for whatever reason, fails, we simply remove all counters of that
group we scheduled in.

So we either schedule a full group or non of them.


The former case however, you seem to say we should keep software
counters active even though their associated task is scheduled out? That
doesn't appear to make sense to me.

Why would you want to do that?


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