drm/amdkfd: fix a bug of smi event for superuser
authorEric Huang <jinhuieric.huang@amd.com>
Mon, 14 Apr 2025 15:19:01 +0000 (11:19 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 21 Apr 2025 14:54:44 +0000 (10:54 -0400)
rocm-smi with superuser permission doesn't show some
of smi events, i.e. page fault/migration, because the
condition of "(events & all)" is false. Superuser
should be able to detect all events, the condiiton of
"(events & all)" seems redundant, so removing it will
fix the issue.

Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
Reviewed-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c

index c27fd7aec1c3bab473f62a1c4c9b805f1f91d197..83d9384ac8156e24cdf6688b6e383a138356edf6 100644 (file)
@@ -163,10 +163,9 @@ static int kfd_smi_ev_release(struct inode *inode, struct file *filep)
 static bool kfd_smi_ev_enabled(pid_t pid, struct kfd_smi_client *client,
                               unsigned int event)
 {
-       uint64_t all = KFD_SMI_EVENT_MASK_FROM_INDEX(KFD_SMI_EVENT_ALL_PROCESS);
        uint64_t events = READ_ONCE(client->events);
 
-       if (pid && client->pid != pid && !(client->suser && (events & all)))
+       if (pid && client->pid != pid && !client->suser)
                return false;
 
        return events & KFD_SMI_EVENT_MASK_FROM_INDEX(event);