From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
To: "arc-linux-dev@synopsys.com" <arc-linux-dev@synopsys.com>
Cc: "linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Vineet.Gupta1@synopsys.com" <Vineet.Gupta1@synopsys.com>,
"arnd@arndb.de" <arnd@arndb.de>,
"acme@kernel.org" <acme@kernel.org>
Subject: Re: [arc-linux-dev] Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using overflow interrupts
Date: Wed, 26 Aug 2015 14:42:51 +0000 [thread overview]
Message-ID: <1440600170.15478.53.camel@synopsys.com> (raw)
In-Reply-To: <20150826143518.GV16853@twins.programming.kicks-ass.net>
Hi Peter,
On Wed, 2015-08-26 at 16:35 +0200, Peter Zijlstra wrote:
> On Wed, Aug 26, 2015 at 01:17:20PM +0000, Alexey Brodkin wrote:
> > Hi Peter,
> >
> > On Wed, 2015-08-26 at 15:07 +0200, Peter Zijlstra wrote:
> > > On Mon, Aug 24, 2015 at 05:20:20PM +0300, Alexey Brodkin wrote:
> > > > @@ -139,9 +141,11 @@ static int arc_pmu_event_init(struct perf_event *event)
> > > > struct hw_perf_event *hwc = &event->hw;
> > > > int ret;
> > > >
> > > > - hwc->sample_period = arc_pmu->max_period;
> > > > - hwc->last_period = hwc->sample_period;
> > > > - local64_set(&hwc->period_left, hwc->sample_period);
> > > > + if (!is_sampling_event(event)) {
> > > > + hwc->sample_period = arc_pmu->max_period;
> > > > + hwc->last_period = hwc->sample_period;
> > > > + local64_set(&hwc->period_left, hwc->sample_period);
> > > > + }
> > >
> > > So here we set a max_period sample period for !sampling events such that
> > > we can properly deal with (short) counter overflow and accumulate into a
> > > 64bit value.
> > >
> > > > switch (event->attr.type) {
> > > > case PERF_TYPE_HARDWARE:
> > > > @@ -243,6 +247,11 @@ static void arc_pmu_start(struct perf_event *event, int flags)
> > > >
> > > > arc_pmu_event_set_period(event);
> > > >
> > > > + /* Enable interrupt for this counter */
> > > > + if (is_sampling_event(event))
> > > > + write_aux_reg(ARC_REG_PCT_INT_CTRL,
> > > > + read_aux_reg(ARC_REG_PCT_INT_CTRL) | (1 << idx));
> > > > +
> > >
> > > Yet here you fail to actually enable the interrupt for the non sampling
> > > events, which makes the above not work.
> >
> > Indeed we intentionally leave interrupts disabled for non-sampling events.
> > [1] We have quite large counters so we don't expect to overflow normally
> > [2] We may re-use the same code for hardware that lacks support of IRQs in PCT.
> > See we check if IRQs are available and if not set PERF_PMU_CAP_NO_INTERRUPT
> > that will guarantee we won't get sampling event and for non-sampling events
> > we won't use IRQs.
>
> Tricky, I was seeing is_isa_arcv2() calls elsewhere, so I figured you'd
> make it conditional on that.
>
> But sure, if you think you can live with 1 this'll work.
Well indeed there's a room for improvement always.
But from our current experience existing implementation works pretty fine.
Moreover having now PCT IRQs we mostly use sampling events that allow doing
real profiling.
-Alexey
next prev parent reply other threads:[~2015-08-26 14:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 14:20 [PATCH v3 0/6] ARCv2 port to Linux - (C) perf Alexey Brodkin
2015-08-24 14:20 ` [PATCH v3 1/6] ARC: perf: cap the number of counters to hardware max of 32 Alexey Brodkin
2015-08-24 14:20 ` [PATCH v3 2/6] ARCv2: perf: implement "event_set_period" Alexey Brodkin
2015-08-24 14:20 ` Alexey Brodkin
2015-08-24 14:20 ` [PATCH v3 3/6] ARCv2: perf: Support sampling events using overflow interrupts Alexey Brodkin
2015-08-24 14:20 ` Alexey Brodkin
2015-08-26 13:07 ` Peter Zijlstra
2015-08-26 13:17 ` Alexey Brodkin
2015-08-26 14:35 ` Peter Zijlstra
2015-08-26 14:42 ` Alexey Brodkin [this message]
2015-08-26 13:12 ` Peter Zijlstra
2015-08-26 13:21 ` Alexey Brodkin
2015-08-26 14:32 ` Peter Zijlstra
2015-08-26 14:35 ` Alexey Brodkin
2015-08-26 14:25 ` Peter Zijlstra
2015-10-19 10:01 ` perf documentation (was Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using overflow interrupts) Vineet Gupta
2015-10-19 10:12 ` Peter Zijlstra
2015-08-24 14:20 ` [PATCH v3 4/6] ARCv2: perf: implement exclusion of event counting in user or kernel mode Alexey Brodkin
2015-08-24 14:20 ` Alexey Brodkin
2015-08-24 14:30 ` Vineet Gupta
2015-08-24 16:38 ` Vineet Gupta
2015-08-24 14:20 ` [PATCH v3 5/6] ARCv2: perf: SMP support Alexey Brodkin
2015-08-24 14:20 ` Alexey Brodkin
2015-08-24 14:20 ` [PATCH v3 6/6] ARCv2: perf: Finally introduce HS perf unit Alexey Brodkin
2015-08-26 12:07 ` [PATCH v3 0/6] ARCv2 port to Linux - (C) perf Alexey Brodkin
2015-08-27 6:58 ` [arc-linux-dev] " Alexey Brodkin
2015-08-27 7:14 ` Vineet Gupta
2015-08-27 9:18 ` Peter Zijlstra
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=1440600170.15478.53.camel@synopsys.com \
--to=alexey.brodkin@synopsys.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=acme@kernel.org \
--cc=arc-linux-dev@synopsys.com \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).