x86/topology: Fix logical package mapping
authorPeter Zijlstra <peterz@infradead.org>
Fri, 18 Mar 2016 15:03:46 +0000 (16:03 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 19 Mar 2016 09:26:40 +0000 (10:26 +0100)
That first branch testing pkg against __max_logical_packages is wrong,
because if the first pkg id is larger, then the find_first_zero will
find us logical package id 0. However, if the second pkg id is indeed
0, we'll again claim it without testing if it was already taken.

Also, it fails to print the mapping.

Fixes: 1f12e32f4cd5 ("x86/topology: Create logical package id")
Reported-by: Xiong Zhou <jencce.kernel@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: aherrmann@suse.com
Cc: bp@alien8.de
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
Link: http://lkml.kernel.org/r/20160317095220.GO6344@twins.programming.kicks-ass.net
Link: http://lkml.kernel.org/r/20160318150538.482393396@infradead.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/smpboot.c

index 643dbdccf4bc9ac41305d79f1da91762574f7b12..64b669dcbf231e55cd34bf8f8819b1809a1b63eb 100644 (file)
@@ -274,11 +274,6 @@ int topology_update_package_map(unsigned int apicid, unsigned int cpu)
        if (test_and_set_bit(pkg, physical_package_map))
                goto found;
 
-       if (pkg < __max_logical_packages) {
-               set_bit(pkg, logical_package_map);
-               physical_to_logical_pkg[pkg] = pkg;
-               goto found;
-       }
        new = find_first_zero_bit(logical_package_map, __max_logical_packages);
        if (new >= __max_logical_packages) {
                physical_to_logical_pkg[pkg] = -1;
This page took 0.025275 seconds and 5 git commands to generate.