xen: arm: clear the exclusive monitor on exception return
authorIan Campbell <ian.campbell@citrix.com>
Wed, 17 Jul 2013 11:18:51 +0000 (12:18 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 19 Jul 2013 13:50:04 +0000 (14:50 +0100)
Otherwise context switching between two vcpus which are contending the same
lock can result in a spurious success.

Our spinlock and atomics code (which we get from Linux) rely on this behaviour
because they use non-exclusive stores for single instruction operations (e.g.
spin_unlock or atomic_set).

This is not required on ARMv8 since eret implicitly clears the monitor.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
xen/arch/arm/arm32/entry.S

index 76814dd5ebe0b1826eeb22bb4bb69e6e3d0c0579..1c26835474a43aae8c8e6758632e8d26490fd3cf 100644 (file)
@@ -117,6 +117,7 @@ ENTRY(return_to_hypervisor)
         msr SPSR_hyp, r11
         pop {r0-r12}
         add sp, #(UREGS_SP_usr - UREGS_sp); /* SP, LR, SPSR, PC */
+        clrex
         eret
 
 /*