summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/amd/amdkfd
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-09-09 09:17:45 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-09-09 09:17:45 +0000
commite953f39c4eeae5e96cf4fa07ac5efcafccf3238d (patch)
treeb2b26f5758d1e616afb2e08b3c6d0475e3b547bc /sys/dev/pci/drm/amd/amdkfd
parent5e497fda67faad4b6d43011364e2c941a82c9d7f (diff)
drm/amdkfd: Check debug trap enable before write dbg_ev_file
From Lin.Cao e6ea3b8fe398915338147fe54dd2db8155fdafd8 in linux-6.6.y/6.6.50 547033b593063eb85bfdf9b25a5f1b8fd1911be2 in mainline linux
Diffstat (limited to 'sys/dev/pci/drm/amd/amdkfd')
-rw-r--r--sys/dev/pci/drm/amd/amdkfd/kfd_debug.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_debug.c b/sys/dev/pci/drm/amd/amdkfd/kfd_debug.c
index 9ec75066638..94aaf2fc556 100644
--- a/sys/dev/pci/drm/amd/amdkfd/kfd_debug.c
+++ b/sys/dev/pci/drm/amd/amdkfd/kfd_debug.c
@@ -103,7 +103,8 @@ void debug_event_write_work_handler(struct work_struct *work)
struct kfd_process,
debug_event_workarea);
- kernel_write(process->dbg_ev_file, &write_data, 1, &pos);
+ if (process->debug_trap_enabled && process->dbg_ev_file)
+ kernel_write(process->dbg_ev_file, &write_data, 1, &pos);
}
/* update process/device/queue exception status, write to descriptor
@@ -645,6 +646,7 @@ int kfd_dbg_trap_disable(struct kfd_process *target)
else if (target->runtime_info.runtime_state != DEBUG_RUNTIME_STATE_DISABLED)
target->runtime_info.runtime_state = DEBUG_RUNTIME_STATE_ENABLED;
+ cancel_work_sync(&target->debug_event_workarea);
fput(target->dbg_ev_file);
target->dbg_ev_file = NULL;