linuxtorvalds / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
b37f23
centosplus kernel patch [bug#12818]
b37f23
b37f23
From ac68351410df683a149e7eea09df178884cf2419 Mon Sep 17 00:00:00 2001
b37f23
From: Marcus Sundberg <marcus.sundberg@aptilo.com>
b37f23
Date: Mon, 13 Feb 2017 22:57:11 +0100
b37f23
Subject: [PATCH] [x86] perf: uncore: Avoid kernel panic on missing topology
b37f23
b37f23
The uncore code is heavily dependent on the CPU topology mapping code,
b37f23
so if we do not even have a working topology for the boot CPU we just
b37f23
give up.
b37f23
This happens for example on HPE DL360 Gen9 servers with x2APIC enabled
b37f23
in the firmware settings, where the kernel only finds a single core.
b37f23
---
b37f23
 arch/x86/events/intel/uncore.c | 14 ++++++++++++++
b37f23
 1 file changed, 14 insertions(+)
b37f23
b37f23
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
b37f23
index 77ec6c0..88d79f6 100644
b37f23
--- a/arch/x86/events/intel/uncore.c
b37f23
+++ b/arch/x86/events/intel/uncore.c
b37f23
@@ -1394,6 +1394,20 @@ static int __init intel_uncore_init(void)
b37f23
 	if (is_kdump_kernel())
b37f23
 		return -ENODEV;
b37f23
 
b37f23
+	/* Sanity check - do not even try to proceed if we have no
b37f23
+	   working topology mapping for the boot CPU. */
b37f23
+	if (rh_boot_cpu_data.logical_proc_id < 0 ||
b37f23
+	    topology_phys_to_logical_pkg(boot_cpu_data.phys_proc_id) < 0) {
b37f23
+		printk(KERN_ERR
b37f23
+		       "no mapping between physical and logical CPU, "
b37f23
+		       "boot CPU phys: %d, logical: %d/%d\n",
b37f23
+		       (int)boot_cpu_data.phys_proc_id,
b37f23
+		       (int)rh_boot_cpu_data.logical_proc_id,
b37f23
+		       (int)topology_phys_to_logical_pkg(
b37f23
+			       boot_cpu_data.phys_proc_id));
b37f23
+		return -ENODEV;
b37f23
+	}
b37f23
+
b37f23
 	max_packages = topology_max_packages();
b37f23
 
b37f23
 	pret = uncore_pci_init();
b37f23
-- 
b37f23
2.5.0
b37f23