AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yunxiang Li <Yunxiang.Li@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Alexander.Deucher@amd.com>, <christian.koenig@amd.com>,
	Yunxiang Li <Yunxiang.Li@amd.com>
Subject: [PATCH v4 8/9] drm/amdgpu: add lock in amdgpu_gart_invalidate_tlb
Date: Tue, 4 Jun 2024 21:33:17 -0400	[thread overview]
Message-ID: <20240605013318.11260-9-Yunxiang.Li@amd.com> (raw)
In-Reply-To: <20240605013318.11260-1-Yunxiang.Li@amd.com>

We need to take the reset domain lock before flush hdp. We can't put the
lock inside amdgpu_device_flush_hdp itself because it is used during
reset where we already take the write side lock.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
index eb172388d99e..256b95232de5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
@@ -34,6 +34,7 @@
 #include <asm/set_memory.h>
 #endif
 #include "amdgpu.h"
+#include "amdgpu_reset.h"
 #include <drm/drm_drv.h>
 #include <drm/ttm/ttm_tt.h>
 
@@ -405,7 +406,10 @@ void amdgpu_gart_invalidate_tlb(struct amdgpu_device *adev)
 		return;
 
 	mb();
-	amdgpu_device_flush_hdp(adev, NULL);
+	if (down_read_trylock(&adev->reset_domain->sem)) {
+		amdgpu_device_flush_hdp(adev, NULL);
+		up_read(&adev->reset_domain->sem);
+	}
 	for_each_set_bit(i, adev->vmhubs_mask, AMDGPU_MAX_VMHUBS)
 		amdgpu_gmc_flush_gpu_tlb(adev, 0, i, 0);
 }
-- 
2.34.1


  parent reply	other threads:[~2024-06-05  1:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  1:33 [PATCH v4 0/9] drm/amdgpu: prevent concurrent GPU access during reset Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 1/9] drm/amdgpu: add skip_hw_access checks for sriov Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 2/9] drm/amdgpu: fix sriov host flr handler Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 3/9] drm/amdgpu/kfd: remove is_hws_hang and is_resetting Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 4/9] drm/amdgpu: remove tlb flush in amdgpu_gtt_mgr_recover Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 5/9] drm/amdgpu: use helper in amdgpu_gart_unbind Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 6/9] drm/amdgpu: call flush_gpu_tlb directly in gfxhub enable Yunxiang Li
2024-06-05  8:00   ` Christian König
2024-06-05  1:33 ` [PATCH v4 7/9] drm/amdgpu: fix locking scope when flushing tlb Yunxiang Li
2024-06-05  1:33 ` Yunxiang Li [this message]
2024-06-05  1:33 ` [PATCH v4 9/9] drm/amdgpu: add lock in kfd_process_dequeue_from_device Yunxiang Li
2024-06-06 19:01   ` Felix Kuehling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240605013318.11260-9-Yunxiang.Li@amd.com \
    --to=yunxiang.li@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox