Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2/linux Issue __insn_barrier in dma_fenc...



details:   https://anonhg.NetBSD.org/src/rev/e4b678a7d155
branches:  trunk
changeset: 1028097:e4b678a7d155
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:50:40 2021 +0000

description:
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.

diffstat:

 sys/external/bsd/drm2/linux/linux_dma_fence.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 76a4a6f1914a -r e4b678a7d155 sys/external/bsd/drm2/linux/linux_dma_fence.c
--- a/sys/external/bsd/drm2/linux/linux_dma_fence.c     Sun Dec 19 01:50:33 2021 +0000
+++ b/sys/external/bsd/drm2/linux/linux_dma_fence.c     Sun Dec 19 01:50:40 2021 +0000
@@ -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 @@
 dma_fence_get_rcu(struct dma_fence *fence)
 {
 
+       __insn_barrier();
        if (!kref_get_unless_zero(&fence->refcount))
                return NULL;
        return fence;



Home | Main Index | Thread Index | Old Index