[PATCH 2/2] drm/amdkfd: fix a bug of smi event for superuser

Russell, Kent Kent.Russell at amd.com
Mon Apr 14 15:36:16 UTC 2025


[Public]

Series is

Reviewed-by: Kent Russell <kent.russell at amd.com>



> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Eric Huang
> Sent: Monday, April 14, 2025 11:33 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Huang, JinHuiEric <JinHuiEric.Huang at amd.com>
> Subject: [PATCH 2/2] drm/amdkfd: fix a bug of smi event for superuser
>
> 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 at amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> index c27fd7aec1c3..83d9384ac815 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> @@ -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);
> --
> 2.34.1



More information about the amd-gfx mailing list