Module Name: src
Committed By: riastradh
Date: Tue Aug 28 15:04:02 UTC 2018
Modified Files:
src/sys/external/bsd/drm2/linux: linux_fence.c
Log Message:
Issue __insn_barrier after loading hardclock_ticks.
For some reason this isn't volatile...
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/linux/linux_fence.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/linux/linux_fence.c
diff -u src/sys/external/bsd/drm2/linux/linux_fence.c:1.11 src/sys/external/bsd/drm2/linux/linux_fence.c:1.12
--- src/sys/external/bsd/drm2/linux/linux_fence.c:1.11 Tue Aug 28 15:03:39 2018
+++ src/sys/external/bsd/drm2/linux/linux_fence.c Tue Aug 28 15:04:02 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_fence.c,v 1.11 2018/08/28 15:03:39 riastradh Exp $ */
+/* $NetBSD: linux_fence.c,v 1.12 2018/08/28 15:04:02 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.11 2018/08/28 15:03:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.12 2018/08/28 15:04:02 riastradh Exp $");
#include <sys/atomic.h>
#include <sys/condvar.h>
@@ -543,6 +543,7 @@ fence_wait_any_timeout(struct fence **fe
mutex_enter(&common.lock);
while (timeout > 0 && !common.done) {
start = hardclock_ticks;
+ __insn_barrier();
if (intr) {
if (timeout != MAX_SCHEDULE_TIMEOUT) {
ret = -cv_timedwait_sig(&common.cv,
@@ -562,6 +563,7 @@ fence_wait_any_timeout(struct fence **fe
}
}
end = hardclock_ticks;
+ __insn_barrier();
if (ret)
break;
timeout -= MIN(timeout, (unsigned)end - (unsigned)start);
@@ -672,6 +674,7 @@ fence_default_wait(struct fence *fence,
/* Find out what our deadline is so we can handle spurious wakeup. */
if (timeout < MAX_SCHEDULE_TIMEOUT) {
now = hardclock_ticks;
+ __insn_barrier();
starttime = now;
deadline = starttime + timeout;
}
@@ -684,6 +687,7 @@ fence_default_wait(struct fence *fence,
*/
if (timeout < MAX_SCHEDULE_TIMEOUT) {
now = hardclock_ticks;
+ __insn_barrier();
if (deadline <= now)
break;
}