From: Jesse Zhang <Jesse.Zhang@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Alexander.Deucher@amd.com>,
Felix Kuehling <Felix.Kuehling@amd.com>,
Jonathan Kim <jonathan.kim@amd.com>,
Jesse Zhang <Jesse.Zhang@amd.com>
Subject: [PATCH v3 2/3] drm/amdkfd: return the memory violation data to the debugger
Date: Mon, 23 Nov 2026 10:47:07 +0800 [thread overview]
Message-ID: <20261123024737.1475714-2-Jesse.Zhang@amd.com> (raw)
In-Reply-To: <20261123024737.1475714-1-Jesse.Zhang@amd.com>
kfd_dbg_ev_raise() saves the memory exception data of a GPU VM fault for a
debugger subscribed to EC_DEVICE_MEMORY_VIOLATION, but never sets
vm_fault_exc_data_size. QUERY_EXCEPTION_INFO copies that many bytes, so the
debugger always gets 0 bytes and no fault address.
With a process debugging itself and a KFD SDMA queue writing to an
unmapped VA:
amdgpu 0000:03:00.0: [gfxhub] page fault (src_id:0 ring:40 vmid:8 pasid:63)
amdgpu 0000:03:00.0: in page starting at address 0x0000000060200000 from client 10
amdgpu 0000:03:00.0: Faulty UTCL2 client ID: SDMA0 (0xd)
memory violation info: 0 bytes, va 0x0 gpu_id 0, fault at 0x60200000
With the size set:
memory violation info: 32 bytes, va 0x60200000 gpu_id 51573, fault at 0x60200000
The data is also only freed by a query clearing the exception, free it with
the process device as well.
Fixes: 2b36de971d25 ("drm/amdkfd: add debug query exception info operation")
Reviewed-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 4 +++-
drivers/gpu/drm/amd/amdkfd/kfd_process.c | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_debug.c b/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
index d5c87de519ac..14e7ee30cbdf 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
@@ -143,7 +143,9 @@ bool kfd_dbg_ev_raise(uint64_t event_mask,
exception_data,
exception_data_size,
GFP_KERNEL);
- if (!pdd->vm_fault_exc_data)
+ if (pdd->vm_fault_exc_data)
+ pdd->vm_fault_exc_data_size = exception_data_size;
+ else
pr_debug("Failed to allocate exception data memory");
} else {
pr_debug("Debugger exception data not saved\n");
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index aae2c698103e..44b11950b7db 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -1289,6 +1289,7 @@ static void kfd_process_destroy_pdds(struct kfd_process *p)
atomic_dec(&pdd->dev->kfd->kfd_processes_count);
mutex_destroy(&pdd->doorbell_mutex);
+ kfree(pdd->vm_fault_exc_data);
kfree(pdd);
p->pdds[i] = NULL;
}
--
2.50.1
next prev parent reply other threads:[~2026-11-23 2:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Jesse Zhang [this message]
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
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=20261123024737.1475714-2-Jesse.Zhang@amd.com \
--to=jesse.zhang@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=jonathan.kim@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 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.