[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] xen/arm: mark __guest_cmpxchg always_inline


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Fri, 14 Apr 2023 14:57:12 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=z33OHiDZlWIHfUqu2WZ+dteJoaqpdcUN2xGgnP65iNE=; b=A3mE3zhgQQMTKZGlbzpiW3sBgba8XcUINhrq7m92V9Fvm+vTk0YrqswIrPi46ARpnEccJP8jIf2FGj/Qe2CEuVb92hyYD25GykGld5t1IREpXCS+AF7Yz86/tRmU89+LeltefTYNlU4E/JaPK7WRL3dFkDTvPbw4kQ5HICgydxOmSwGPV2Duhbffk8uybx5H1HIuNzK6EpI4SLgE1DXYtg2+wHisFd2cmCspWiAn/6qpJwj0XwgrWd8NYD3osLpWOpzDyDttMsbHMzTAeIFUksUISCc0vLmdXGO9WAXy0rANna9CRYDK3MJBwITEU2Jt7wOIQ8FJKTTXqMLZb0EX0A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZVHNIhQawx2IMLPEDwhhvyQ0AskgqeAeqibmTkNk0c73CcLlidKXboAqFzuqLznrR4S6rD0D11mXho7iarj6vuSLsQhq9QAfwW0PjzJD6RO3Y3P9MQIRtAY3R6CwmXXtS0ybmAdUilByhfQOsDebq6YxwiCCObFXAqBH5A7hpVLsq2HFZEIUqvs04DvAwmiyHszIh/CyAnjcElHtdf8swOmdfaFKBM1I+V83Lgz/p22QY5GRhHKf6GvdXpzNDkiJpVb/iEb4CLoeb+fi08MPvhigVDe4NhXt9thD+DI7CmLaOQLiLzfK4NWBZDUzfLA6tqwo2yPG0wPJqT4Jz6l4eA==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Fri, 14 Apr 2023 18:58:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When building the hypervisor with -Og, we run into a __bad_cmpxchg link error:

aarch64-none-linux-gnu-ld: prelink.o: in function `__int_cmpxchg':
.../xen/./arch/arm/include/asm/arm64/cmpxchg.h:117: undefined reference to 
`__bad_cmpxchg'
aarch64-none-linux-gnu-ld: .../xen/./arch/arm/include/asm/arm64/cmpxchg.h:117: 
undefined reference to `__bad_cmpxchg'
aarch64-none-linux-gnu-ld: ./.xen-syms.0: hidden symbol `__bad_cmpxchg' isn't 
defined
aarch64-none-linux-gnu-ld: final link failed: bad value

This is due to the function __guest_cmpxchg not being inlined in the -Og build
with gcc 12. Fix this by marking __guest_cmpxchg always_inline.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx
---
I considered also changing "guest_cmpxchg64" just below in the same file to
always_inline, but I decided not to because this function does not take a size
parameter.
---
 xen/arch/arm/include/asm/guest_atomics.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/include/asm/guest_atomics.h 
b/xen/arch/arm/include/asm/guest_atomics.h
index 9e2e96d4ff72..a1745f8613f6 100644
--- a/xen/arch/arm/include/asm/guest_atomics.h
+++ b/xen/arch/arm/include/asm/guest_atomics.h
@@ -86,11 +86,11 @@ static inline void guest_clear_mask16(struct domain *d, 
uint16_t mask,
     domain_unpause(d);
 }
 
-static inline unsigned long __guest_cmpxchg(struct domain *d,
-                                            volatile void *ptr,
-                                            unsigned long old,
-                                            unsigned long new,
-                                            unsigned int size)
+static always_inline unsigned long __guest_cmpxchg(struct domain *d,
+                                                   volatile void *ptr,
+                                                   unsigned long old,
+                                                   unsigned long new,
+                                                   unsigned int size)
 {
     unsigned long oldval = old;
 
-- 
2.40.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.