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


Groups > linux.kernel > #1645472

Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is specified

From Will Deacon <will.deacon@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is specified
Date 2017-05-19 11:50 +0200
Message-ID <tIMHM-hj-17@gated-at.bofh.it> (permalink)
References <tIFPY-3RD-9@gated-at.bofh.it> <tIMoq-8v4-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, May 19, 2017 at 11:29:05AM +0200, Peter Zijlstra wrote:
> On Fri, May 19, 2017 at 06:19:12PM +0800, Jin Yao wrote:
> > +bool skid_kernel_samples(struct perf_event *event, struct pt_regs *regs)
> > +{
> > +	u64 ip;
> > +
> > +	/*
> > +	 * Without PEBS, we may get kernel samples even though
> > +	 * exclude_kernel is specified due to skid in sampling.
> > +	 */
> > +	if ((event->attr.exclude_kernel) &&
> > +	    (event->attr.sample_type & PERF_SAMPLE_IP)) {
> > +		ip = perf_instruction_pointer(regs);
> > +		if (kernel_ip(ip))
> > +			return true;
> > +	}
> > +
> > +	return false;
> > +}
> > +
> >  EVENT_ATTR(cpu-cycles,			CPU_CYCLES		);
> >  EVENT_ATTR(instructions,		INSTRUCTIONS		);
> >  EVENT_ATTR(cache-references,		CACHE_REFERENCES	);
> 
> 
> I would much rather see this in generic code, somewhere around
> __perf_event_overflow() I suppose. That would retain proper accounting
> for the interrupt rate etc..
> 
> Also it would work for all architectures. Because I'm thinking more than
> just x86 will suffer from skid.

Yes, I think this will affect arm/arm64 too (and probably others that rely
on irqs for sampling the regs).

Will

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


Thread

[PATCH] perf/x86/intel: Drop kernel samples even though :u is specified Jin Yao <yao.jin@linux.intel.com> - 2017-05-19 04:30 +0200
  Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified Peter Zijlstra <peterz@infradead.org> - 2017-05-19 11:30 +0200
    Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified Will Deacon <will.deacon@arm.com> - 2017-05-19 11:50 +0200
    Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified "Jin, Yao" <yao.jin@linux.intel.com> - 2017-05-19 14:10 +0200
      Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified Peter Zijlstra <peterz@infradead.org> - 2017-05-19 14:20 +0200
        Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified "Jin, Yao" <yao.jin@linux.intel.com> - 2017-05-19 14:30 +0200
          Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified Peter Zijlstra <peterz@infradead.org> - 2017-05-19 14:40 +0200
            Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified "Jin, Yao" <yao.jin@linux.intel.com> - 2017-05-19 15:40 +0200
              Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified "Jin, Yao" <yao.jin@linux.intel.com> - 2017-05-22 04:20 +0200
                Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified Mark Rutland <mark.rutland@arm.com> - 2017-05-22 10:50 +0200
                Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified Peter Zijlstra <peterz@infradead.org> - 2017-05-22 11:30 +0200
                Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is  specified "Jin, Yao" <yao.jin@linux.intel.com> - 2017-05-22 14:40 +0200

csiph-web