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) {

Reply via email to