• Tejun Heo's avatar
    percpu: fix pcpu_last_unit_cpu · 46b30ea9
    Tejun Heo authored
    pcpu_first/last_unit_cpu are used to track which cpu has the first and
    last units assigned.  This in turn is used to determine the span of a
    chunk for man/unmap cache flushes and whether an address belongs to
    the first chunk or not in per_cpu_ptr_to_phys().
    
    When the number of possible CPUs isn't power of two, a chunk may
    contain unassigned units towards the end of a chunk.  The logic to
    determine pcpu_last_unit_cpu was incorrect when there was an unused
    unit at the end of a chunk.  It failed to ignore the unused unit and
    assigned the unused marker NR_CPUS to pcpu_last_unit_cpu.
    
    This was discovered through kdump failure which was caused by
    malfunctioning per_cpu_ptr_to_phys() on a kvm setup with 50 possible
    CPUs by CAI Qian.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Reported-by: default avatarCAI Qian <caiqian@redhat.com>
    Cc: stable@kernel.org
    46b30ea9
percpu.c 53.7 KB