[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140728033429.GI18735@two.firstfloor.org>
Date: Mon, 28 Jul 2014 05:34:29 +0200
From: Andi Kleen <andi@...stfloor.org>
To: "Yan, Zheng" <zheng.z.yan@...el.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Andi Kleen <andi@...stfloor.org>, linux-kernel@...r.kernel.org,
mingo@...nel.org, acme@...radead.org, eranian@...gle.com
Subject: Re: [PATCH v3 6/9] perf, x86: handle multiple records in PEBS
buffer
> how about following patch
Looks good to me.
This will also solve the existing problem that perf record -e cycles:u
... gives kernel samples too.
-Andi
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
> index 33b4c0e..ea76507 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
> @@ -1016,6 +1016,16 @@ static void setup_pebs_sample_data(struct perf_event *event,
> data->br_stack = &cpuc->lbr_stack;
> }
>
> +static inline bool intel_pmu_pebs_filter(struct perf_event *event,
> + struct pebs_record_nhm *record)
> +{
> + if (event->attr.exclude_user && !kernel_ip(record->ip))
> + return true;
> + if (event->attr.exclude_kernel && kernel_ip(record->ip))
> + return true;
> + return false;
> +}
> +
> static void __intel_pmu_pebs_event(struct perf_event *event,
> struct pt_regs *iregs,
> void *at, void *top, int count)
> @@ -1052,6 +1062,8 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
> struct pebs_record_nhm *p = at;
> if (!(p->status & (1 << event->hw.idx)))
> continue;
> + if (intel_pmu_pebs_filter(event, p))
> + continue;
>
> setup_pebs_sample_data(event, iregs, at, &data, ®s);
> perf_output_sample(&handle, &header, &data, event);
> @@ -1139,6 +1151,8 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
> WARN_ON_ONCE(!event);
> if (!event->attr.precise_ip)
> continue;
> + if (intel_pmu_pebs_filter(event, p))
> + continue;
> counts[bit]++;
> }
> }
> @@ -1149,7 +1163,8 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
> event = cpuc->events[bit];
> for (at = base; at < top; at += x86_pmu.pebs_record_size) {
> struct pebs_record_nhm *p = at;
> - if (p->status & (1 << bit))
> + if ((p->status & (1 << bit)) &&
> + !intel_pmu_pebs_filter(event, p))
> break;
> }
>
> ---
>
--
ak@...ux.intel.com -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists