All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] drm/amdkfd: don't flush the TLB of a device the process has no VM on
@ 2026-11-23  2:47 Jesse Zhang
  2026-11-23  2:47 ` [PATCH v3 2/3] drm/amdkfd: return the memory violation data to the debugger Jesse Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jesse Zhang @ 2026-11-23  2:47 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alexander.Deucher, Felix Kuehling, Jonathan Kim, Jesse Zhang

A process has a PDD for every device, also the ones it never acquired a
VM on, and pdd->drm_priv of those is NULL. kfd_flush_tlb() dereferences
it unconditionally, which is how suspend_queues() oopsed before the
previous patch.

Return early from kfd_flush_tlb() when there is no VM to flush, so no
caller can oops on such a PDD.

Suggested-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 30797e1886d9..e84e364b4d64 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -1608,7 +1608,13 @@ void kfd_signal_process_terminate_event(struct kfd_process *p);
 static inline void kfd_flush_tlb(struct kfd_process_device *pdd)
 {
 	struct amdgpu_device *adev = pdd->dev->adev;
-	struct amdgpu_vm *vm = drm_priv_to_vm(pdd->drm_priv);
+	struct amdgpu_vm *vm;
+
+	/* A PDD can exist before the process acquires a VM on this device. */
+	if (!pdd->drm_priv)
+		return;
+
+	vm = drm_priv_to_vm(pdd->drm_priv);
 
 	amdgpu_vm_flush_compute_tlb(adev, vm, TLB_FLUSH_HEAVYWEIGHT,
 				    pdd->dev->xcc_mask);
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-23 15:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23  2:47 [PATCH v3 1/3] drm/amdkfd: don't flush the TLB of a device the process has no VM on Jesse Zhang
2026-11-23  2:47 ` [PATCH v3 2/3] drm/amdkfd: return the memory violation data to the debugger Jesse Zhang
2026-11-23  2:47 ` [PATCH v3 3/3] drm/amdkfd: don't keep the debugger pointer when DBG_TRAP_ENABLE fails Jesse Zhang
2026-11-23  3:11   ` sashiko-bot
2026-11-23 15:08   ` Kim, Jonathan
2026-11-23  3:12 ` [PATCH v3 1/3] drm/amdkfd: don't flush the TLB of a device the process has no VM on sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.