Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932616AbdHWS1D (ORCPT ); Wed, 23 Aug 2017 14:27:03 -0400 Received: from merlin.infradead.org ([205.233.59.134]:41670 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932405AbdHWS1C (ORCPT ); Wed, 23 Aug 2017 14:27:02 -0400 Date: Wed, 23 Aug 2017 20:26:48 +0200 From: Peter Zijlstra To: "Liang, Kan" Cc: "mingo@redhat.com" , "linux-kernel@vger.kernel.org" , "acme@kernel.org" , "jolsa@redhat.com" , "tglx@linutronix.de" , "eranian@google.com" , "ak@linux.intel.com" , "mpe@ellerman.id.au" , "maddy@linux.vnet.ibm.com" Subject: Re: [PATCH V6] perf: Add PERF_SAMPLE_PHYS_ADDR Message-ID: <20170823182648.nrzsbbsz2lwupaw4@hirez.programming.kicks-ass.net> References: <1503498166-3887-1-git-send-email-kan.liang@intel.com> <20170823143308.v27pgjagxjyd65ci@hirez.programming.kicks-ass.net> <20170823143959.m6k5xojly3q2tacv@hirez.programming.kicks-ass.net> <37D7C6CF3E00A74B8858931C1DB2F0775378AA5B@SHSMSX103.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37D7C6CF3E00A74B8858931C1DB2F0775378AA5B@SHSMSX103.ccr.corp.intel.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1491 Lines: 37 On Wed, Aug 23, 2017 at 06:01:25PM +0000, Liang, Kan wrote: > For x86, I think we can do something as below. But I'm not sure other architectures. If you'd done: git grep PERF_SAMPLE_ADDR, you'd have found: arch/powerpc/perf/core-book3s.c: if (event->attr.sample_type & PERF_SAMPLE_ADDR) Which suggests something rather similar.. > diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c > index a322fed..9bf29dc 100644 > --- a/arch/x86/events/intel/ds.c > +++ b/arch/x86/events/intel/ds.c > @@ -1175,7 +1175,7 @@ static void setup_pebs_sample_data(struct perf_event *event, > else > regs->flags &= ~PERF_EFLAGS_EXACT; > > - if ((sample_type & PERF_SAMPLE_ADDR) && > + if ((sample_type & (PERF_SAMPLE_ADDR | PERF_SAMPLE_PHYS_ADDR) && > x86_pmu.intel_cap.pebs_format >= 1) > data->addr = pebs->dla; diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 6c2d4168daec..c833fb26f0bb 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -2039,7 +2039,7 @@ static void record_and_restart(struct perf_event *event, unsigned long val, perf_sample_data_init(&data, ~0ULL, event->hw.last_period); - if (event->attr.sample_type & PERF_SAMPLE_ADDR) + if (event->attr.sample_type & (PERF_SAMPLE_ADDR | PERF_SAMPLE_PHYS_ADDR)) perf_get_data_addr(regs, &data.addr); if (event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK) {