[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2] xen/arm64/atomic: Clear exclusive monitor on cmpxchg failure
- To: xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Ryoji Okamoto <okamoto@xxxxxxxxxxxxx>
- Date: Wed, 9 Sep 2026 15:12:53 +0900
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=valinux.co.jp; dmarc=pass action=none header.from=valinux.co.jp; dkim=pass header.d=valinux.co.jp; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6TPhRfSzE8LUkpcYp2RbKf88gop1wKnKgJwVM7D/+XY=; b=HUhPU2pcuXc6tua4n/ET1zge/QzRGekm8FEXKYuEJnbVmIvm8hmbmb5nGVb+Q1lmqM15YyFqqUtsbKMy5fZEUBTQpM2LrLPLVdUk1jnq33wPJX9+k90Gsfuq1QFO/ymksVJGrain2Z4abdnwh6bcF1Y4SPteQYOZVoVeo6JOW1lZ54viNv/1GW25Nkw5aJX4ZJRIUY2LHI8n4fLdaURGgmd0jVlnHqzGTYOz5LBzPgWwl6pKy96NB92tEHOKdozBpqiLFzvhR2Ar7mG0MZqPcuUcOUlcNiu3JXvFGafkdzNEqGl1VJe7Nf3lPnvAjeqygmJyG82MS2ubSa/RFC4XFA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x0Z2Zx7HDVWz2nOy00xZMSVWJ0v+ENpl/RYPM2LDAdcLa8Qxzyb12PXT/tLOxlgkQaSjotKl/6dn1DprR6qh+ZBrAYZ6RCX3Y4MMqNgAFu79fzwwwI7q/9ET0kvlL6rgOcSL1lPcF3yg6zyPLVY41cRigwe7/QjijkCt4Cw2xzRTVs0M1teyC102yDCtd3tf0m3TCrUvi541EU7vLS5RpjWJ/+08OO2sjgXauxve5LX9MOfdoMIzhF4yKuqSptAeUSVqHd8pNDsopGH4fQQTmbMHFzfOZwgXaPQRzvgH29WeaPMEucwP1MAW3pfzlPWYTjde+G9fVoL5cs2jVl7sRg==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=valinux.co.jp header.i="@valinux.co.jp" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=valinux.co.jp;
- Cc: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>, Ryoji Okamoto <okamoto@xxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Wed, 09 Sep 2026 06:13:14 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
When the value comparison fails in atomic_cmpxchg, the code branches
out without executing stxr, leaving the exclusive monitor in the
exclusive state set by ldxr.
Add `clrex` to the failure path to explicitly clear the exclusive
monitor.
Fixes: d2654a556835 ("xen: arm64: atomics")
Signed-off-by: Ryoji Okamoto <okamoto@xxxxxxxxxxxxx>
---
v2: Use tabs for indentation instead of spaces
xen/arch/arm/include/asm/arm64/atomic.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/xen/arch/arm/include/asm/arm64/atomic.h
b/xen/arch/arm/include/asm/arm64/atomic.h
index 4460165295..3aa0ffb4d9 100644
--- a/xen/arch/arm/include/asm/arm64/atomic.h
+++ b/xen/arch/arm/include/asm/arm64/atomic.h
@@ -118,7 +118,9 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int
new)
" b.ne 2f\n"
" stxr %w0, %w4, %2\n"
" cbnz %w0, 1b\n"
-"2:"
+" b 3f\n"
+"2: clrex\n"
+"3:"
: "=&r" (tmp), "=&r" (oldval), "+Q" (v->counter)
: "Ir" (old), "r" (new)
: "cc");
--
2.43.0
|