linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>, lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Michael Petlan <mpetlan@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] perf/x86/intel: Export mem events only if there's PEBs support
Date: Tue, 28 Aug 2018 10:12:32 +0200	[thread overview]
Message-ID: <20180828081232.GI24124@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180827090624.GI24695@krava>

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?

  reply	other threads:[~2018-08-28  8:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-13 15:48 [RFC] perf/x86/intel: Export mem events only if there's PEBs support Jiri Olsa
2018-08-13 18:58 ` Andi Kleen
2018-08-27  9:06 ` [PATCH] " Jiri Olsa
2018-08-28  8:12   ` Peter Zijlstra [this message]
2018-08-28  8:19     ` Jiri Olsa
2018-09-06 13:57       ` Jiri Olsa
2018-09-23 16:26         ` Jiri Olsa
2018-10-16 16:03         ` [tip:perf/core] perf/x86/intel: Export mem events only if there's PEBS support tip-bot for Jiri Olsa

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=20180828081232.GI24124@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpetlan@redhat.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;
as well as URLs for NNTP newsgroup(s).