Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5540302yba; Mon, 13 May 2019 12:40:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqymCgXY+gqjk1LuvQpCnwxgs5jsAyZkANzFARjth+AvKG6s2Ibop3Z9daxENXwplIb1GVKE X-Received: by 2002:a17:902:29e6:: with SMTP id h93mr8461589plb.111.1557776458048; Mon, 13 May 2019 12:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557776458; cv=none; d=google.com; s=arc-20160816; b=IStx2pk6ofWqw+fkSVVdCtpnepqCoRR0lueUQGn2rU2BTdqs5Cz4f/gSE/oDRzgz11 6DanWFHCpLSllqCb5f697kceME3t0nDN7t6DArTEEsRBnbvpy0CsKRXETpSFuQDhbodS kmhyg8cUuO4MwdXxMTqIBXZdX81IZryvL0ZwIO61piMBGLdcVWBDfPfYM/1hLbrw71hj 52eVINH83Zf/CZ0MSdfAROaECYO7u0AT61xZAht3Wt3U+2v+ARUnZvjuOes0ymdO0yE8 AYzxYzCtsi+Gnayhch5lPgCr3EKdFkJYkXL+3M6kKif0HBOxRmb4CpnfXiKPTy3/tHxp 3leg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=W+LbcGoinyl8so0ByhwqIosqlA08N7Jf5zgSchH9jvU=; b=o9hp+2kTKPooZf40/5bd9BeNJ7p6nk9uPKqUIxDB3okiVS3uNzvtotJtgSZbXbdXbz zGL7qHhCqlEMwraAwMu2a50NbXNv9leZ/P9+6GCeuS1IlX7tFiWJRWdH36z0AcrKnSmN tQ9FVA54hJU7preglb+nZOJzQQh+wAH5TnwJPRuzLDhPEb+X2f405sKAX8qoqYCKCIux 1ZjB5dDpiF0kD8LaqdnSb0YtUI2ZKTD4tsvii5RudOXbUfRun1IOYaeR4AQl4sgWCktY CSLIyAzjPolpVy3ipaDXXJbZlfA9UqvIOJHYk9vhfWR2M8wqUjeoV/2YWHuuqglMk+Dt 48xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=UFovtUA4; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1si17453034plp.26.2019.05.13.12.40.42; Mon, 13 May 2019 12:40:58 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=UFovtUA4; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732169AbfEMR7o (ORCPT + 99 others); Mon, 13 May 2019 13:59:44 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40129 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731297AbfEMR7i (ORCPT ); Mon, 13 May 2019 13:59:38 -0400 Received: by mail-pf1-f194.google.com with SMTP id u17so7593407pfn.7 for ; Mon, 13 May 2019 10:59:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :reply-to:organization; bh=W+LbcGoinyl8so0ByhwqIosqlA08N7Jf5zgSchH9jvU=; b=UFovtUA47yV18tT3Xfzaz+0Q8fdK9J3/1/D/+yFORsUFCZhrdxYXRReUa7bWqq8+rh xCpY4JRWYFTULcQFBw5vRwWg7xaDa+mxGlAIGr1RGZRGlg82TZZerQY0CJulunONZ+Dn /66+Y9rNmLwJ3pmgyjJiacEE6M3wgVe1aRVxKEIXKG/od9EVBGZBLikupWuAY+IjhHNT hnp0/B/PsbrPyE4WFZEe68CUd+4W/lYhMEUoJmVUKA/sJMcmwfOegHuhsh/I55sDnA12 VMiwo4UxoTO+rwiITy+03XdQTNkO1747gawc+rPO/NO9qn/8UNcwUyDyAzI8uxuGCHRE y/sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:reply-to:organization; bh=W+LbcGoinyl8so0ByhwqIosqlA08N7Jf5zgSchH9jvU=; b=Qlb/Fhsw8hf/TJkCN6rhlqBwXvNReIYfoESg0yEof8XVdBI7hAIjIrbL9szSUrtVnl KWtzd3s1DWkdIX7WjH1ldJQYR6pRA0p49qWuZRazc790YmXKDu5CMLcXaJe/IQ5OxYe8 fnIkfGTYlAgkJs/1YjRAKdPmw87nuvPt9phKIfIQY5O4IRVfjxlyrVV/S4+sQ6UAfHb1 mp9pGoVOQsK8jtpWNC3FWH12P7tdOIHHWabRVLR+7YGjTMo/wEUDoguy82KL8Ujg5DZ3 iMc5YW66qA9G041N4XRslbIZhrkQZqk+DRIQ0rk56FOPJf+z5VV4sPOVtmmixk5IcOe5 6WYQ== X-Gm-Message-State: APjAAAUjIR2nuMyb7nW7fyI136MmYlk5LxidqhP71sv6rlqz+AY5BK5y uTEIR+UP8FUhHLkIEu7IJwc= X-Received: by 2002:a62:1d0d:: with SMTP id d13mr35204316pfd.96.1557770377587; Mon, 13 May 2019 10:59:37 -0700 (PDT) Received: from localhost.localdomain ([96.79.124.202]) by smtp.gmail.com with ESMTPSA id s12sm9536266pfd.152.2019.05.13.10.59.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 10:59:36 -0700 (PDT) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Kan Liang , Peter Zijlstra , Len Brown Subject: [PATCH 15/19] perf/x86/intel/cstate: Support multi-die/package Date: Mon, 13 May 2019 13:58:59 -0400 Message-Id: X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <7b23d2d26d717b8e14ba137c94b70943f1ae4b5c.1557769318.git.len.brown@intel.com> References: <7b23d2d26d717b8e14ba137c94b70943f1ae4b5c.1557769318.git.len.brown@intel.com> Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang Some cstate counters becomes die-scope on Xeon Cascade Lake-AP. Perf cstate driver needs to support die-scope cstate counters. Use topology_die_cpumask() to replace topology_core_cpumask(). For previous platforms which doesn't have multi-die, topology_die_cpumask() is identical as topology_core_cpumask(). There is no functional change for previous platforms. Name the die-scope PMU "cstate_die". Signed-off-by: Kan Liang Cc: Peter Zijlstra Signed-off-by: Len Brown --- arch/x86/events/intel/cstate.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c index 6072f92cb8ea..267d7f8e12ab 100644 --- a/arch/x86/events/intel/cstate.c +++ b/arch/x86/events/intel/cstate.c @@ -302,7 +302,7 @@ static int cstate_pmu_event_init(struct perf_event *event) return -EINVAL; event->hw.event_base = pkg_msr[cfg].msr; cpu = cpumask_any_and(&cstate_pkg_cpu_mask, - topology_core_cpumask(event->cpu)); + topology_die_cpumask(event->cpu)); } else { return -ENOENT; } @@ -385,7 +385,7 @@ static int cstate_cpu_exit(unsigned int cpu) if (has_cstate_pkg && cpumask_test_and_clear_cpu(cpu, &cstate_pkg_cpu_mask)) { - target = cpumask_any_but(topology_core_cpumask(cpu), cpu); + target = cpumask_any_but(topology_die_cpumask(cpu), cpu); /* Migrate events if there is a valid target */ if (target < nr_cpu_ids) { cpumask_set_cpu(target, &cstate_pkg_cpu_mask); @@ -414,7 +414,7 @@ static int cstate_cpu_init(unsigned int cpu) * in the package cpu mask as the designated reader. */ target = cpumask_any_and(&cstate_pkg_cpu_mask, - topology_core_cpumask(cpu)); + topology_die_cpumask(cpu)); if (has_cstate_pkg && target >= nr_cpu_ids) cpumask_set_cpu(cpu, &cstate_pkg_cpu_mask); @@ -663,7 +663,13 @@ static int __init cstate_init(void) } if (has_cstate_pkg) { - err = perf_pmu_register(&cstate_pkg_pmu, cstate_pkg_pmu.name, -1); + if (topology_max_die_per_package() > 1) { + err = perf_pmu_register(&cstate_pkg_pmu, + "cstate_die", -1); + } else { + err = perf_pmu_register(&cstate_pkg_pmu, + cstate_pkg_pmu.name, -1); + } if (err) { has_cstate_pkg = false; pr_info("Failed to register cstate pkg pmu\n"); -- 2.18.0-rc0