Set_debug_trap ioctl should work on a specific kfd_process
even when multiple contexts feature is implemented.
For consistency, this commit allow set_debug_trap ioctl only work on the
primary kfd process of a user space program
Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
struct kfd_process_device *pdd = NULL;
int r = 0;
+ if (p->context_id != KFD_CONTEXT_ID_PRIMARY) {
+ pr_debug("Set debug trap ioctl can not be invoked on non-primary kfd process\n");
+
+ return -EOPNOTSUPP;
+ }
+
if (sched_policy == KFD_SCHED_POLICY_NO_HWS) {
pr_err("Debugging does not support sched_policy %i", sched_policy);
return -EINVAL;
goto out;
}
+ if (target->context_id != KFD_CONTEXT_ID_PRIMARY) {
+ pr_debug("Set debug trap ioctl not supported on non-primary kfd process\n");
+ r = -EOPNOTSUPP;
+ goto out;
+ }
+
/* Check if target is still PTRACED. */
rcu_read_lock();
if (target != p && args->op != KFD_IOC_DBG_TRAP_DISABLE