[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180828081232.GI24124@hirez.programming.kicks-ass.net>
Date: Tue, 28 Aug 2018 10:12:32 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Michael Petlan <mpetlan@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] perf/x86/intel: Export mem events only if there's PEBs
support
On Mon, Aug 27, 2018 at 11:06:24AM +0200, Jiri Olsa wrote:
> +static __init struct attribute **get_hsw_events_attrs(bool *alloc)
> {
> + if (boot_cpu_has(X86_FEATURE_RTM)) {
> + *alloc = true;
> + return merge_attr(hsw_events_attrs, hsw_tsx_events_attrs);
> + }
> + return hsw_events_attrs;
> }
> @@ -4357,6 +4374,15 @@ __init int intel_pmu_init(void)
> WARN_ON(!x86_pmu.format_attrs);
> }
>
> + if (x86_pmu.pebs && mem_attr) {
> + struct attribute **attr = x86_pmu.cpu_events;
> +
> + x86_pmu.cpu_events = merge_attr(x86_pmu.cpu_events, mem_attr);
> +
> + if (alloc_events)
> + kfree(attr);
> + }
> +
> if (x86_pmu.num_counters > INTEL_PMC_MAX_GENERIC) {
> WARN(1, KERN_ERR "hw perf events %d > max(%d), clipping!",
> x86_pmu.num_counters, INTEL_PMC_MAX_GENERIC);
static __init struct attribute **
get_events_attrs(struct attribute **base,
struct attribute **mem,
struct attribute **tsx)
{
struct attribute **attrs = base;
struct attribute **old;
if (mem) {
old = attrs;
attrs = merge_attrs(attrs, mem);
if (old != base)
kfree(old);
}
if (tsx && boot_cpu_has(X86_FEATURE_RTM)) {
old = attrs;
attrs = merge_attrs(attrs, tsx);
if (old != base)
kfree(old);
}
return attrs;
}
Would that not help to concentrate things a little more?
Powered by blists - more mailing lists