View Issue Details

IDProjectCategoryView StatusLast Update
0012466CentOS-7kernelpublic2017-09-17 17:51
Reporterxs3c 
PriorityhighSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformqemu 1.5.3OSOS Version
Product Version 
Target VersionFixed in Version 
Summary0012466: Only one cpu is successfully detected after upgrade to 3.10.0-514.2.2.el7.x86_64
DescriptionAfter upgrade to 3.10.0-514.2.2.el7.x86_64, only one cpu is successfully detected. the following error appears in dmesg:

smpboot: Max logical packages: 1
smpboot: APIC(0) Converting physical 0 to logical package 0
smpboot: APIC(1) Package 1 exceeds logical package map
smpboot: CPU 1 APICId 1 disabled

then I backported 7b0501(x86/smp: Fix __max_logical_packages value setup) from Linus repo, the issue is solved, so can we consider to backport it in next kernel version.

Steps To Reproduceyum update kernel
TagsNo tags attached.
abrt_hash
URL

Activities

toracat

toracat

2016-12-21 16:48

manager   ~0028228

$ git describe 7b0501b1e7cddd32b265178e32d332bdfbb532d4
v4.8-rc2-8-g7b0501b
toracat

toracat

2016-12-21 16:59

manager   ~0028229

Please report this bug upstream at http://bugzilla.redhat.com . This is the only way to get the fix into the distro kernel.

What CentOS can offer is to include the patch in the centosplus kernel (kernel-plus). This will be done in the next kernel update.
xs3c

xs3c

2016-12-22 03:39

reporter   ~0028232

I had filed a bug at https://bugzilla.redhat.com/show_bug.cgi?id=1406853
toracat

toracat

2016-12-22 19:46

manager  

centos-linux-3.10-x86smp-fix-max_logical_packages_values-bug12466.patch (3,675 bytes)
centosplus patch [bug#12466]

commit 7b0501b1e7cddd32b265178e32d332bdfbb532d4
Author: Jiri Olsa <jolsa@redhat.com>
Date:   Mon Aug 15 12:17:00 2016 +0200

    x86/smp: Fix __max_logical_packages value setup

    Frank reported kernel panic when he disabled several cores in BIOS
    via following option:

      Core Disable Bitmap(Hex)   [0]

    with number 0xFFE, which leaves 16 CPUs in system (out of 48).

    Reported-by: Frank Ramsay <framsay@redhat.com>
    Tested-by: Prarit Bhargava <prarit@redhat.com>
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Reviewed-by: Prarit Bhargava <prarit@redhat.com>
    Acked-by: Peter Zijlstra <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/20160815101700.GA30090@krava
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Applied-by: Akemi Yagi <toracat@centos.org>

--- a/arch/x86/kernel/smpboot.c	2016-11-16 09:52:06.000000000 -0800
+++ b/arch/x86/kernel/smpboot.c	2016-12-22 11:30:30.710547171 -0800
@@ -109,10 +109,11 @@ atomic_t init_deasserted;
 /* Logical package management. We might want to allocate that dynamically */
 static int *physical_to_logical_pkg __read_mostly;
 static unsigned long *physical_package_map __read_mostly;;
-static unsigned long *logical_package_map  __read_mostly;
 static unsigned int max_physical_pkg_id __read_mostly;
 unsigned int __max_logical_packages __read_mostly;
 EXPORT_SYMBOL(__max_logical_packages);
+static unsigned int logical_packages __read_mostly;
+static bool logical_packages_frozen __read_mostly;
 
 /*
  * Report back to the Boot Processor during boot time or to the caller processor
@@ -258,14 +259,14 @@ int topology_update_package_map(unsigned
 	if (test_and_set_bit(pkg, physical_package_map))
 		goto found;
 
-	new = find_first_zero_bit(logical_package_map, __max_logical_packages);
-	if (new >= __max_logical_packages) {
+	if (logical_packages_frozen) {
 		physical_to_logical_pkg[pkg] = -1;
-		pr_warn("APIC(%x) Package %u exceeds logical package map\n",
+		pr_warn("APIC(%x) Package %u exceeds logical package max\n",
 			apicid, pkg);
 		return -ENOSPC;
 	}
-	set_bit(new, logical_package_map);
+
+	new = logical_packages++;
 	pr_info("APIC(%x) Converting physical %u to logical package %u\n",
 		apicid, pkg, new);
 	physical_to_logical_pkg[pkg] = new;
@@ -325,6 +326,7 @@ static void __init smp_init_package_map(
 		__max_logical_packages = total_cpus;
 	else
 		__max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
+	logical_packages = 0;
 
 	/*
 	 * Possibly larger than what we need as the number of apic ids per
@@ -336,10 +338,6 @@ static void __init smp_init_package_map(
 	memset(physical_to_logical_pkg, 0xff, size);
 	size = BITS_TO_LONGS(max_physical_pkg_id) * sizeof(unsigned long);
 	physical_package_map = kzalloc(size, GFP_KERNEL);
-	size = BITS_TO_LONGS(__max_logical_packages) * sizeof(unsigned long);
-	logical_package_map = kzalloc(size, GFP_KERNEL);
-
-	pr_info("Max logical packages: %u\n", __max_logical_packages);
 
 	for_each_present_cpu(cpu) {
 		unsigned int apicid = apic->cpu_present_to_apicid(cpu);
@@ -353,6 +351,15 @@ static void __init smp_init_package_map(
 		set_cpu_possible(cpu, false);
 		set_cpu_present(cpu, false);
 	}
+
+	if (logical_packages > __max_logical_packages) {
+		pr_warn("Detected more packages (%u), then computed by BIOS data (%u).\n",
+			logical_packages, __max_logical_packages);
+		logical_packages_frozen = true;
+		__max_logical_packages  = logical_packages;
+	}
+
+	pr_info("Max logical packages: %u\n", __max_logical_packages);
 }
 
 void __init smp_store_boot_cpu_info(void)
toracat

toracat

2017-01-18 00:10

manager   ~0028387

The patch is now in kernel 3.10.0-514.6.1.el7 released today upstream, therefore no need to be included in the plus kernel.

Issue History

Date Modified Username Field Change
2016-12-21 06:45 xs3c New Issue
2016-12-21 16:48 toracat Status new => assigned
2016-12-21 16:48 toracat Note Added: 0028228
2016-12-21 16:59 toracat Note Added: 0028229
2016-12-22 03:39 xs3c Note Added: 0028232
2016-12-22 19:46 toracat File Added: centos-linux-3.10-x86smp-fix-max_logical_packages_values-bug12466.patch
2017-01-18 00:10 toracat Note Added: 0028387
2017-09-17 17:51 toracat Status assigned => resolved
2017-09-17 17:51 toracat Resolution open => fixed