orgads / rpms / kernel

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