Public > -----Original Message----- > From: Jesse Zhang <[email protected]> > Sent: Wednesday, November 18, 2026 12:50 AM > To: [email protected] > Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix > <[email protected]>; Kim, Jonathan <[email protected]>; Zhang, > Jesse(Jie) <[email protected]> > Subject: [PATCH 2/3] drm/amdkfd: return the memory violation data to the > debugger > > 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. > > On navi48, 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") > Signed-off-by: Jesse Zhang <[email protected]>
Good catch. Thanks. This patch is Reviewed-by: Jonathan Kim <[email protected]> > --- > 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 f959f19d92d2..d57eebec063c 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c > @@ -1288,6 +1288,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
