Received: by 10.223.185.111 with SMTP id b44csp385370wrg; Fri, 9 Mar 2018 06:39:41 -0800 (PST) X-Google-Smtp-Source: AG47ELuMKj37zvBGHsh9MpUCIXJfTAKzU4ThPYse9Jw9DptmgfOZTH+oqQBpaQGd7sl/ZDM9Udiz X-Received: by 10.98.248.7 with SMTP id d7mr30525863pfh.117.1520606381713; Fri, 09 Mar 2018 06:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520606381; cv=none; d=google.com; s=arc-20160816; b=MRYrivUilwEcDjEg/6R4J7GNJjdxt255aDtHLxWFiRDz+4K4WTeNrwB2tdN5zwhmEy IYRpyMFsI6Loyk9581Se+w3vAe9+AmGm9avdbFGsw++0aAp9aVET4q2GYvZDqtHp2E3O JY8R5F5KRAES62YXthlTeHXndsA4ObKUGp1YAGMV/1891PUSGyjJMzLGbtFBBX7POAO4 n7e1ZT+959aqVtyieRrNS0CkfJC6+0vQTwqMuE2SNPx/7VfD+o+1uE6P8HV5Xjz59MXs Mwx1a1EDHNHSn0mbO6pRr2Tr3LBPTNkRaKX80OADro9pfiNcVvZhRml/BtSsgFRGqEBD VXcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Zk+B0+gaI0dA6WcLX8imElz6bkkSvQ4XQQs+g8M0DB8=; b=IMVuZtl4ENiqDu7wLFr12y5jtSLabxhYmGTfqU/Gx2PLPTp3unjD4AT0NUiyUnb/sS wDVZUb+hXWgnGA0WZK5yF9z4mL/OUBg019sda8IeNfcc1hn5lnXFqS6PFotyyyp3wSU0 uz/586lKWhMsr/V+pr66TpFN6sa7GDvV0lS133hbmrw7f0bkojQK98kNMdLUjJ2yB0ls hL9dRxUl26+YmH4TyoC8aXrK/Or4qhOCQ3Wpwu65IlIAU+SX8YoPml0JDWeGfUJHhwQV ooIONJhjch+JwbLok+S1sHVsc3WHWVhvS1pyraEac2+Vx9GPEze2v3vlsEXQiKExjl2l 3/og== 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 s25si807202pgv.479.2018.03.09.06.39.27; Fri, 09 Mar 2018 06:39:41 -0800 (PST) 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 S932215AbeCIOiC (ORCPT + 99 others); Fri, 9 Mar 2018 09:38:02 -0500 Received: from 123-192-241-158.dynamic.kbronet.com.tw ([123.192.241.158]:45034 "EHLO E6440" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751183AbeCIOhr (ORCPT ); Fri, 9 Mar 2018 09:37:47 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by E6440 (Postfix) with ESMTP id C2591C2522; Fri, 9 Mar 2018 20:15:59 +0800 (CST) From: Harry Pan To: LKML Cc: gs0622@gmail.com, Harry Pan , tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, Kan.liang@intel.com Subject: [PATCH 3/3] perf/x86/intel: Enable C-state residency events for Cannon Lake Date: Fri, 9 Mar 2018 20:15:48 +0800 Message-Id: <20180309121549.630-3-harry.pan@intel.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180309121549.630-1-harry.pan@intel.com> References: <20180309121549.630-1-harry.pan@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Harry Pan --- 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), -- 2.13.5