[SRU][Xenial][Yakkety][PATCH 1/1] UBUNTU: SAUCE: (no-up) x86/topology: Handle CPUID bogosity gracefully

Joseph Salisbury joseph.salisbury at canonical.com
Mon May 9 16:17:46 UTC 2016


From: Thomas Gleixner <tglx at linutronix.de>

BugLink: http://bugs.launchpad.net/bugs/1573231

Joseph reported that a XEN guest dies with a division by 0 in the package
topology setup code. This happens if cpu_info.x86_max_cores is zero.

Handle that case and emit a warning. This does not fix the underlying XEN bug,
but makes the code more robust.

Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Boris Ostrovsky <boris.ostrovsky at oracle.com>
Cc: David Vrabel <david.vrabel at citrix.com>
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1605062046270.3540@nanos
Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
Signed-off-by: Joseph Salisbury <joseph.salisbury at canonical.com>
---
 arch/x86/kernel/smpboot.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index a61a97a..96f49a2 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -332,6 +332,11 @@ static void __init smp_init_package_map(void)
 	 * primary cores.
 	 */
 	ncpus = boot_cpu_data.x86_max_cores;
+	if (!ncpus) {
+		pr_warn("x86_max_cores == zero !?!?");
+		ncpus = 1;
+	}
+
 	__max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
 
 	/*
-- 
2.7.4





More information about the kernel-team mailing list