public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Question about Perf's handling of in-use performance counters
       [not found]               ` <BN3PR0501MB145957823C655728020392F3A3AD0@BN3PR0501MB1459.namprd05.prod.outlook.com>
@ 2016-11-30 15:44                 ` Taylor Andrews
  2016-11-30 18:17                   ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Taylor Andrews @ 2016-11-30 15:44 UTC (permalink / raw)
  To: Andi Kleen, Peter Zijlstra
  Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alok Kataria

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@vger.kernel.org
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@firstfloor.org>
Sent: Friday, October 28, 2016 12:33 PM
To: Peter Zijlstra
Cc: Andi Kleen; Taylor Andrews; linux-perf-users@vger.kernel.org
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question about Perf's handling of in-use performance counters
  2016-11-30 15:44                 ` Question about Perf's handling of in-use performance counters Taylor Andrews
@ 2016-11-30 18:17                   ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2016-11-30 18:17 UTC (permalink / raw)
  To: Taylor Andrews
  Cc: Andi Kleen, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org, Alok Kataria, Ingo Molnar

On Wed, Nov 30, 2016 at 03:44:57PM +0000, Taylor Andrews wrote:

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

The protocol does a RDMSR to see if the counter is configured or not, if
not, then it can proceed with the WRMSR.

Since these are two separate instructions, there is nothing that
prevents a vCPU preemption or SMI to come in between and invalidate the
state we just read.

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

The BIOS's job is to boot the system and then stay the heck away.
Runtime services are not what its for.

Now I know some hardware vendors like to (ab)use SMM for
fail^Wfeature-add, and that is exactly the kind of crap we don't need.
BIOS monkeys always get it wrong and BIOS code is _never_ updated, so
then you're stuck with wreckage.

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

See the thread here:

  https://lkml.org/lkml/2011/3/24/608

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-30 18:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <BN3PR0501MB14590BFC82C2B45B81E56C1BA3D40@BN3PR0501MB1459.namprd05.prod.outlook.com>
     [not found] ` <87r371k6gj.fsf@tassilo.jf.intel.com>
     [not found]   ` <20161027210012.GN3102@twins.programming.kicks-ass.net>
     [not found]     ` <20161028135325.GB26852@two.firstfloor.org>
     [not found]       ` <20161028140354.GH3142@twins.programming.kicks-ass.net>
     [not found]         ` <20161028154012.GC26852@two.firstfloor.org>
     [not found]           ` <20161028162844.GJ3142@twins.programming.kicks-ass.net>
     [not found]             ` <20161028163305.GD26852@two.firstfloor.org>
     [not found]               ` <BN3PR0501MB145957823C655728020392F3A3AD0@BN3PR0501MB1459.namprd05.prod.outlook.com>
2016-11-30 15:44                 ` Question about Perf's handling of in-use performance counters Taylor Andrews
2016-11-30 18:17                   ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox