• Paul Burton's avatar
    MIPS: Handle tlbex-tlbp race condition · f39878cc
    Paul Burton authored
    In systems where there are multiple actors updating the TLB, the
    potential exists for a race condition wherein a CPU hits a TLB exception
    but by the time it reaches a TLBP instruction the affected TLB entry may
    have been replaced. This can happen if, for example, a CPU shares the
    TLB between hardware threads (VPs) within a core and one of them
    replaces the entry that another has just taken a TLB exception for.
    
    We handle this race in the case of the Hardware Table Walker (HTW) being
    the other actor already, but didn't take into account the potential for
    multiple threads racing. Include the code for aborting TLB exception
    handling in affected multi-threaded systems, those being the I6400 &
    I6500 CPUs which share TLB entries between VPs.
    
    In the case of using RiXi without dedicated exceptions we have never
    handled this race even for HTW. This patch adds WARN()s to these cases
    which ought never to be hit because all CPUs with either HTW or shared
    FTLB RAMs also include dedicated RiXi exceptions, but the WARN()s will
    ensure this is always the case.
    Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/16203/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    f39878cc
tlbex.c 71.4 KB