Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/common/include/linux linux/compiler.h: Add ...



details:   https://anonhg.NetBSD.org/src/rev/8a42a6c30d14
branches:  trunk
changeset: 368512:8a42a6c30d14
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jul 17 08:34:00 2022 +0000

description:
linux/compiler.h: Add missing barriers in READ_ONCE, WRITE_ONCE.

diffstat:

 sys/external/bsd/common/include/linux/compiler.h |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r 61c0b2af279a -r 8a42a6c30d14 sys/external/bsd/common/include/linux/compiler.h
--- a/sys/external/bsd/common/include/linux/compiler.h  Sun Jul 17 08:33:48 2022 +0000
+++ b/sys/external/bsd/common/include/linux/compiler.h  Sun Jul 17 08:34:00 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compiler.h,v 1.8 2022/04/09 23:43:31 riastradh Exp $   */
+/*     $NetBSD: compiler.h,v 1.9 2022/07/17 08:34:00 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -62,6 +62,7 @@
        BUILD_BUG_ON_ZERO(__same_type((X), &(X)[0]))
 
 #define        READ_ONCE(X)    ({                                                    \
+       __insn_barrier();                                                     \
        typeof(X) __read_once_tmp = (X);                                      \
        membar_datadep_consumer();                                            \
        __read_once_tmp;                                                      \
@@ -69,7 +70,9 @@
 
 #define        WRITE_ONCE(X, V)        ({                                            \
        typeof(X) __write_once_tmp = (V);                                     \
+       __insn_barrier();                                                     \
        (X) = __write_once_tmp;                                               \
+       __insn_barrier();                                                     \
        __write_once_tmp;                                                     \
 })
 



Home | Main Index | Thread Index | Old Index