[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170519094247.GD18286@arm.com>
Date: Fri, 19 May 2017 10:42:48 +0100
From: Will Deacon <will.deacon@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Jin Yao <yao.jin@...ux.intel.com>, acme@...nel.org,
jolsa@...nel.org, mingo@...hat.com,
alexander.shishkin@...ux.intel.com, Linux-kernel@...r.kernel.org,
ak@...ux.intel.com, kan.liang@...el.com, yao.jin@...el.com,
Mark Rutland <mark.rutland@....com>
Subject: Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is
specified
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
Powered by blists - more mailing lists