public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Kan Liang <kan.liang@intel.com>
Cc: "acme@kernel.org" <acme@kernel.org>,
	"a.p.zijlstra@chello.nl" <a.p.zijlstra@chello.nl>,
	"eranian@google.com" <eranian@google.com>,
	"andi@firstfloor.org" <andi@firstfloor.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups
Date: Thu, 16 Apr 2015 17:31:41 +0100	[thread overview]
Message-ID: <20150416163140.GA19775@leverpostej> (raw)
In-Reply-To: <1429084576-1078-1-git-send-email-kan.liang@intel.com>

Hi,

If you're going to fundamentally change the behaviour of
perf_invalid_context, please Cc authors of other system PMU drivers.
Intel aren't the only ones with such PMUs.

For instance, this affects the ARM CCI and CCN PMU drivers.

On Wed, Apr 15, 2015 at 08:56:11AM +0100, Kan Liang wrote:
> From: Kan Liang <kan.liang@intel.com>
> 
> The pmu marked as perf_invalid_context don't have any state to switch on
> context switch. Everything is global. So it is OK to be part of sw/hw
> groups.
> In sched_out/sched_in, del/add must be called, so the
> perf_invalid_context event can be disabled/enabled accordingly during
> context switch. The event count only be read when the event is already
> sched_in.
> 
> However group read doesn't work with mix events.
> 
> For example,
> perf record -e '{cycles,uncore_imc_0/cas_count_read/}:S' -a sleep 1
> It always gets EINVAL.

>From my PoV that makes sense. One is CPU-affine, the other is not, and
the two cannot be scheduled in the same PMU transaction by the nature of
the hardware. Fundamentally, you cannot provide group semantics due to
this.

Even if you ignore the fundamental semantics of groups, there are other
problems with allowing shared contexts:

* The *_txn functions only get called on the group leader's PMU. If your
  system PMU has these functions, they are not called.

* Event rotation is per ctx, but now you could have some events in a CPU
  PMU's context, and some in the uncore PMU's context. So those can race
  with each other.

* Throttling is also per-context. So those can race with each other too.

> This patch set intends to fix this issue.
> perf record -e '{cycles,uncore_imc_0/cas_count_read/}:S' -a sleep 1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.202 MB perf.data (12 samples) ]

You can already count the events concurrently without grouping them, and
the above implies that this patch just ends up misleading the user
w.r.t. group semantics.

If you want to be able to sample the events with a single read, then you
can attach the FDs.

I don't see that this solves a real problem. I see that it introduces a
new set of problems in addition to complicating existing code.

Mark.

  parent reply	other threads:[~2015-04-16 16:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-15  7:56 [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups Kan Liang
2015-04-15  7:56 ` [PATCH V2 2/6] perf evsel: Set evsel->cpus to the evlist->cpus when not constrained Kan Liang
2015-04-15  7:56 ` [PATCH V2 3/6] perf,tools: get real cpu id for print_aggr Kan Liang
2015-04-15  7:56 ` [PATCH V2 4/6] perf,tools: check and re-organize evsel cpu maps Kan Liang
2015-04-16 16:33   ` Mark Rutland
2015-04-15  7:56 ` [PATCH V2 5/6] perf,tools: open/mmap event uses event's cpu map Kan Liang
2015-04-15  7:56 ` [PATCH V2 6/6] perf/x86/intel/uncore: do not implicitly set uncore event cpu Kan Liang
2015-04-16 16:36   ` Mark Rutland
2015-04-15 16:15 ` [PATCH V2 1/6] perf,core: allow invalid context events to be part of sw/hw groups Peter Zijlstra
2015-04-15 16:21   ` Andi Kleen
2015-04-15 16:55     ` Peter Zijlstra
2015-04-15 17:28 ` Peter Zijlstra
2015-04-16 14:53   ` Liang, Kan
2015-04-16 16:31 ` Mark Rutland [this message]
2015-04-16 16:43   ` Mark Rutland
2015-04-16 17:16   ` Mark Rutland
2015-04-16 21:23   ` Andi Kleen
2015-04-17  9:47     ` Mark Rutland
2015-04-18  0:47       ` Andi Kleen
2015-04-20 10:15         ` Mark Rutland
2015-04-20 16:57           ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150416163140.GA19775@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=eranian@google.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox