potatogim / rpms / kernel

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