From 093ddf770f2dc8ebd1c690ea15b8d68b5a4f67da Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 31 Mar 2022 02:20:23 +0000 Subject: [PATCH 29/49] drm: Convert membar_enter/exit stragglers to membar_acquire/release. --- sys/external/bsd/drm2/linux/linux_dma_buf.c | 4 ++-- sys/external/bsd/drm2/linux/linux_dma_fence.c | 4 ++-- sys/external/bsd/drm2/linux/linux_dma_fence_chain.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/external/bsd/drm2/linux/linux_dma_buf.c b/sys/external/bsd/drm2/linux/linux_dma_buf.c index 4acccf3b490b..e7c3fc1ea16d 100644 --- a/sys/external/bsd/drm2/linux/linux_dma_buf.c +++ b/sys/external/bsd/drm2/linux/linux_dma_buf.c @@ -160,10 +160,10 @@ void dma_buf_put(struct dma_buf *dmabuf) { - membar_exit(); + membar_release(); if (atomic_dec_uint_nv(&dmabuf->db_refcnt) != 0) return; - membar_enter(); + membar_acquire(); dma_resv_poll_fini(&dmabuf->db_resv_poll); mutex_destroy(&dmabuf->db_lock); diff --git a/sys/external/bsd/drm2/linux/linux_dma_fence.c b/sys/external/bsd/drm2/linux/linux_dma_fence.c index 9f1a2ad96da4..09626f9f7a25 100644 --- a/sys/external/bsd/drm2/linux/linux_dma_fence.c +++ b/sys/external/bsd/drm2/linux/linux_dma_fence.c @@ -245,9 +245,9 @@ dma_fence_context_alloc(unsigned n) } S; uint64_t c; - while (__predict_false(atomic_cas_uint(&S.lock, 0, 1) != 0)) + while (__predict_false(atomic_swap_uint(&S.lock, 1))) SPINLOCK_BACKOFF_HOOK; - membar_enter(); + membar_acquire(); c = S.context; S.context += n; atomic_store_release(&S.lock, 0); diff --git a/sys/external/bsd/drm2/linux/linux_dma_fence_chain.c b/sys/external/bsd/drm2/linux/linux_dma_fence_chain.c index 2e1ae92efb90..7c1dda93894e 100644 --- a/sys/external/bsd/drm2/linux/linux_dma_fence_chain.c +++ b/sys/external/bsd/drm2/linux/linux_dma_fence_chain.c @@ -262,7 +262,7 @@ dma_fence_chain_walk(struct dma_fence *fence) break; splice = NULL; } - membar_exit(); /* pairs with dma_fence_get_rcu_safe */ + membar_release(); /* pairs with dma_fence_get_rcu_safe */ if (atomic_cas_ptr(&chain->dfc_prev, prev, splice) == prev) dma_fence_put(prev); /* transferred to splice */ else