• Srikar Dronamraju's avatar
    powerpc/smp: Reintroduce cpu_core_mask · c47f892d
    Srikar Dronamraju authored
    Daniel reported that with Commit 4ca234a9 ("powerpc/smp: Stop
    updating cpu_core_mask") QEMU was unable to set single NUMA node SMP
    topologies such as:
     -smp 8,maxcpus=8,cores=2,threads=2,sockets=2
     i.e he expected 2 sockets in one NUMA node.
    
    The above commit helped to reduce boot time on Large Systems for
    example 4096 vCPU single socket QEMU instance. PAPR is silent on
    having more than one socket within a NUMA node.
    
    cpu_core_mask and cpu_cpu_mask for any CPU would be same unless the
    number of sockets is different from the number of NUMA nodes.
    
    One option is to reintroduce cpu_core_mask but use a slightly
    different method to arrive at the cpu_core_mask. Previously each CPU's
    chip-id would be compared with all other CPU's chip-id to verify if
    both the CPUs were related at the chip level. Now if a CPU 'A' is
    found related / (unrelated) to another CPU 'B', all the thread
    siblings of 'A' and thread siblings of 'B' are automatically marked as
    related / (unrelated).
    
    Also if a platform doesn't support ibm,chip-id property, i.e its
    cpu_to_chip_id returns -1, cpu_core_map holds a copy of
    cpu_cpu_mask().
    
    Fixes: 4ca234a9 ("powerpc/smp: Stop updating cpu_core_mask")
    Reported-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
    Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
    Tested-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20210415120934.232271-2-srikar@linux.vnet.ibm.com
    c47f892d
smp.h 7.35 KB