[PATCH] amdkfd: allow profiler process reenter
Zhu Lingshan <[email protected]> Thu, 6 Aug 2026 16:43:12 +0800
| Newsgroups | org.freedesktop.lists.amd-gfx |
|---|---|
| Message-ID | <[email protected]> |
profile_lock_device() currently returns -EALREADY when the current profiler process requests to lock the device again. However any negtive values here are treated as failure, so this causes rejecting a profiler operation even though the caller still owns the device locking. This commit fixes this problem by returning 0 when the current profiler process locking the device again. This commit also changes profile_lock_device() to return an int value other than uint32_t, because it returns negative number when fail. Signed-off-by: Zhu Lingshan <[email protected]> --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 309510e23315..9acd5c91e51c 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -3329,8 +3329,8 @@ static int kfd_ioctl_create_process(struct file *filep, struct kfd_process *p, v return 0; } -static inline uint32_t profile_lock_device(struct kfd_process *p, - uint32_t gpu_id, uint32_t op) +static inline int profile_lock_device(struct kfd_process *p, + uint32_t gpu_id, uint32_t op) { struct kfd_process_device *pdd; struct kfd_dev *kfd; @@ -3365,7 +3365,7 @@ static inline uint32_t profile_lock_device(struct kfd_process *p, } return status; } else if (kfd->profiler_process == p) { - status = -EALREADY; + status = 0; } else { status = -EBUSY; } -- 2.53.0