Module Name: src
Committed By: riastradh
Date: Sat Apr 9 23:43:31 UTC 2022
Modified Files:
src/sys/external/bsd/common/include/asm: barrier.h
src/sys/external/bsd/common/include/linux: compiler.h
src/sys/external/bsd/common/linux: linux_tasklet.c linux_work.c
Log Message:
linux: Convert various API shims to use membar_release/acquire.
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/common/include/asm/barrier.h
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/common/include/linux/compiler.h
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/common/linux/linux_tasklet.c
cvs rdiff -u -r1.60 -r1.61 src/sys/external/bsd/common/linux/linux_work.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/common/include/asm/barrier.h
diff -u src/sys/external/bsd/common/include/asm/barrier.h:1.12 src/sys/external/bsd/common/include/asm/barrier.h:1.13
--- src/sys/external/bsd/common/include/asm/barrier.h:1.12 Mon Dec 27 10:41:57 2021
+++ src/sys/external/bsd/common/include/asm/barrier.h Sat Apr 9 23:43:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: barrier.h,v 1.12 2021/12/27 10:41:57 riastradh Exp $ */
+/* $NetBSD: barrier.h,v 1.13 2022/04/09 23:43:30 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -68,8 +68,8 @@
#endif
#if defined(MULTIPROCESSOR) && !defined(__HAVE_ATOMIC_AS_MEMBAR)
-# define smp_mb__before_atomic() membar_exit()
-# define smp_mb__after_atomic() membar_sync() /* XXX acquire */
+# define smp_mb__before_atomic() membar_release()
+# define smp_mb__after_atomic() membar_acquire()
#else
# define smp_mb__before_atomic() __insn_barrier()
# define smp_mb__after_atomic() __insn_barrier()
Index: src/sys/external/bsd/common/include/linux/compiler.h
diff -u src/sys/external/bsd/common/include/linux/compiler.h:1.7 src/sys/external/bsd/common/include/linux/compiler.h:1.8
--- src/sys/external/bsd/common/include/linux/compiler.h:1.7 Thu Feb 17 01:21:02 2022
+++ src/sys/external/bsd/common/include/linux/compiler.h Sat Apr 9 23:43:31 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: compiler.h,v 1.7 2022/02/17 01:21:02 riastradh Exp $ */
+/* $NetBSD: compiler.h,v 1.8 2022/04/09 23:43:31 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
#define smp_store_release(X, V) do { \
typeof(X) __smp_store_release_tmp = (V); \
- membar_exit(); \
+ membar_release(); \
(X) = __write_once_tmp; \
} while (0)
Index: src/sys/external/bsd/common/linux/linux_tasklet.c
diff -u src/sys/external/bsd/common/linux/linux_tasklet.c:1.10 src/sys/external/bsd/common/linux/linux_tasklet.c:1.11
--- src/sys/external/bsd/common/linux/linux_tasklet.c:1.10 Mon Dec 27 14:57:30 2021
+++ src/sys/external/bsd/common/linux/linux_tasklet.c Sat Apr 9 23:43:31 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_tasklet.c,v 1.10 2021/12/27 14:57:30 riastradh Exp $ */
+/* $NetBSD: linux_tasklet.c,v 1.11 2022/04/09 23:43:31 riastradh Exp $ */
/*-
* Copyright (c) 2018, 2020, 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_tasklet.c,v 1.10 2021/12/27 14:57:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_tasklet.c,v 1.11 2022/04/09 23:43:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -245,7 +245,7 @@ tasklet_softintr(void *cookie)
/*
* Check whether it's currently disabled.
*
- * Pairs with membar_exit in __tasklet_enable.
+ * Pairs with membar_release in __tasklet_enable.
*/
if (atomic_load_acquire(&tasklet->tl_disablecount)) {
/*
@@ -394,9 +394,9 @@ tasklet_disable_nosync(struct tasklet_st
KASSERT(disablecount < UINT_MAX);
KASSERT(disablecount != 0);
- /* Pairs with membar_exit in __tasklet_enable. */
+ /* Pairs with membar_release in __tasklet_enable. */
#ifndef __HAVE_ATOMIC_AS_MEMBAR
- membar_enter();
+ membar_acquire();
#endif
}
@@ -514,9 +514,9 @@ tasklet_trylock(struct tasklet_struct *t
} while (atomic_cas_uint(&tasklet->tl_state, state,
state | TASKLET_RUNNING) != state);
- /* Pairs with membar_exit in tasklet_unlock. */
+ /* Pairs with membar_release in tasklet_unlock. */
#ifndef __HAVE_ATOMIC_AS_MEMBAR
- membar_enter();
+ membar_acquire();
#endif
return true;
@@ -536,11 +536,11 @@ tasklet_unlock(struct tasklet_struct *ta
KASSERT(atomic_load_relaxed(&tasklet->tl_state) & TASKLET_RUNNING);
/*
- * Pairs with membar_enter in tasklet_trylock and with
+ * Pairs with membar_acquire in tasklet_trylock and with
* atomic_load_acquire in tasklet_unlock_wait.
*/
#ifndef __HAVE_ATOMIC_AS_MEMBAR
- membar_exit();
+ membar_release();
#endif
atomic_and_uint(&tasklet->tl_state, ~TASKLET_RUNNING);
}
@@ -556,7 +556,7 @@ void
tasklet_unlock_wait(const struct tasklet_struct *tasklet)
{
- /* Pairs with membar_exit in tasklet_unlock. */
+ /* Pairs with membar_release in tasklet_unlock. */
while (atomic_load_acquire(&tasklet->tl_state) & TASKLET_RUNNING)
SPINLOCK_BACKOFF_HOOK;
}
@@ -589,9 +589,9 @@ __tasklet_disable_sync_once(struct taskl
KASSERT(disablecount < UINT_MAX);
KASSERT(disablecount != 0);
- /* Pairs with membar_exit in __tasklet_enable_sync_once. */
+ /* Pairs with membar_release in __tasklet_enable_sync_once. */
#ifndef __HAVE_ATOMIC_AS_MEMBAR
- membar_enter();
+ membar_acquire();
#endif
/*
@@ -613,9 +613,9 @@ __tasklet_enable_sync_once(struct taskle
{
unsigned int disablecount;
- /* Pairs with membar_enter in __tasklet_disable_sync_once. */
+ /* Pairs with membar_acquire in __tasklet_disable_sync_once. */
#ifndef __HAVE_ATOMIC_AS_MEMBAR
- membar_exit();
+ membar_release();
#endif
/* Decrement the disable count. */
@@ -681,10 +681,10 @@ __tasklet_enable(struct tasklet_struct *
* decrementing the disable count.
*
* Pairs with atomic_load_acquire in tasklet_softintr and with
- * membar_enter in tasklet_disable.
+ * membar_acquire in tasklet_disable.
*/
#ifndef __HAVE_ATOMIC_AS_MEMBAR
- membar_exit();
+ membar_release();
#endif
/* Decrement the disable count. */
Index: src/sys/external/bsd/common/linux/linux_work.c
diff -u src/sys/external/bsd/common/linux/linux_work.c:1.60 src/sys/external/bsd/common/linux/linux_work.c:1.61
--- src/sys/external/bsd/common/linux/linux_work.c:1.60 Fri Dec 31 14:30:20 2021
+++ src/sys/external/bsd/common/linux/linux_work.c Sat Apr 9 23:43:31 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_work.c,v 1.60 2021/12/31 14:30:20 riastradh Exp $ */
+/* $NetBSD: linux_work.c,v 1.61 2022/04/09 23:43:31 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.60 2021/12/31 14:30:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.61 2022/04/09 23:43:31 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -639,7 +639,7 @@ acquire_work(struct work_struct *work, s
owner0);
KASSERT(work_queue(work) == wq);
- membar_enter();
+ membar_acquire();
SDT_PROBE2(sdt, linux, work, acquire, work, wq);
return true;
}
@@ -660,7 +660,7 @@ release_work(struct work_struct *work, s
KASSERT(mutex_owned(&wq->wq_lock));
SDT_PROBE2(sdt, linux, work, release, work, wq);
- membar_exit();
+ membar_release();
/*
* Non-interlocked r/m/w is safe here because nobody else can