Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1213921

Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using overflow interrupts

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using overflow interrupts
Date 2015-08-26 16:40 +0200
Message-ID <q1K1P-8vu-1@gated-at.bofh.it> (permalink)
References <q10V3-1Sr-3@gated-at.bofh.it> <q10V5-1Sr-31@gated-at.bofh.it> <q1ICK-6BL-23@gated-at.bofh.it> <q1IMq-6N8-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/6] ARCv2 port to Linux - (C) perf Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-24 16:30 +0200
  [PATCH v3 6/6] ARCv2: perf: Finally introduce HS perf unit Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-24 16:30 +0200
  [PATCH v3 3/6] ARCv2: perf: Support sampling events using overflow interrupts Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-24 16:30 +0200
    Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using  overflow interrupts Peter Zijlstra <peterz@infradead.org> - 2015-08-26 15:10 +0200
      Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using  overflow interrupts Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-26 15:20 +0200
        Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using  overflow interrupts Peter Zijlstra <peterz@infradead.org> - 2015-08-26 16:40 +0200
          Re: [arc-linux-dev] Re: [PATCH v3 3/6] ARCv2: perf: Support  sampling events using overflow interrupts Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-26 16:50 +0200
    Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using  overflow interrupts Peter Zijlstra <peterz@infradead.org> - 2015-08-26 15:20 +0200
      Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using  overflow interrupts Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-26 15:30 +0200
        Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using  overflow interrupts Peter Zijlstra <peterz@infradead.org> - 2015-08-26 16:40 +0200
          Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using  overflow interrupts Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-26 16:40 +0200
      Re: [PATCH v3 3/6] ARCv2: perf: Support sampling events using  overflow interrupts Peter Zijlstra <peterz@infradead.org> - 2015-08-26 16:30 +0200
  [PATCH v3 5/6] ARCv2: perf: SMP support Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-24 16:30 +0200
  [PATCH v3 2/6] ARCv2: perf: implement "event_set_period" Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-24 16:30 +0200
  Re: [PATCH v3 0/6] ARCv2 port to Linux - (C) perf Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-26 14:10 +0200
    Re: [arc-linux-dev] Re: [PATCH v3 0/6] ARCv2 port to Linux - (C)  perf Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-08-27 09:00 +0200
      Re: [arc-linux-dev] Re: [PATCH v3 0/6] ARCv2 port to Linux - (C)  perf Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2015-08-27 09:20 +0200
        Re: [arc-linux-dev] Re: [PATCH v3 0/6] ARCv2 port to Linux - (C) perf Peter Zijlstra <peterz@infradead.org> - 2015-08-27 11:20 +0200

csiph-web