• Catalin Marinas's avatar
    Clear the exclusive monitor when returning from an exception · 200b812d
    Catalin Marinas authored
    The patch adds a CLREX or dummy STREX to the exception return path. This
    is needed because several atomic/locking operations use a pair of
    LDREX/STREXEQ and the EQ condition may not always be satisfied. This
    would leave the exclusive monitor status set and may cause problems with
    atomic/locking operations in the interrupted code.
    
    With this patch, the atomic_set() operation can be a simple STR
    instruction (on SMP systems, the global exclusive monitor is cleared by
    STR anyway). Clearing the exclusive monitor during context switch is no
    longer needed as this is handled by the exception return path anyway.
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Reported-by: default avatarJamie Lokier <jamie@shareable.org>
    200b812d
atomic.h 4.96 KB