Re: 2.6.21-rc6-mm1

Stephane Eranian
2007-04-11T13:11:35Z

Andi,

On Wed, Apr 11, 2007 at 12:39:05PM +0200, Andi Kleen wrote:
>
> > The next kernel patch for Perfmon will not make use of the idle notification
> > anymore on any platform.
>
> What do you use instead?
>
Nothing. I was using the idle notifier as a way to stop monitoring on entry and
restart on exit. That way you would only measure useful execution.

But there are issues with this approach. In particular, there are some events that
keep on counting during idle (in halted state). And you want to have those counting,
for instance if this is related to bus or caches. For cycle event, the x86 PMU
has CPU_CLK_UNHALTED, and as its name indicates it does not count during halted state,
the firmware shuts it off.

So if you do nothing, you leave it to the firmware to turn on/off certain counters
based on the event they measure. That is the best option. You cannot have
CPU_CLK_UNHALTED working in halted state.

So my point is that you cannot use the PMU to account for wall-clock time when you
go in halted state. Yet, you could use the idle notifier to compensate for it by
recording let's say TSC prior to entry and computing delta on exit. But then I am
not sure what you would do with it given that other events may or may not have
counted during that time, making scaling harder to do.

Once solution, implemented by Itanium Montecito processor, is to have a PMU event
that counts cycles spent in halted state.

> I've been actually thinking to add idle notifier support to oprofile to correct
> for the "perfctr doesn't tick in idle" issue which makes numbers not add up to 100%.
> A lot of people are currently running idle=poll to work around this and that is very
> wasteful.
>
I agree but I believe that this is the only solution at this point.

--
-Stephane