Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2/include/linux Add Linux SMP a...
details: https://anonhg.NetBSD.org/src/rev/30d8827589cf
branches: riastradh-drm2
changeset: 788154:30d8827589cf
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 24 02:28:36 2013 +0000
description:
Add Linux SMP atomic inc/dec memory barriers to <linux/atomic.h>.
diffstat:
sys/external/bsd/drm2/include/linux/atomic.h | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diffs (33 lines):
diff -r 9a3b226cbf46 -r 30d8827589cf sys/external/bsd/drm2/include/linux/atomic.h
--- a/sys/external/bsd/drm2/include/linux/atomic.h Wed Jul 24 02:28:22 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/atomic.h Wed Jul 24 02:28:36 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic.h,v 1.1.2.7 2013/07/24 02:27:52 riastradh Exp $ */
+/* $NetBSD: atomic.h,v 1.1.2.8 2013/07/24 02:28:36 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -135,4 +135,23 @@
return (v & (1 << bit));
}
+#if defined(MULTIPROCESSOR) && !defined(__HAVE_ATOMIC_AS_MEMBAR)
+/*
+ * XXX These memory barriers are doubtless overkill, but I am having
+ * trouble understanding the intent and use of the Linux atomic membar
+ * API. I think that for reference counting purposes, the sequences
+ * should be insn/inc/enter and exit/dec/insn, but the use of the
+ * before/after memory barriers is not consistent throughout Linux.
+ */
+# define smp_mb__before_atomic_inc() membar_sync()
+# define smp_mb__after_atomic_inc() membar_sync()
+# define smp_mb__before_atomic_dec() membar_sync()
+# define smp_mb__after_atomic_dec() membar_sync()
+#else
+# define smp_mb__before_atomic_inc() __insn_barrier()
+# define smp_mb__after_atomic_inc() __insn_barrier()
+# define smp_mb__before_atomic_dec() __insn_barrier()
+# define smp_mb__after_atomic_dec() __insn_barrier()
+#endif
+
#endif /* _LINUX_ATOMIC_H_ */
Home |
Main Index |
Thread Index |
Old Index