Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280879

Re: [PATCH 2/2] x86, perf: Use INST_RETIRED.PREC_DIST for cycles:ppp

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] x86, perf: Use INST_RETIRED.PREC_DIST for cycles:ppp
Date 2015-12-01 14:50 +0100
Message-ID <qATtD-1Sb-9@gated-at.bofh.it> (permalink)
References <qAGZs-2kK-3@gated-at.bofh.it> <qAGZs-2kK-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] perf, x86: Use INST_RETIRED.TOTAL_CYCLES_PS for cycles:pp for Skylake Andi Kleen <andi@firstfloor.org> - 2015-12-01 01:30 +0100
  [PATCH 2/2] x86, perf: Use INST_RETIRED.PREC_DIST for cycles:ppp Andi Kleen <andi@firstfloor.org> - 2015-12-01 01:30 +0100
    Re: [PATCH 2/2] x86, perf: Use INST_RETIRED.PREC_DIST for cycles:ppp Peter Zijlstra <peterz@infradead.org> - 2015-12-01 14:50 +0100
      Re: [PATCH 2/2] x86, perf: Use INST_RETIRED.PREC_DIST for cycles:ppp Peter Zijlstra <peterz@infradead.org> - 2015-12-01 16:00 +0100
      Re: [PATCH 2/2] x86, perf: Use INST_RETIRED.PREC_DIST for cycles:ppp Andi Kleen <ak@linux.intel.com> - 2015-12-01 16:00 +0100
    [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp tip-bot for Andi Kleen <tipbot@zytor.com> - 2015-12-04 13:00 +0100
      Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Ingo Molnar <mingo@kernel.org> - 2015-12-06 14:20 +0100
        Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Peter Zijlstra <peterz@infradead.org> - 2015-12-06 23:10 +0100
          Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Ingo Molnar <mingo@kernel.org> - 2015-12-07 07:50 +0100
            Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Peter Zijlstra <peterz@infradead.org> - 2015-12-07 11:30 +0100
            Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-07 15:10 +0100
              Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Peter Zijlstra <peterz@infradead.org> - 2015-12-07 15:20 +0100
        Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Peter Zijlstra <peterz@infradead.org> - 2015-12-07 15:00 +0100
          Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Ingo Molnar <mingo@kernel.org> - 2015-12-08 06:40 +0100
            Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Peter Zijlstra <peterz@infradead.org> - 2015-12-08 10:00 +0100
              Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Peter Zijlstra <peterz@infradead.org> - 2015-12-08 14:30 +0100
                Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Ingo Molnar <mingo@kernel.org> - 2015-12-09 09:30 +0100
            Re: [tip:perf/core] perf/x86: Use INST_RETIRED.PREC_DIST for cycles:  ppp Peter Zijlstra <peterz@infradead.org> - 2015-12-08 10:00 +0100
  Re: [PATCH 1/2] perf, x86: Use INST_RETIRED.TOTAL_CYCLES_PS for  cycles:pp for Skylake Peter Zijlstra <peterz@infradead.org> - 2015-12-01 14:20 +0100
  [tip:perf/core] perf/x86:   Use INST_RETIRED.TOTAL_CYCLES_PS for cycles:pp for Skylake tip-bot for Andi Kleen <tipbot@zytor.com> - 2015-12-04 13:00 +0100

csiph-web