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/dist/drm/amd/amdgpu amdgpu: Read amdgp...



details:   https://anonhg.NetBSD.org/src/rev/492ff1f331fc
branches:  trunk
changeset: 1028984:492ff1f331fc
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:38:41 2021 +0000

description:
amdgpu: Read amdgpu_ctx_entity::sequence under the lock.

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r c9bc7e76a963 -r 492ff1f331fc sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c    Sun Dec 19 12:38:33 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c    Sun Dec 19 12:38:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_ctx.c,v 1.7 2021/12/19 12:31:45 riastradh Exp $ */
+/*     $NetBSD: amdgpu_ctx.c,v 1.8 2021/12/19 12:38:41 riastradh Exp $ */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ctx.c,v 1.7 2021/12/19 12:31:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ctx.c,v 1.8 2021/12/19 12:38:41 riastradh Exp $");
 
 #include <drm/drm_auth.h>
 #include "amdgpu.h"
@@ -463,18 +463,18 @@
                          struct dma_fence *fence, uint64_t* handle)
 {
        struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity);
-       uint64_t seq = centity->sequence;
+       uint64_t seq;
        struct dma_fence *other = NULL;
        unsigned idx = 0;
 
+       spin_lock(&ctx->ring_lock);
+       seq = centity->sequence;
        idx = seq & (amdgpu_sched_jobs - 1);
        other = centity->fences[idx];
        if (other)
                BUG_ON(!dma_fence_is_signaled(other));
 
        dma_fence_get(fence);
-
-       spin_lock(&ctx->ring_lock);
        centity->fences[idx] = fence;
        centity->sequence++;
        spin_unlock(&ctx->ring_lock);



Home | Main Index | Thread Index | Old Index