Received: by 10.213.65.68 with SMTP id h4csp507747imn; Sat, 31 Mar 2018 03:23:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ppsuAYIfRdzeHHaGL7VBgDGfOecwHvnFwEwbdaJvmHBLNFTZ70hSpgipL8MvN6m3PDf4q X-Received: by 10.101.96.141 with SMTP id t13mr1605933pgu.222.1522491792569; Sat, 31 Mar 2018 03:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522491792; cv=none; d=google.com; s=arc-20160816; b=cojC6kCs+BHf6KCqr1wulq8L6A4ZmPNIuMYvIPIJXE1zTZskMi6EJEVa2bCfq4QbP9 S+blCdLqBjanvi1PKKtqktsFWIx8paxGPVeLShk40ovzj+Ut5kk0YWsj8sgSOIB5gu34 TjG2OrPw51cFgicMz6nvh0ST2k/NgOl3qXX+zdSLhcl6qGImjxgJd2NkG9AsmOKQCS0e fsyc+jv/hGN7rAAHMhXFPBfhpvdvLA7bsUshJKLXFubpOwAwfBUlRqtRo8bI6IWeTbbq bCZ1Bn4ZYG4XTpVIUEqKkEYiXoGvfgroUSSk6Vt/ByES4zkVrsPpberiA1wz7vvxQm4B cKPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=aLytMWjn8ZQgE4gxBqPywsK6LPJEeSJjnAdlE3gJK3U=; b=hYa49kWAjjz7srMHy3Sm96gQOciig0fGovRGetzlQFPSCRriKeDt/vB00Jsz6RFryd h4jejgH5z/GrS94OnCjBgNld8oCiSDeeNdRAkIoLqaAMUIqbcmTAUIZ8vyCFTlHWiyjN r0FOJFDCLNz9QUKcDaBBkiE7cgsY1vqiofVsqD3lx4VQRTfqcxPr/RcYv+uI9hDHiwnf p3UxhQITcLggK+w1w4aoLhXdqZEP6IrSLKx+rw+p7J6EI8iCIgLvSPVOIhXJQZgBrsIE FVddnM3DpPcYM4UuvQOxwVcS0fcbM/XN1VCepkJIm8JrxgkkatHiCP54S5necXdtQ2FK UuBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3-v6si10371789plb.114.2018.03.31.03.22.58; Sat, 31 Mar 2018 03:23:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753335AbeCaKUE (ORCPT + 99 others); Sat, 31 Mar 2018 06:20:04 -0400 Received: from terminus.zytor.com ([198.137.202.136]:46233 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752885AbeCaKUC (ORCPT ); Sat, 31 Mar 2018 06:20:02 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w2VAJaE92262039; Sat, 31 Mar 2018 03:19:36 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w2VAJap32262036; Sat, 31 Mar 2018 03:19:36 -0700 Date: Sat, 31 Mar 2018 03:19:36 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Harry Pan Message-ID: Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, acme@redhat.com, bleung@chromium.org, peterz@infradead.org, tglx@linutronix.de, mingo@kernel.org, puthik@chromium.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, eranian@google.com, vincent.weaver@maine.edu, harry.pan@intel.com, hpa@zytor.com Reply-To: vincent.weaver@maine.edu, hpa@zytor.com, harry.pan@intel.com, eranian@google.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, tglx@linutronix.de, peterz@infradead.org, mingo@kernel.org, puthik@chromium.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, acme@redhat.com, bleung@chromium.org In-Reply-To: <20180309121549.630-3-harry.pan@intel.com> References: <20180309121549.630-3-harry.pan@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf/x86/intel: Enable C-state residency events for Cannon Lake Git-Commit-ID: 1159e09476536250c2a0173d4298d15114df7a89 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 1159e09476536250c2a0173d4298d15114df7a89 Gitweb: https://git.kernel.org/tip/1159e09476536250c2a0173d4298d15114df7a89 Author: Harry Pan AuthorDate: Fri, 9 Mar 2018 20:15:48 +0800 Committer: Ingo Molnar CommitDate: Sat, 31 Mar 2018 11:28:36 +0200 perf/x86/intel: Enable C-state residency events for Cannon Lake Cannon Lake supports C1/C3/C6/C7, PC2/PC3/PC6/PC7/PC8/PC9/PC10 state residency counters, this patch enables those counters. ( The MSR information is based on Intel Software Developers' Manual, Vol. 4, Order No. 335592. ) Tested-by: Puthikorn Voravootivat Signed-off-by: Harry Pan Reviewed-by: Benson Leung Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Kan.liang@intel.com Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Cc: gs0622@gmail.com Link: http://lkml.kernel.org/r/20180309121549.630-3-harry.pan@intel.com Signed-off-by: Ingo Molnar --- arch/x86/events/intel/cstate.c | 44 +++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c index 72db0664a53d..9aca448bb8e6 100644 --- a/arch/x86/events/intel/cstate.c +++ b/arch/x86/events/intel/cstate.c @@ -40,50 +40,51 @@ * Model specific counters: * MSR_CORE_C1_RES: CORE C1 Residency Counter * perf code: 0x00 - * Available model: SLM,AMT,GLM + * Available model: SLM,AMT,GLM,CNL * Scope: Core (each processor core has a MSR) * MSR_CORE_C3_RESIDENCY: CORE C3 Residency Counter * perf code: 0x01 - * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,GLM + * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,GLM, + CNL * Scope: Core * MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter * perf code: 0x02 - * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW - * SKL,KNL,GLM + * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW, + * SKL,KNL,GLM,CNL * Scope: Core * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter * perf code: 0x03 - * Available model: SNB,IVB,HSW,BDW,SKL + * Available model: SNB,IVB,HSW,BDW,SKL,CNL * Scope: Core * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter. * perf code: 0x00 - * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM + * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL * Scope: Package (physical package) * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter. * perf code: 0x01 - * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL - * GLM + * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL, + * GLM,CNL * Scope: Package (physical package) * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. * perf code: 0x02 * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW - * SKL,KNL,GLM + * SKL,KNL,GLM,CNL * Scope: Package (physical package) * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter. * perf code: 0x03 - * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL + * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,CNL * Scope: Package (physical package) * MSR_PKG_C8_RESIDENCY: Package C8 Residency Counter. * perf code: 0x04 - * Available model: HSW ULT only + * Available model: HSW ULT,CNL * Scope: Package (physical package) * MSR_PKG_C9_RESIDENCY: Package C9 Residency Counter. * perf code: 0x05 - * Available model: HSW ULT only + * Available model: HSW ULT,CNL * Scope: Package (physical package) * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter. * perf code: 0x06 - * Available model: HSW ULT, GLM + * Available model: HSW ULT,GLM,CNL * Scope: Package (physical package) * */ @@ -486,6 +487,21 @@ static const struct cstate_model hswult_cstates __initconst = { BIT(PERF_CSTATE_PKG_C10_RES), }; +static const struct cstate_model cnl_cstates __initconst = { + .core_events = BIT(PERF_CSTATE_CORE_C1_RES) | + BIT(PERF_CSTATE_CORE_C3_RES) | + BIT(PERF_CSTATE_CORE_C6_RES) | + BIT(PERF_CSTATE_CORE_C7_RES), + + .pkg_events = BIT(PERF_CSTATE_PKG_C2_RES) | + BIT(PERF_CSTATE_PKG_C3_RES) | + BIT(PERF_CSTATE_PKG_C6_RES) | + BIT(PERF_CSTATE_PKG_C7_RES) | + BIT(PERF_CSTATE_PKG_C8_RES) | + BIT(PERF_CSTATE_PKG_C9_RES) | + BIT(PERF_CSTATE_PKG_C10_RES), +}; + static const struct cstate_model slm_cstates __initconst = { .core_events = BIT(PERF_CSTATE_CORE_C1_RES) | BIT(PERF_CSTATE_CORE_C6_RES), @@ -557,6 +573,8 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = { X86_CSTATES_MODEL(INTEL_FAM6_KABYLAKE_MOBILE, snb_cstates), X86_CSTATES_MODEL(INTEL_FAM6_KABYLAKE_DESKTOP, snb_cstates), + X86_CSTATES_MODEL(INTEL_FAM6_CANNONLAKE_MOBILE, cnl_cstates), + X86_CSTATES_MODEL(INTEL_FAM6_XEON_PHI_KNL, knl_cstates), X86_CSTATES_MODEL(INTEL_FAM6_XEON_PHI_KNM, knl_cstates),