Re: [PATCH 1/2] drm/amdgpu: Fix sigsev when accessing MMIO on hot unplug.

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

 



Thanks, already did. Code pushed both here and in libdrm.

Andrey

On 2022-03-02 03:37, Christian König wrote:
Am 01.03.22 um 19:07 schrieb Andrey Grodzovsky:
Protect with drm_dev_enter/exit

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx>

Reviewed-by: Christian König <christian.koenig@xxxxxxx> for this one here.

Regarding the version bumb you should probably sync up with Alex.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index f522b52725e4..4294f17cedcb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -23,6 +23,7 @@
   */
    #include <drm/drm_auth.h>
+#include <drm/drm_drv.h>
  #include "amdgpu.h"
  #include "amdgpu_sched.h"
  #include "amdgpu_ras.h"
@@ -339,7 +340,7 @@ static void amdgpu_ctx_fini(struct kref *ref)
  {
      struct amdgpu_ctx *ctx = container_of(ref, struct amdgpu_ctx, refcount);
      struct amdgpu_device *adev = ctx->adev;
-    unsigned i, j;
+    unsigned i, j, idx;
        if (!adev)
          return;
@@ -350,7 +351,12 @@ static void amdgpu_ctx_fini(struct kref *ref)
              ctx->entities[i][j] = NULL;
          }
      }
-    amdgpu_ctx_set_stable_pstate(ctx, AMDGPU_CTX_STABLE_PSTATE_NONE);
+
+    if (drm_dev_enter(&adev->ddev, &idx)) {
+        amdgpu_ctx_set_stable_pstate(ctx, AMDGPU_CTX_STABLE_PSTATE_NONE);
+        drm_dev_exit(idx);
+    }
+
      kfree(ctx);
  }




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux