All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: kan.liang@linux.intel.com
Cc: mingo@redhat.com, bp@alien8.de, tglx@linutronix.de,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	qiuxu.zhuo@intel.com, tony.luck@intel.com, rui.zhang@intel.com
Subject: Re: [PATCH 2/3] perf/x86/intel: Add more Icelake CPUIDs
Date: Mon, 3 Jun 2019 17:47:50 +0200	[thread overview]
Message-ID: <20190603154750.GA3402@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190603134122.13853-2-kan.liang@linux.intel.com>

On Mon, Jun 03, 2019 at 06:41:21AM -0700, kan.liang@linux.intel.com wrote:
> @@ -4962,7 +4965,9 @@ __init int intel_pmu_init(void)
>  		x86_pmu.cpu_events = get_icl_events_attrs();
>  		x86_pmu.rtm_abort_event = X86_CONFIG(.event=0xca, .umask=0x02);
>  		x86_pmu.lbr_pt_coexist = true;
> -		intel_pmu_pebs_data_source_skl(false);
> +		intel_pmu_pebs_data_source_skl(
> +			(boot_cpu_data.x86_model == INTEL_FAM6_ICELAKE_X) ||
> +			(boot_cpu_data.x86_model == INTEL_FAM6_ICELAKE_XEON_D));

That's pretty sad, a model switch inside a model switch :/

>  		pr_cont("Icelake events, ");
>  		name = "icelake";
>  		break;

Would something like so not be nicer?

---
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -4485,6 +4485,7 @@ __init int intel_pmu_init(void)
 	struct event_constraint *c;
 	unsigned int unused;
 	struct extra_reg *er;
+	bool pmem = false;
 	int version, i;
 	char *name;
 
@@ -4936,9 +4937,10 @@ __init int intel_pmu_init(void)
 		name = "knights-landing";
 		break;
 
+	case INTEL_FAM6_SKYLAKE_X:
+		pmem = true;
 	case INTEL_FAM6_SKYLAKE_MOBILE:
 	case INTEL_FAM6_SKYLAKE_DESKTOP:
-	case INTEL_FAM6_SKYLAKE_X:
 	case INTEL_FAM6_KABYLAKE_MOBILE:
 	case INTEL_FAM6_KABYLAKE_DESKTOP:
 		x86_add_quirk(intel_pebs_isolation_quirk);
@@ -4970,8 +4972,7 @@ __init int intel_pmu_init(void)
 		td_attr  = hsw_events_attrs;
 		mem_attr = hsw_mem_events_attrs;
 		tsx_attr = hsw_tsx_events_attrs;
-		intel_pmu_pebs_data_source_skl(
-			boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X);
+		intel_pmu_pebs_data_source_skl(pmem);
 
 		if (boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)) {
 			x86_pmu.flags |= PMU_FL_TFA;
@@ -4985,7 +4986,11 @@ __init int intel_pmu_init(void)
 		name = "skylake";
 		break;
 
+	case INTEL_FAM6_ICELAKE_X:
+	case INTEL_FAM6_ICELAKE_XEON_D:
+		pmem = true;
 	case INTEL_FAM6_ICELAKE_MOBILE:
+	case INTEL_FAM6_ICELAKE_DESKTOP:
 		x86_pmu.late_ack = true;
 		memcpy(hw_cache_event_ids, skl_hw_cache_event_ids, sizeof(hw_cache_event_ids));
 		memcpy(hw_cache_extra_regs, skl_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
@@ -5009,7 +5014,7 @@ __init int intel_pmu_init(void)
 		tsx_attr = icl_tsx_events_attrs;
 		x86_pmu.rtm_abort_event = X86_CONFIG(.event=0xca, .umask=0x02);
 		x86_pmu.lbr_pt_coexist = true;
-		intel_pmu_pebs_data_source_skl(false);
+		intel_pmu_pebs_data_source_skl(pmem);
 		pr_cont("Icelake events, ");
 		name = "icelake";
 		break;

  reply	other threads:[~2019-06-03 15:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 13:41 [PATCH 1/3] x86/CPU: Add more Icelake model number kan.liang
2019-06-03 13:41 ` [PATCH 2/3] perf/x86/intel: Add more Icelake CPUIDs kan.liang
2019-06-03 15:47   ` Peter Zijlstra [this message]
2019-06-03 16:14     ` Liang, Kan
2019-06-03 16:30       ` Peter Zijlstra
2019-06-17 14:35   ` [tip:perf/core] " tip-bot for Kan Liang
2019-06-03 13:41 ` [PATCH 3/3] perf/x86/intel: Add Icelake desktop CPUID kan.liang
2019-06-17 14:34   ` [tip:perf/core] " tip-bot for Kan Liang
2019-06-06  6:35 ` [PATCH 1/3] x86/CPU: Add more Icelake model number Borislav Petkov
2019-06-06  7:13   ` Zhuo, Qiuxu
2019-06-06  7:33     ` Borislav Petkov
2019-06-06  8:44       ` Zhuo, Qiuxu
2019-06-06  7:52 ` [tip:x86/urgent] x86/CPU: Add more Icelake model numbers tip-bot for Kan Liang

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=20190603154750.GA3402@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=qiuxu.zhuo@intel.com \
    --cc=rui.zhang@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.