Re: Question about Perf's handling of in-use performance counters

From: Taylor Andrews
Date: Wed Nov 30 2016 - 12:19:23 EST


Hi,

Friendly ping as this discussion seems to have stalled.

For the full discussion please see http://www.spinics.net/lists/linux-perf-users/msg03168.html

Thanks,
Taylor

________________________________________
From: Taylor Andrews
Sent: Friday, October 28, 2016 2:28 PM
To: Andi Kleen; Peter Zijlstra
Cc: linux-perf-users@xxxxxxxxxxxxxxx
Subject: Re: Question about Perf's handling of in-use performance counters

Hi Andi, Peter,

Thanks so much for the responses.

Hi Peter,

> No, it was about the (mis)guide-line having fundamental races and the
> belief that the BIOS has no business what so ever using these resources
> to begin with.

Can you please describe what fundamental races you are talking about?

Why do you believe the BIOS should never be using performance counters?

Even if you discount the BIOS use case (despite Intel considering it legitimate), we still have the scenario of a Hypervisor exposing some virtual performance counters as in-use and unavailable. What was the rationale that the PMU cooperative sharing guidelines outlined by Intel should be intentionally ignored, and that perf should attempt to take over all generic performance counters, regardless of if they are marked in-use?

It should be noted that this design decision degrades the experience of using perf in x86 VMware VMs and has confused perf users. If one or more virtual generic counters are not available, attempted writes to them are dropped by the Hypervisor so as not to corrupt other entities that are using the real PMU hardware. This attempted use of in-use counters results in reported event counts of zero from perf with no errors or warnings that could better inform the user of the real issue - that there is a lack of available PMU resources to complete the requested profiling.

Thanks,
Taylor

________________________________________
From: Andi Kleen <andi@xxxxxxxxxxxxxx>
Sent: Friday, October 28, 2016 12:33 PM
To: Peter Zijlstra
Cc: Andi Kleen; Taylor Andrews; linux-perf-users@xxxxxxxxxxxxxxx
Subject: Re: Question about Perf's handling of in-use performance counters

> But the thing is still racy, and therefore useless.

At least the Hypervisor case is not racy. The Hypervisor always
uses that counter.

-Andi