public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Jin Yao <yao.jin@linux.intel.com>,
	acme@kernel.org, jolsa@kernel.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org,
	ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is specified
Date: Fri, 19 May 2017 10:42:48 +0100	[thread overview]
Message-ID: <20170519094247.GD18286@arm.com> (raw)
In-Reply-To: <20170519092905.yivnfjyhblm5wiap@hirez.programming.kicks-ass.net>

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

  reply	other threads:[~2017-05-19  9:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19 10:19 [PATCH] perf/x86/intel: Drop kernel samples even though :u is specified Jin Yao
2017-05-19  9:29 ` Peter Zijlstra
2017-05-19  9:42   ` Will Deacon [this message]
2017-05-19 12:06   ` Jin, Yao
2017-05-19 12:10     ` Peter Zijlstra
2017-05-19 12:24       ` Jin, Yao
2017-05-19 12:36         ` Peter Zijlstra
2017-05-19 13:33           ` Jin, Yao
2017-05-22  2:12             ` Jin, Yao
2017-05-22  8:45               ` Mark Rutland
2017-05-22  9:26                 ` Peter Zijlstra
2017-05-22 12:30                   ` Jin, Yao

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=20170519094247.GD18286@arm.com \
    --to=will.deacon@arm.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.intel.com \
    /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