NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/58340: 64-bit atomic ops unusable for armv7: __HAVE_ATOMIC64_{OPS,LOADSTORE} confusion
>Number: 58340
>Category: kern
>Synopsis: 64-bit atomic ops unusable for armv7: __HAVE_ATOMIC64_{OPS,LOADSTORE} confusion
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jun 13 02:15:00 +0000 2024
>Originator: Rin Okuyama
>Release: 10.99.10 and 10.0
>Organization:
Internet Initiative Japan Inc.
>Environment:
NetBSD console 10.99.10 NetBSD 10.99.10 (SUNXI_NET_MPSAFE) #1: Thu Feb 8 23:00:33 JST 2024 rin@sakaizumii.local:/home/rin/src/sys/arch/evbarm/compile/SUNXI_NET_MPSAFE evbarm earmv7hfeb
>Description:
64-bit atomic ops provided by <sys/atomic.h> cannot be used for
armv7, even though __HAVE_ATOMIC64_OPS is defined for its
<machine/types.h>.
This is because for <sys/atomic.h>,
(1) __HAVE_ATOMIC64_LOADSTORE is defined ifdef _LP64, and
(2) 64-bit atomic ops are provided ifdef __HAVE_ATOMIC64_LOADSTORE.
>How-To-Repeat:
Try to use atomic_{load,store}_*(9) for armv7 kernel.
>Fix:
Check __HAVE_ATOMIC64_OPS, instead _LP64 for <sys/atomic.h>?
But, do we still need __HAVE_ATOMIC64_LOADSTORE?
diff --git a/sys/sys/atomic.h b/sys/sys/atomic.h
index 6c8af6d531e..fa92a7c3934 100644
--- a/sys/sys/atomic.h
+++ b/sys/sys/atomic.h
@@ -399,7 +399,9 @@ __END_DECLS
#include <lib/libkern/libkern.h>
-#ifdef _LP64
+#include <machine/types.h>
+
+#ifdef __HAVE_ATOMIC64_OPS
#define __HAVE_ATOMIC64_LOADSTORE 1
#define __ATOMIC_SIZE_MAX 8
#else
Home |
Main Index |
Thread Index |
Old Index