public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: peterz@infradead.org
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 3/3] x86, perf, uncore: Don't make MSR uncore depend on PCI uncore
Date: Thu, 18 Jun 2015 16:02:28 -0700	[thread overview]
Message-ID: <1434668548-25901-4-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1434668548-25901-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

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
v3: Return error when both registrations fail.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/kernel/cpu/perf_event_intel_uncore.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 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..31ac78b 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,13 @@ 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;
-	}
-	uncore_cpumask_init();
-
-	uncore_pmus_register();
+	ret1 = uncore_pci_init();
+	ret2 = uncore_cpu_init();
+	if (!ret1 || !ret2) {
+		uncore_cpumask_init();
+		uncore_pmus_register();
+	} else
+		return -ENODEV;
 	return 0;
-fail:
-	return ret;
 }
 device_initcall(intel_uncore_init);
-- 
2.4.2


  parent reply	other threads:[~2015-06-18 23:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18 23:02 Another Haswell uncore patchkit Andi Kleen
2015-06-18 23:02 ` [PATCH 1/3] x86, perf, uncore: Add support for ARB uncore PMU on Sandy/IvyBridge Andi Kleen
2015-06-18 23:02 ` [PATCH 2/3] x86, perf, uncore: Use Sandy Bridge client PMU on Haswell/Broadwell Andi Kleen
2015-06-18 23:02 ` Andi Kleen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-06-18 20:45 Updated Haswell uncore PMU patchkit Andi Kleen
2015-06-18 20:46 ` [PATCH 3/3] x86, perf, uncore: Don't make MSR uncore depend on PCI uncore Andi Kleen
2015-06-18 21:12   ` Thomas Gleixner
2015-06-18 22:48     ` Andi Kleen
2015-06-18 22:57       ` Thomas Gleixner
2015-06-15  5:57 [PATCH 1/3] x86, perf, uncore: Add support for ARB uncore PMU on Sandy/IvyBridge Andi Kleen
2015-06-15  5:57 ` [PATCH 3/3] x86, perf, uncore: Don't make MSR uncore depend on PCI uncore Andi Kleen
2015-06-16 12:06   ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434668548-25901-4-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox