Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1396279
| From | tip-bot for Thomas Gleixner <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:x86/urgent] x86/topology: Handle CPUID bogosity gracefully |
| Date | 2016-05-07 10:20 +0200 |
| Message-ID | <rw5CW-6kg-17@gated-at.bofh.it> (permalink) |
| References | <rvT8K-20P-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: 56402d63eefe22179f7311a51ff2094731420406
Gitweb: http://git.kernel.org/tip/56402d63eefe22179f7311a51ff2094731420406
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Fri, 6 May 2016 20:48:16 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 7 May 2016 10:06:55 +0200
x86/topology: Handle CPUID bogosity gracefully
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.
Reported-and-tested-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1605062046270.3540@nanos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
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 a2065d3..0e4329e 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);
/*
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[v4.6-rc1 Regression] x86/topology: Create logical package id Joseph Salisbury <joseph.salisbury@canonical.com> - 2016-05-06 20:20 +0200
Re: [v4.6-rc1 Regression] x86/topology: Create logical package id Thomas Gleixner <tglx@linutronix.de> - 2016-05-06 21:00 +0200
Re: [v4.6-rc1 Regression] x86/topology: Create logical package id Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-05-06 21:20 +0200
Re: [v4.6-rc1 Regression] x86/topology: Create logical package id Joseph Salisbury <joseph.salisbury@canonical.com> - 2016-05-06 21:40 +0200
Re: [v4.6-rc1 Regression] x86/topology: Create logical package id Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-05-06 22:50 +0200
Re: [v4.6-rc1 Regression] x86/topology: Create logical package id Joseph Salisbury <joseph.salisbury@canonical.com> - 2016-05-06 23:00 +0200
Re: [v4.6-rc1 Regression] x86/topology: Create logical package id Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-05-06 23:30 +0200
Re: [v4.6-rc1 Regression] x86/topology: Create logical package id Joseph Salisbury <joseph.salisbury@canonical.com> - 2016-05-06 21:40 +0200
Re: [v4.6-rc1 Regression] x86/topology: Create logical package id Joseph Salisbury <joseph.salisbury@canonical.com> - 2016-05-06 23:00 +0200
Re: [v4.6-rc1 Regression] x86/topology: Create logical package id Ingo Molnar <mingo@kernel.org> - 2016-05-07 07:20 +0200
[tip:x86/urgent] x86/topology: Handle CPUID bogosity gracefully tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-05-07 10:20 +0200
csiph-web