• Zwane Mwaikambo's avatar
    [PATCH] i386 boottime for_each_cpu broken · 4ad8d383
    Zwane Mwaikambo authored
    for_each_cpu walks through all processors in cpu_possible_map, which is
    defined as cpu_callout_map on i386 and isn't initialised until all
    processors have been booted. This breaks things which do for_each_cpu
    iterations early during boot. So, define cpu_possible_map as a bitmap with
    NR_CPUS bits populated. This was triggered by a patch i'm working on which
    does alloc_percpu before bringing up secondary processors.
    
    From: Alexander Nyberg <alexn@telia.com>
    
    i386-boottime-for_each_cpu-broken.patch
    i386-boottime-for_each_cpu-broken-fix.patch
    
    The SMP version of __alloc_percpu checks the cpu_possible_map before
    allocating memory for a certain cpu.  With the above patches the BSP cpuid
    is never set in cpu_possible_map which breaks CONFIG_SMP on uniprocessor
    machines (as soon as someone tries to dereference something allocated via
    __alloc_percpu, which in fact is never allocated since the cpu is not set
    in cpu_possible_map).
    Signed-off-by: default avatarZwane Mwaikambo <zwane@arm.linux.org.uk>
    Signed-off-by: default avatarAlexander Nyberg <alexn@telia.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    4ad8d383
smp.h 2.18 KB