From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753843AbbFRUqh (ORCPT ); Thu, 18 Jun 2015 16:46:37 -0400 Received: from mga02.intel.com ([134.134.136.20]:29919 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753415AbbFRUq3 (ORCPT ); Thu, 18 Jun 2015 16:46:29 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,641,1427785200"; d="scan'208";a="713524041" From: Andi Kleen To: peterz@infradead.org Cc: linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 3/3] x86, perf, uncore: Don't make MSR uncore depend on PCI uncore Date: Thu, 18 Jun 2015 13:46:02 -0700 Message-Id: <1434660362-4083-4-git-send-email-andi@firstfloor.org> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1434660362-4083-1-git-send-email-andi@firstfloor.org> References: <1434660362-4083-1-git-send-email-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen Several sytems, such as my laptop, don't expose the PCI devices for the PCI uncore measurements. But the MSRs for the CBOX and ARB uncores are always available. Currently the init code doesn't initialize the MSR uncores when the PCI uncore registration fails. Stop it from doing that and always try to register the MSR uncores. This makes the pci uncore exit function unused. We'll need it later when the uncore becomes modular, so instead of removing it I just marked it with module_exit right now (which discards it) v2: Avoid registering notifier when both initialization calls fail Signed-off-by: Andi Kleen --- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c index b57a09d..cb1428f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c @@ -952,6 +952,8 @@ static void __init uncore_pci_exit(void) uncore_types_exit(uncore_pci_uncores); } } +module_exit(uncore_pci_exit); +/* XXX: need exit code for rest of intel_uncore_init too */ /* CPU hot plug/unplug are serialized by cpu_add_remove_lock mutex */ static LIST_HEAD(boxes_to_free); @@ -1287,7 +1289,7 @@ static void __init uncore_cpumask_init(void) static int __init intel_uncore_init(void) { - int ret; + int ret1, ret2; if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) return -ENODEV; @@ -1295,19 +1297,12 @@ static int __init intel_uncore_init(void) if (cpu_has_hypervisor) return -ENODEV; - ret = uncore_pci_init(); - if (ret) - goto fail; - ret = uncore_cpu_init(); - if (ret) { - uncore_pci_exit(); - goto fail; + ret1 = uncore_pci_init(); + ret2 = uncore_cpu_init(); + if (!ret1 || !ret2) { + uncore_cpumask_init(); + uncore_pmus_register(); } - uncore_cpumask_init(); - - uncore_pmus_register(); return 0; -fail: - return ret; } device_initcall(intel_uncore_init); -- 2.4.2