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


Groups > linux.kernel > #1542169

Re: [RFC] perf/x86/intel: Account interrupts for PEBS errors

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [RFC] perf/x86/intel: Account interrupts for PEBS errors
Date 2016-12-14 21:10 +0100
Message-ID <sOo2d-3tg-3@gated-at.bofh.it> (permalink)
References <sOl4w-mI-21@gated-at.bofh.it> <sOmjL-1GK-9@gated-at.bofh.it> <sOmjL-1GK-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Dec 14, 2016 at 07:16:36PM +0100, Jiri Olsa wrote:

> > > +++ b/arch/x86/events/intel/ds.c
> > > @@ -1389,9 +1389,13 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
> > >  			continue;
> > >  
> > >  		/* log dropped samples number */
> > > -		if (error[bit])
> > > +		if (error[bit]) {
> > >  			perf_log_lost_samples(event, error[bit]);
> > >  
> > > +			if (perf_event_account_interrupt(event, 1))
> > 
> > Seems a bit daft to expose the .throttle argument, since that would be
> > the only point of calling this.
> 
> there's also the other caller from __perf_event_overflow

See the below patchlet ;-)

> > > +static int __perf_event_overflow(struct perf_event *event,
> > > +				   int throttle, struct perf_sample_data *data,
> > > +				   struct pt_regs *regs)
> > > +{
> > > +	int events = atomic_read(&event->event_limit);
> > > +	struct hw_perf_event *hwc = &event->hw;
> > > +	int ret = 0;
> > > +
> > > +	/*
> > > +	 * Non-sampling counters might still use the PMI to fold short
> > > +	 * hardware counters, ignore those.
> > > +	 */
> > > +	if (unlikely(!is_sampling_event(event)))
> > > +		return 0;
> > > +
> > > +	ret = perf_event_account_interrupt(event, throttle);
> > > +
> > >  	if (event->attr.freq) {
> > >  		u64 now = perf_clock();
> > >  		s64 delta = now - hwc->freq_time_stamp;
> > 
> > Arguably, everything in __perf_event_overflow() except for calling of
> > ->overflow_handler() should be done I think.
> 
> well, I was wondering about that period adjustment bit
> 
> but I wasn't sure about those pending_kill/pending_wakeup bits,
> they make sense to me only if we have some data to deliver

Hmm, maybe. Please add a comment, that way we can at least rediscover we
thought about this.


--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -1392,7 +1392,7 @@ static void intel_pmu_drain_pebs_nhm(str
 		if (error[bit]) {
 			perf_log_lost_samples(event, error[bit]);
 
-			if (perf_event_account_interrupt(event, 1))
+			if (perf_event_account_interrupt(event))
 				x86_pmu_stop(event, 0);
 		}
 
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1259,7 +1259,7 @@ extern void perf_event_disable(struct pe
 extern void perf_event_disable_local(struct perf_event *event);
 extern void perf_event_disable_inatomic(struct perf_event *event);
 extern void perf_event_task_tick(void);
-extern int perf_event_account_interrupt(struct perf_event *event, int throttle);
+extern int perf_event_account_interrupt(struct perf_event *event);
 #else /* !CONFIG_PERF_EVENTS: */
 static inline void *
 perf_aux_output_begin(struct perf_output_handle *handle,
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7034,7 +7034,7 @@ static void perf_log_itrace_start(struct
 	perf_output_end(&handle);
 }
 
-int perf_event_account_interrupt(struct perf_event *event, int throttle)
+static int __perf_event_account_interrupt(struct perf_event *event, int throttle)
 {
 	struct hw_perf_event *hwc = &event->hw;
 	int ret = 0;
@@ -7059,6 +7059,11 @@ int perf_event_account_interrupt(struct
 	return ret;
 }
 
+int perf_event_account_interrupt(struct perf_event *event)
+{
+	return __perf_event_account_interrupt(event, 1);
+}
+
 /*
  * Generic event overflow handling, sampling.
  */
@@ -7078,7 +7083,7 @@ static int __perf_event_overflow(struct
 	if (unlikely(!is_sampling_event(event)))
 		return 0;
 
-	ret = perf_event_account_interrupt(event, throttle);
+	ret = __perf_event_account_interrupt(event, throttle);
 
 	if (event->attr.freq) {
 		u64 now = perf_clock();

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


Thread

[RFC] perf/x86/intel: Account interrupts for PEBS errors Jiri Olsa <jolsa@redhat.com> - 2016-12-14 18:00 +0100
  Re: [RFC] perf/x86/intel: Account interrupts for PEBS errors Jiri Olsa <jolsa@redhat.com> - 2016-12-14 19:20 +0100
    Re: [RFC] perf/x86/intel: Account interrupts for PEBS errors Peter Zijlstra <peterz@infradead.org> - 2016-12-14 21:10 +0100
      Re: [RFC] perf/x86/intel: Account interrupts for PEBS errors Jiri Olsa <jolsa@redhat.com> - 2016-12-15 08:20 +0100
      [PATCHv2] perf/x86/intel: Account interrupts for PEBS errors Jiri Olsa <jolsa@redhat.com> - 2016-12-15 16:50 +0100
        Re: [PATCHv2] perf/x86/intel: Account interrupts for PEBS errors kbuild test robot <lkp@intel.com> - 2016-12-16 00:50 +0100
          [PATCHv3] perf/x86/intel: Account interrupts for PEBS errors Jiri Olsa <jolsa@redhat.com> - 2016-12-16 09:10 +0100
        Re: [PATCHv2] perf/x86/intel: Account interrupts for PEBS errors Vince Weaver <vince@deater.net> - 2016-12-16 02:50 +0100
  Re: [RFC] perf/x86/intel: Account interrupts for PEBS errors Peter Zijlstra <peterz@infradead.org> - 2016-12-14 19:40 +0100

csiph-web