linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 2/2] x86, perf: Use INST_RETIRED.PREC_DIST for cycles:ppp
Date: Tue, 1 Dec 2015 14:41:51 +0100	[thread overview]
Message-ID: <20151201134151.GN3816@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1448929689-13771-2-git-send-email-andi@firstfloor.org>

On Mon, Nov 30, 2015 at 04:28:09PM -0800, Andi Kleen wrote:
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
> index 9dfbba5..ba41899 100644
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -482,6 +482,9 @@ int x86_pmu_hw_config(struct perf_event *event)
>  			/* Support for IP fixup */
>  			if (x86_pmu.lbr_nr || x86_pmu.intel_cap.pebs_format >= 2)
>  				precise++;
> +
> +			if (x86_pmu.pebs_aliases)
> +				precise++;

This is not accurate, it would allow :ppp for core2 for example, which
does not at all support PREC_DIST events.

Something like so on top?

--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -483,7 +483,7 @@ int x86_pmu_hw_config(struct perf_event
 			if (x86_pmu.lbr_nr || x86_pmu.intel_cap.pebs_format >= 2)
 				precise++;
 
-			if (x86_pmu.pebs_aliases)
+			if (x86_pmu.pebs_prec_dist)
 				precise++;
 		}
 
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -593,7 +593,8 @@ struct x86_pmu {
 			bts_active	:1,
 			pebs		:1,
 			pebs_active	:1,
-			pebs_broken	:1;
+			pebs_broken	:1,
+			pebs_prec_dist	:1;
 	int		pebs_record_size;
 	void		(*drain_pebs)(struct pt_regs *regs);
 	struct event_constraint *pebs_constraints;
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -3470,6 +3470,7 @@ __init int intel_pmu_init(void)
 		x86_pmu.event_constraints = intel_ivb_event_constraints;
 		x86_pmu.pebs_constraints = intel_ivb_pebs_event_constraints;
 		x86_pmu.pebs_aliases = intel_pebs_aliases_ivb;
+		x86_pmu.pebs_prec_dist = true;
 		if (boot_cpu_data.x86_model == 62)
 			x86_pmu.extra_regs = intel_snbep_extra_regs;
 		else
@@ -3503,6 +3504,7 @@ __init int intel_pmu_init(void)
 		x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints;
 		x86_pmu.extra_regs = intel_snbep_extra_regs;
 		x86_pmu.pebs_aliases = intel_pebs_aliases_ivb;
+		x86_pmu.pebs_prec_dist = true;
 		/* all extra regs are per-cpu when HT is on */
 		x86_pmu.flags |= PMU_FL_HAS_RSP_1;
 		x86_pmu.flags |= PMU_FL_NO_HT_SHARING;
@@ -3538,6 +3540,7 @@ __init int intel_pmu_init(void)
 		x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints;
 		x86_pmu.extra_regs = intel_snbep_extra_regs;
 		x86_pmu.pebs_aliases = intel_pebs_aliases_ivb;
+		x86_pmu.pebs_prec_dist = true;
 		/* all extra regs are per-cpu when HT is on */
 		x86_pmu.flags |= PMU_FL_HAS_RSP_1;
 		x86_pmu.flags |= PMU_FL_NO_HT_SHARING;
@@ -3560,6 +3563,7 @@ __init int intel_pmu_init(void)
 		x86_pmu.pebs_constraints = intel_skl_pebs_event_constraints;
 		x86_pmu.extra_regs = intel_skl_extra_regs;
 		x86_pmu.pebs_aliases = intel_pebs_aliases_skl;
+		x86_pmu.pebs_prec_dist = true;
 		/* all extra regs are per-cpu when HT is on */
 		x86_pmu.flags |= PMU_FL_HAS_RSP_1;
 		x86_pmu.flags |= PMU_FL_NO_HT_SHARING;

  reply	other threads:[~2015-12-01 13:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01  0:28 [PATCH 1/2] perf, x86: Use INST_RETIRED.TOTAL_CYCLES_PS for cycles:pp for Skylake Andi Kleen
2015-12-01  0:28 ` [PATCH 2/2] x86, perf: Use INST_RETIRED.PREC_DIST for cycles:ppp Andi Kleen
2015-12-01 13:41   ` Peter Zijlstra [this message]
2015-12-01 14:54     ` Andi Kleen
2015-12-01 14:55       ` Peter Zijlstra
2015-12-04 11:50   ` [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles: ppp tip-bot for Andi Kleen
2015-12-06 13:11     ` Ingo Molnar
2015-12-06 22:06       ` Peter Zijlstra
2015-12-07  6:48         ` Ingo Molnar
2015-12-07 10:26           ` Peter Zijlstra
2015-12-07 14:02           ` Arnaldo Carvalho de Melo
2015-12-07 14:12             ` Peter Zijlstra
2015-12-07 13:51       ` Peter Zijlstra
2015-12-08  5:36         ` Ingo Molnar
2015-12-08  8:50           ` Peter Zijlstra
2015-12-08  8:57             ` Peter Zijlstra
2015-12-08 13:27               ` Peter Zijlstra
2015-12-09  8:29                 ` Ingo Molnar
2016-01-06 18:51   ` tip-bot for Andi Kleen
2015-12-01 13:19 ` [PATCH 1/2] perf, x86: Use INST_RETIRED.TOTAL_CYCLES_PS for cycles:pp for Skylake Peter Zijlstra
2015-12-04 11:50 ` [tip:perf/core] perf/x86: " tip-bot for Andi Kleen
2016-01-06 18:51 ` tip-bot for Andi Kleen

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=20151201134151.GN3816@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /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).