Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2407705ybt; Tue, 16 Jun 2020 05:29:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXJn5E75Ork0RqB52Nik1if1J9LXLlsyU9S7e4ddTOj5vIFOAVrmw1XPlkwZFLofDxLEl6 X-Received: by 2002:a17:906:2b88:: with SMTP id m8mr2660672ejg.509.1592310557449; Tue, 16 Jun 2020 05:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592310557; cv=none; d=google.com; s=arc-20160816; b=vkrllECrOuT0MMAn6l8BTPE58GPjOvn98sBaCQBTmgyqe8NR7MG9trQo0PzPw4UaGN 1pcye2wUaI80YBWsvr+FP033xlMuKWhju8vCh2/QvuFrzbRzFB4DAWcRqbAdzH5RJgQy /ee5StYhni2gZwu5srlyNHfkUtewvY4cw9Key3cB+UBYml7Frehy8GdR8GdYT+pzn1Ad WNBGwvgEBfO330SOJcW+xaS/7wrTBUr7wOUa+ZNPMkmv2KC0wpnsAZOK4AmcSPtrAlfK Zdb0ZwioSJmaa33VNRuWZtYK2iU6nK9dRfvixUSbWnXMSeOAYGP2hzk98t+FvjgzB72E 7HyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=Wj6wz5PXIup4t8dgKrvwJaquQWkYtnLazCMiC/ypBNo=; b=s4s26GojBAEaSj1XnITGWF7IJ1aaYGcL8vi8x13taShYRO9Al52kRrklJHeFz5NXOl REB/jTV1FfEMC3En8FWJKustvdmC1lNdv5vt7Ryrre2tgeMJbsXpRuRtPLEywVN4VuRd gtD0+JAw3+cM2TqQSmoJykF8svOGVlDBcBqYjWW08RZ8f15tQD2D+tjWXpzouBuIwN3w gT63UEuBb2NfkHXdd4j4FNBvlaHYfu8WOWCK79vKK/joPoC2fxSq5bzp8CKWPxM0+tXp JnWVe9SXJ6S+OxDR78oo4KcfFfoiULJV6I+15kKVwoYJYx431bv+lELgBOgIlIkepYGE uyrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yd12si10796345ejb.237.2020.06.16.05.28.54; Tue, 16 Jun 2020 05:29:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728694AbgFPMVz (ORCPT + 99 others); Tue, 16 Jun 2020 08:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726261AbgFPMVy (ORCPT ); Tue, 16 Jun 2020 08:21:54 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F368BC08C5C3; Tue, 16 Jun 2020 05:21:53 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jlAb4-0004aN-EN; Tue, 16 Jun 2020 14:21:46 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 046D91C0475; Tue, 16 Jun 2020 14:21:46 +0200 (CEST) Date: Tue, 16 Jun 2020 12:21:45 -0000 From: "tip-bot2 for Roman Sudarikov" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86/intel/uncore: Wrap the max dies calculation into an accessor Cc: Alexander Antonov , Roman Sudarikov , "Peter Zijlstra (Intel)" , Kan Liang , Alexander Shishkin , x86 , LKML In-Reply-To: <20200601083543.30011-3-alexander.antonov@linux.intel.com> References: <20200601083543.30011-3-alexander.antonov@linux.intel.com> MIME-Version: 1.0 Message-ID: <159231010577.16989.17429381854378008824.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 36b533bc5e3ed1039406f3b27e746b4d18f2cac1 Gitweb: https://git.kernel.org/tip/36b533bc5e3ed1039406f3b27e746b4d18f2cac1 Author: Roman Sudarikov AuthorDate: Mon, 01 Jun 2020 11:35:42 +03:00 Committer: Peter Zijlstra CommitterDate: Mon, 15 Jun 2020 14:09:51 +02:00 perf/x86/intel/uncore: Wrap the max dies calculation into an accessor The accessor to return number of dies on the platform. Signed-off-by: Alexander Antonov Signed-off-by: Roman Sudarikov Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Kan Liang Reviewed-by: Alexander Shishkin Link: https://lkml.kernel.org/r/20200601083543.30011-3-alexander.antonov@linux.intel.com --- arch/x86/events/intel/uncore.c | 13 +++++++------ arch/x86/events/intel/uncore.h | 3 +++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 49255e6..d5c6d3b 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -16,7 +16,7 @@ struct pci_driver *uncore_pci_driver; DEFINE_RAW_SPINLOCK(pci2phy_map_lock); struct list_head pci2phy_map_head = LIST_HEAD_INIT(pci2phy_map_head); struct pci_extra_dev *uncore_extra_pci_dev; -static int max_dies; +int __uncore_max_dies; /* mask of cpus that collect uncore events */ static cpumask_t uncore_cpu_mask; @@ -108,7 +108,7 @@ struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu * The unsigned check also catches the '-1' return value for non * existent mappings in the topology map. */ - return dieid < max_dies ? pmu->boxes[dieid] : NULL; + return dieid < uncore_max_dies() ? pmu->boxes[dieid] : NULL; } u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event) @@ -882,7 +882,7 @@ static void uncore_free_boxes(struct intel_uncore_pmu *pmu) { int die; - for (die = 0; die < max_dies; die++) + for (die = 0; die < uncore_max_dies(); die++) kfree(pmu->boxes[die]); kfree(pmu->boxes); } @@ -923,7 +923,7 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid) if (!pmus) return -ENOMEM; - size = max_dies * sizeof(struct intel_uncore_box *); + size = uncore_max_dies() * sizeof(struct intel_uncore_box *); for (i = 0; i < type->num_boxes; i++) { pmus[i].func_id = setid ? i : -1; @@ -1123,7 +1123,7 @@ static int __init uncore_pci_init(void) size_t size; int ret; - size = max_dies * sizeof(struct pci_extra_dev); + size = uncore_max_dies() * sizeof(struct pci_extra_dev); uncore_extra_pci_dev = kzalloc(size, GFP_KERNEL); if (!uncore_extra_pci_dev) { ret = -ENOMEM; @@ -1552,7 +1552,8 @@ static int __init intel_uncore_init(void) if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) return -ENODEV; - max_dies = topology_max_packages() * topology_max_die_per_package(); + __uncore_max_dies = + topology_max_packages() * topology_max_die_per_package(); uncore_init = (struct intel_uncore_init_fun *)id->driver_data; if (uncore_init->pci_init) { diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h index 7caba06..594a2fe 100644 --- a/arch/x86/events/intel/uncore.h +++ b/arch/x86/events/intel/uncore.h @@ -182,6 +182,9 @@ int uncore_pcibus_to_physid(struct pci_bus *bus); ssize_t uncore_event_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf); +extern int __uncore_max_dies; +#define uncore_max_dies() (__uncore_max_dies) + #define INTEL_UNCORE_EVENT_DESC(_name, _config) \ { \ .attr = __ATTR(_name, 0444, uncore_event_show, NULL), \