Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2953277yba; Mon, 6 May 2019 14:28:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/DBpo0ULyHqYyuRYL56iSK0wj6pW29wBE1Hh6O5mvLro6ub96wsSg4ZehoN9eXhGy7tg2 X-Received: by 2002:a62:460a:: with SMTP id t10mr34395241pfa.3.1557178098086; Mon, 06 May 2019 14:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557178098; cv=none; d=google.com; s=arc-20160816; b=b5wI+TnhIkQZ1Nve8yC7Jg9c9X3axM3ZiFq4JixGiMnGUIcxVqZn+gtKsQxmC/BAxt VOLuSi9ZihMY7V2EkXSCzQwtSO+4fPxGNKdlhs0G6s7zEebIiIhr7LzB3xCLSZAK10R/ QUUazSFOMaj7IizLFe3dMPt8Zrtx2ZzVpLQL8/plgpU4oB4PJS5szhulU7xGyGZwIZ+9 T/7JQLU1oS7XE3tuUVL/LOGOJb/rBILEdQyUUp7x9+kO+0mDG3JdNe4q2fyugNHnaV0O UhtQe5Km9g7d5vX+kIOrzvOHorH5tL1hG4XaUmfh2kBBnV3HODy00MTysvvaJYZoWqQU N68w== 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=BZvfoMetd7XOqGPD4+QBEFZbIkXgaAiftB+eMxWYjro=; b=J+8E7e6j3GedAJS4910fybKd+axH/y/16z9dcVel0LjxDMrecWOha4rDMHULUoHwVq vy+SYWIrN9l9EKxslE7cCMwfQyyYCXTGv4GE3BrVKPT3/9IzmqfoP5lvrQgj55sxOdKs WCYD6QfbtXjlaTfjHpAch/DGKHt2lwxdgReNB9uVK9eCEbBB+ox8N0BW5GRlpCj3gxiO pdr/EDKIh0Rt5DJ3QLw2ZwEx22q7MW1U8tAQUnGyVB+vGr5z2BifMoiasykhb8c+ccya +vWBGdEiE5p5U5GKrkzrSXKgDJvFcdiRItsHotewo420256YbcLYet8Vy0Jeqk/8u6hL 4TZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=kQ3llac0; 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 31si17713979pli.242.2019.05.06.14.28.02; Mon, 06 May 2019 14:28:18 -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=kQ3llac0; 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 S1727031AbfEFV0u (ORCPT + 99 others); Mon, 6 May 2019 17:26:50 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:44761 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727022AbfEFV0s (ORCPT ); Mon, 6 May 2019 17:26:48 -0400 Received: by mail-io1-f65.google.com with SMTP id v9so8560037ion.11 for ; Mon, 06 May 2019 14:26:48 -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=BZvfoMetd7XOqGPD4+QBEFZbIkXgaAiftB+eMxWYjro=; b=kQ3llac0UgjHyZ9Ahv7/k2JBk/q++o/dQ0uKOdS1miBtZWs6UWI4u0L54AT6UAJeMq DIrd5qCEngzb3BhlEvfqMYS1y7x8dwrVapKZ0Ny6dFECau9XX1fjlcaIWmGVX+NWNiGW byaoMEn0Ho6+qRsOxsAL99y/J3tLu6JTKY+cjKhHP8E89uX7jG7WWryCNrt1d5WW70Rv RZdEg7KbAr/EehXujB2+ida8yoouWOuIpPYwqrKsW93Z4BP6+ouX+yQ6h+wXVB8R9V88 zsFas9zHpfniGaqQO0OC2CEaPmdRPBedXRGYY9mRBXIKgOj/LXd8SUU1KE2WT4Nb+jaR jJsg== 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=BZvfoMetd7XOqGPD4+QBEFZbIkXgaAiftB+eMxWYjro=; b=paZQtX9poOqe3UfA0gZ490zsytinLXFjLgH3q4Xk7wQWypU94p0Sx/xlladPtqGYon mHULnNJETkBuqZCsySog0CMTLiYCYW9k8/p5ItaGUJeuS+A9CKIIa9ivhZ/9qvkSNw+x c48DOHzb23btDMhQyeXiXx+CzkhLLhluVZ0nKCLDpVqA9DcTM8cXyVCMUJ+PcmS3Oazz IenTAhk1YPdesOm7QIQZghulE1aqNslluF6Ul1jIWLZLPmEX35GKkuxi7Wq2oIq413Bi a8sIglHJe4rMYHlofxq8HTHvyYmgnMhDsqtY1OXVrin/P2nfCO4ve6ATjtFxJblAlAWs cViQ== X-Gm-Message-State: APjAAAVN3FD0e6+vTr82Hk26LXiqMSuA2xaxURcrZ959SMnHaTEBGtiD BJDBNvpv1tqkPr83plkLrJQ= X-Received: by 2002:a6b:760d:: with SMTP id g13mr18361487iom.114.1557178008281; Mon, 06 May 2019 14:26:48 -0700 (PDT) Received: from nuc8.lan (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id v25sm4268009ioh.81.2019.05.06.14.26.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 14:26:47 -0700 (PDT) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Kan Liang , Peter Zijlstra , Len Brown Subject: [PATCH 18/22] perf/x86/intel/cstate: Support multi-die/package Date: Mon, 6 May 2019 17:26:13 -0400 Message-Id: X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1557177585.git.len.brown@intel.com> References: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1557177585.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 94a4b7fc75d0..52c5fea29457 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); @@ -661,7 +661,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