Re: [PATCH] perf/intel: Remove Perfmon-v4 counter_freezing support

From: Peter Zijlstra
Date: Wed Nov 11 2020 - 03:39:26 EST


On Tue, Nov 10, 2020 at 12:52:04PM -0800, Stephane Eranian wrote:

> What is implemented is Freeze-on-Overflow, yet it is described as Freeze-on-PMI.
> That, in itself, is a problem. I agree with you on that point.

Exactly.

> However, there are use cases for both modes.
>
> I can sample on event A and count on B, C and when A overflows, I want
> to snapshot B, C.
> For that I want B, C at the moment of the overflow, not at the moment
> the PMI is delivered. Thus, youd
> would want the Freeze-on-overflow behavior. You can collect in this
> mode with the perf tool,
> IIRC: perf record -e '{cycles,instructions,branches:S}' ....

Right, but we never supported that. Also, in that case the group must
then be fully exlusive so as not to mess with other groups. A better
solution might be an extention to Adaptive PEBS.

> The other usage model is that of the replay-debugger (rr) which you are alluding
> to, which needs precise count of an event including during the skid
> window. For that, you need
> Freeze-on-PMI (delivered). Note that this tool likely only cares about
> user level occurrences of events.

Correct, RR only cares about user-only counting.

> As for counter independence, I am not sure it holds in all cases. If
> the events are setup for user+kernel

This is true; however if it were an actual Freeze-on-PMI we could
actually do u+k independence correctly too.


Anyway, as it stands I think the whole counter_freezing thing is a
trainwreck and it needs to go.