Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 01:50:40 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/linux: linux_dma_fence.c

Log Message:
Issue __insn_barrier in dma_fence_get_rcu.

This way it is safe to use as dma_fence_get_rcu(*p) when concurrent
writes to *p might be happening, so that we load *p only once before
using the value.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/linux/linux_dma_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_dma_fence.c
diff -u src/sys/external/bsd/drm2/linux/linux_dma_fence.c:1.7 src/sys/external/bsd/drm2/linux/linux_dma_fence.c:1.8
--- src/sys/external/bsd/drm2/linux/linux_dma_fence.c:1.7	Sun Dec 19 01:48:22 2021
+++ src/sys/external/bsd/drm2/linux/linux_dma_fence.c	Sun Dec 19 01:50:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_dma_fence.c,v 1.7 2021/12/19 01:48:22 riastradh Exp $	*/
+/*	$NetBSD: linux_dma_fence.c,v 1.8 2021/12/19 01:50:40 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.7 2021/12/19 01:48:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.8 2021/12/19 01:50:40 riastradh Exp $");
 
 #include <sys/atomic.h>
 #include <sys/condvar.h>
@@ -196,6 +196,7 @@ struct dma_fence *
 dma_fence_get_rcu(struct dma_fence *fence)
 {
 
+	__insn_barrier();
 	if (!kref_get_unless_zero(&fence->refcount))
 		return NULL;
 	return fence;

Reply via email to