Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2953593yba; Mon, 6 May 2019 14:28:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOInFzpSnckXeKgtDET8IBbtTotpYTjKhi2p9M/7KB/dH9XOwqwqDhnjWmw8VILJtfbFXl X-Received: by 2002:aa7:8acb:: with SMTP id b11mr3139910pfd.115.1557178122490; Mon, 06 May 2019 14:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557178122; cv=none; d=google.com; s=arc-20160816; b=MikcwB2oBu/2MNP8/iGB84W7WusLL9IlqjuLREWu5R3VbsxHVGpM+f7Ib9C5ggYdZr 6NCRNLiFNoIIwCaK1nHA+MAP+P2e492zqPXEKh6Eikgp8Lg4JrRTdgxD4d3uVU44sEdo SO7206PSRrDKzBcrtXqdem01hPCud3VUM8lNQ0TQXiTTAgippCn0JcOp1Y9UiF6eURzh kEoBN2iLPB3eAxk1jv6yoQic/+TK0HjV7MREexL8vX3bneQ/s8VQ0mnezRVtGjYEJNmz JqOb6avo2UAjupq278efDIbXsS3rdMcCzA5qJbMwmZ9mZDTp8sqCMBq4W744cKXXR6Ni d9Ww== 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=/r/wJJuIve3cfROEOjQXmKOysyLZKrQ8MKJaix41P8Y=; b=CRNE9Rh7XWv6pZRVcQvU5MdX5R/VKRCcdUCx5Pd7422Q+Cb0BHZaivaMMm91sGb3se 68zCESPbxKJsJNAtt4KCbgDekv6GpEVOHmYUtzt4LMAEKyvvdtjsOmllYqRjxwu0DYlX ++fLZOJ9+3WJI65BTF002FIwcUZcABpwzvCHAE72iylfN3Um9RFZWVx8tP0OJm1Qfl0b KZscIgcwND/U3dXnxxfSkjOdtyCEiFJ+nfBeveAmnv+wVwO8Q7AEwA/N0DoOt1N6a9qi ew7DmfnxrekXUo/QXBP6t14gqRqhjgd0jNIc0y3a9+L7qLH+6JchvtjEWi17ahZnIih8 ls2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=l4Zux9CL; 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 w13si3016195pge.212.2019.05.06.14.28.26; Mon, 06 May 2019 14:28:42 -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=l4Zux9CL; 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 S1727052AbfEFV0w (ORCPT + 99 others); Mon, 6 May 2019 17:26:52 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:36572 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726998AbfEFV0r (ORCPT ); Mon, 6 May 2019 17:26:47 -0400 Received: by mail-io1-f65.google.com with SMTP id e19so2634176iob.3 for ; Mon, 06 May 2019 14:26:47 -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=/r/wJJuIve3cfROEOjQXmKOysyLZKrQ8MKJaix41P8Y=; b=l4Zux9CLadNQDk3oTwHbkN7o28DsDibkY8AY2cR1I7KATEicc8ajZaTuDbm0mZn171 ZxIFFZEnJHgZbndLiEMVqZmEWdxy0py2/dS3mgH497e4P+hpqEp3jLczYKIGB9AIrbBC HrAW88p+uOi7XFFBUbjXsWhHUjUm5MT9GZXm2ZRvqi5l0vBDeII3co7PzbCwOh2Tii1I ceCI4ynvXr7w46s1zgfOFehnAw1b89XbO7hJPv4+afEvZeafaqTmLbDLyhM3l9rrUCYE Ngm4wHGQGhI/wQkN6FgCd2vzPnKPWXNL0aqFYuXTsUMTzq/GKhpnO+kx9IrXaBmCvJ9U +l1g== 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=/r/wJJuIve3cfROEOjQXmKOysyLZKrQ8MKJaix41P8Y=; b=Tonhih7xlfuO4fpAy7WGpi156oIYXhHMTAAJm9OtNaAQo7/OklMHlDpvOU12kerpMf lZbTL31l/WPyK0Nrrg4Z9pSNn3P0oLq1rIx8fsoStx5Qdxogbiyoxa2m6WUY2pwkJe+D zQvzjkxDi03T1VFJPpS0Ia5x0fpFQsP8FSRQ/BoJb0gZ8ItufL2vW00Z8XlLLpADKjg4 ecEFiJOsKBVFtsWb31UFLgKGTjh6GHplHVxxVWBimdP0jSyFMxHQW3ok/fjCuRGpuTWi SSk3Fz7DUrJaqe637gVT9ymsBvVp/Yatw1sQtK6UbFHs92VuHQQGMq0PFllK7LfRiQtn 3D2g== X-Gm-Message-State: APjAAAUgc3HZtpc4cnm98Voue32n2jCVsHdvKjj/FKUiec+01cgdR2hp w7AekEiSaOYEp0UMp0XidoJY3T3E X-Received: by 2002:a6b:b503:: with SMTP id e3mr3075269iof.216.1557178006814; Mon, 06 May 2019 14:26:46 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 14:26:46 -0700 (PDT) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Kan Liang , Peter Zijlstra , Len Brown Subject: [PATCH 17/22] perf/x86/intel/rapl: Support multi-die/package Date: Mon, 6 May 2019 17:26:12 -0400 Message-Id: <914b7783c40acb58bffd90a2d378062659c974cb.1557177585.git.len.brown@intel.com> 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 RAPL becomes die-scope on Xeon Cascade Lake-AP. Perf RAPL driver needs to support die-scope RAPL domain. Use topology_logical_die_id() to replace topology_logical_package_id(). For previous platforms which doesn't have multi-die, topology_logical_die_id() is identical as topology_logical_package_id(). 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. Signed-off-by: Kan Liang Cc: Peter Zijlstra Signed-off-by: Len Brown --- arch/x86/events/intel/rapl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c index 94dc564146ca..e49f69c51b10 100644 --- a/arch/x86/events/intel/rapl.c +++ b/arch/x86/events/intel/rapl.c @@ -161,7 +161,7 @@ static u64 rapl_timer_ms; static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu) { - unsigned int pkgid = topology_logical_package_id(cpu); + unsigned int pkgid = topology_logical_die_id(cpu); /* * The unsigned check also catches the '-1' return value for non @@ -571,7 +571,7 @@ static int rapl_cpu_offline(unsigned int cpu) pmu->cpu = -1; /* Find a new cpu to collect rapl events */ - target = cpumask_any_but(topology_core_cpumask(cpu), cpu); + target = cpumask_any_but(topology_die_cpumask(cpu), cpu); /* Migrate rapl events to the new target */ if (target < nr_cpu_ids) { @@ -598,14 +598,14 @@ static int rapl_cpu_online(unsigned int cpu) pmu->timer_interval = ms_to_ktime(rapl_timer_ms); rapl_hrtimer_init(pmu); - rapl_pmus->pmus[topology_logical_package_id(cpu)] = pmu; + rapl_pmus->pmus[topology_logical_die_id(cpu)] = pmu; } /* * Check if there is an online cpu in the package which collects rapl * events already. */ - target = cpumask_any_and(&rapl_cpu_mask, topology_core_cpumask(cpu)); + target = cpumask_any_and(&rapl_cpu_mask, topology_die_cpumask(cpu)); if (target < nr_cpu_ids) return 0; @@ -675,7 +675,7 @@ static void cleanup_rapl_pmus(void) static int __init init_rapl_pmus(void) { - int maxpkg = topology_max_packages(); + int maxpkg = topology_max_packages() * topology_max_die_per_package(); size_t size; size = sizeof(*rapl_pmus) + maxpkg * sizeof(struct rapl_pmu *); -- 2.18.0-rc0