husy394 / rpms / kernel

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