Module Name: src
Committed By: riastradh
Date: Mon Aug 27 15:11:33 UTC 2018
Modified Files:
src/sys/external/bsd/drm2/include/linux: ww_mutex.h
src/sys/external/bsd/drm2/linux: linux_ww_mutex.c
Log Message:
Use Linux atomic64 for ww mutex class.
This way we can take advantage of the hash-locked atomic64 on
platforms that lack native atomic_inc_64_nv.
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/include/linux/ww_mutex.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/linux/linux_ww_mutex.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/drm2/include/linux/ww_mutex.h
diff -u src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.12 src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.13
--- src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.12 Mon Aug 27 06:06:41 2018
+++ src/sys/external/bsd/drm2/include/linux/ww_mutex.h Mon Aug 27 15:11:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ww_mutex.h,v 1.12 2018/08/27 06:06:41 riastradh Exp $ */
+/* $NetBSD: ww_mutex.h,v 1.13 2018/08/27 15:11:32 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -37,15 +37,16 @@
#include <sys/mutex.h>
#include <sys/rbtree.h>
+#include <linux/atomic.h>
#include <linux/mutex.h>
struct ww_class {
- volatile uint64_t wwc_ticket;
+ atomic64_t wwc_ticket;
};
#define DEFINE_WW_CLASS(CLASS) \
struct ww_class CLASS = { \
- .wwc_ticket = 0, \
+ .wwc_ticket = ATOMIC64_INIT(0), \
}
struct ww_acquire_ctx {
Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.4 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.5
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.4 Sat Sep 16 23:56:42 2017
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c Mon Aug 27 15:11:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ww_mutex.c,v 1.4 2017/09/16 23:56:42 christos Exp $ */
+/* $NetBSD: linux_ww_mutex.c,v 1.5 2018/08/27 15:11:32 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.4 2017/09/16 23:56:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.5 2018/08/27 15:11:32 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -92,7 +92,7 @@ ww_acquire_init(struct ww_acquire_ctx *c
ctx->wwx_class = class;
ctx->wwx_owner = curlwp;
- ctx->wwx_ticket = atomic_inc_64_nv(&class->wwc_ticket);
+ ctx->wwx_ticket = atomic64_inc_return(&class->wwc_ticket);
ctx->wwx_acquired = 0;
ctx->wwx_acquire_done = false;
}