• David Daney's avatar
    MIPS: Make set_pte() SMP safe. · 204041c4
    David Daney authored
    [ Upstream commit 46011e6e
    
     ]
    
    On MIPS the GLOBAL bit of the PTE must have the same value in any
    aligned pair of PTEs.  These pairs of PTEs are referred to as
    "buddies".  In a SMP system is is possible for two CPUs to be calling
    set_pte() on adjacent PTEs at the same time.  There is a race between
    setting the PTE and a different CPU setting the GLOBAL bit in its
    buddy PTE.
    
    This race can be observed when multiple CPUs are executing
    vmap()/vfree() at the same time.
    
    Make setting the buddy PTE's GLOBAL bit an atomic operation to close
    the race condition.
    
    The case of CONFIG_64BIT_PHYS_ADDR && CONFIG_CPU_MIPS32 is *not*
    handled.
    Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
    Cc: <stable@vger.kernel.org>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/10835/
    
    Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
    204041c4
pgtable.h 16.2 KB