All of lore.kernel.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 1/7] arm64/perf: Basic uncore counter support for Cavium ThunderX
Date: Mon, 15 Feb 2016 14:46:52 +0000	[thread overview]
Message-ID: <20160215144652.GF9732@leverpostej> (raw)
In-Reply-To: <20160215142726.GD9732@leverpostej>

On Mon, Feb 15, 2016 at 02:27:27PM +0000, Mark Rutland wrote:
> > > > +	uncore = event_to_thunder_uncore(event);
> > > > +	if (!uncore)
> > > > +		return -ENODEV;
> > > > +	if (!uncore->event_valid(event->attr.config))
> > > > +		return -EINVAL;
> > > > +
> > > > +	hwc->config = event->attr.config;
> > > > +	hwc->idx = -1;
> > > > +
> > > > +	/* and we don't care about CPU */
> > > 
> > > Actually, you do. You want the perf core to serialize accesses via the
> > > same CPU, so all events _must_ be targetted at the same CPU. Otherwise
> > > there are a tonne of problems you don't even want to think about.
> > 
> > I found that perf added the events on every CPU in the system. Because
> > the uncore events are not CPU related I wanted to avoid this. Setting
> > cpumask to -1 did not work. Therefore I added a single CPU in the
> > cpumask, see thunder_uncore_attr_show_cpumask().
> 
> I understand that, which is why I wrote:
> 
> > > You _must_ ensure this kernel-side, regardless of what the perf tool
> > > happens to do.
> > > 
> > > See the arm-cci and arm-ccn drivers for an example.
> 
> Take a look at drivers/bus/arm-cci.c; specifically, what we do in
> cci_pmu_event_init and cci_pmu_cpu_notifier.
> 
> This is the same thing that's done for x86 system PMUs. Take a look at
> uncore_pmu_event_init in arch/x86/kernel/cpu/perf_event_intel_uncore.c.

I note that we still have an open TODO rather than a call to
perf_pmu_migrate_context.

The better example is arm_ccn_pmu_cpu_notifier in drivers/bus/arm-ccn.c.

Mark.

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Jan Glauber <jan.glauber@caviumnetworks.com>
Cc: Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 1/7] arm64/perf: Basic uncore counter support for Cavium ThunderX
Date: Mon, 15 Feb 2016 14:46:52 +0000	[thread overview]
Message-ID: <20160215144652.GF9732@leverpostej> (raw)
In-Reply-To: <20160215142726.GD9732@leverpostej>

On Mon, Feb 15, 2016 at 02:27:27PM +0000, Mark Rutland wrote:
> > > > +	uncore = event_to_thunder_uncore(event);
> > > > +	if (!uncore)
> > > > +		return -ENODEV;
> > > > +	if (!uncore->event_valid(event->attr.config))
> > > > +		return -EINVAL;
> > > > +
> > > > +	hwc->config = event->attr.config;
> > > > +	hwc->idx = -1;
> > > > +
> > > > +	/* and we don't care about CPU */
> > > 
> > > Actually, you do. You want the perf core to serialize accesses via the
> > > same CPU, so all events _must_ be targetted at the same CPU. Otherwise
> > > there are a tonne of problems you don't even want to think about.
> > 
> > I found that perf added the events on every CPU in the system. Because
> > the uncore events are not CPU related I wanted to avoid this. Setting
> > cpumask to -1 did not work. Therefore I added a single CPU in the
> > cpumask, see thunder_uncore_attr_show_cpumask().
> 
> I understand that, which is why I wrote:
> 
> > > You _must_ ensure this kernel-side, regardless of what the perf tool
> > > happens to do.
> > > 
> > > See the arm-cci and arm-ccn drivers for an example.
> 
> Take a look at drivers/bus/arm-cci.c; specifically, what we do in
> cci_pmu_event_init and cci_pmu_cpu_notifier.
> 
> This is the same thing that's done for x86 system PMUs. Take a look at
> uncore_pmu_event_init in arch/x86/kernel/cpu/perf_event_intel_uncore.c.

I note that we still have an open TODO rather than a call to
perf_pmu_migrate_context.

The better example is arm_ccn_pmu_cpu_notifier in drivers/bus/arm-ccn.c.

Mark.

  reply	other threads:[~2016-02-15 14:46 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 16:55 [RFC PATCH 0/7] Cavium ThunderX uncore PMU support Jan Glauber
2016-02-12 16:55 ` Jan Glauber
2016-02-12 16:55 ` [RFC PATCH 1/7] arm64/perf: Basic uncore counter support for Cavium ThunderX Jan Glauber
2016-02-12 16:55   ` Jan Glauber
2016-02-12 17:36   ` Mark Rutland
2016-02-12 17:36     ` Mark Rutland
2016-02-13  1:47     ` David Daney
2016-02-13  1:47       ` David Daney
2016-02-15 11:33       ` Mark Rutland
2016-02-15 11:33         ` Mark Rutland
2016-02-15 14:07     ` Jan Glauber
2016-02-15 14:07       ` Jan Glauber
2016-02-15 14:27       ` Mark Rutland
2016-02-15 14:27         ` Mark Rutland
2016-02-15 14:46         ` Mark Rutland [this message]
2016-02-15 14:46           ` Mark Rutland
2016-02-15 15:34         ` Jan Glauber
2016-02-15 15:34           ` Jan Glauber
2016-02-16  8:41     ` Jan Glauber
2016-02-16  8:41       ` Jan Glauber
2016-03-11 10:54     ` Jan Glauber
2016-03-11 10:54       ` Jan Glauber
2016-02-12 16:55 ` [RFC PATCH 2/7] arm64/perf: Cavium ThunderX L2C TAD uncore support Jan Glauber
2016-02-12 16:55   ` Jan Glauber
2016-02-12 16:55 ` [RFC PATCH 3/7] arm64/perf: Cavium ThunderX L2C CBC " Jan Glauber
2016-02-12 16:55   ` Jan Glauber
2016-02-12 16:55 ` [RFC PATCH 4/7] arm64/perf: Cavium ThunderX LMC " Jan Glauber
2016-02-12 16:55   ` Jan Glauber
2016-02-12 16:55 ` [RFC PATCH 5/7] arm64/perf: Cavium ThunderX OCX LNE " Jan Glauber
2016-02-12 16:55   ` Jan Glauber
2016-02-12 16:55 ` [RFC PATCH 6/7] arm64/perf: Cavium ThunderX OCX FRC " Jan Glauber
2016-02-12 16:55   ` Jan Glauber
2016-02-12 16:55 ` [RFC PATCH 7/7] arm64/perf: Cavium ThunderX OCX TLK " Jan Glauber
2016-02-12 16:55   ` Jan Glauber
2016-02-12 17:00 ` [RFC PATCH 0/7] Cavium ThunderX uncore PMU support Mark Rutland
2016-02-12 17:00   ` Mark Rutland

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=20160215144652.GF9732@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.