Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] The debugfs reset knob silently fails when CONFIG_PM is disabled or 
when runtime PM is disabled for the device.
--

commit 306a309307e2e6679d0d0021abfa0cde0b693759
Author: Adrián Larumbe <[email protected]>

drm/panfrost: Add debugfs knob for manually triggering a GPU reset

This commit introduces a new debugfs interface to manually schedule a GPU
reset. This allows developers to test potential races between the reset
sequence and other hardware register accesses.

> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c 
> b/drivers/gpu/drm/panfrost/panfrost_device.c
> --- a/drivers/gpu/drm/panfrost/panfrost_device.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.c

[ ... ]

> @@ -599,9 +600,46 @@ EXPORT_GPL_DEV_PM_OPS(panfrost_pm_ops) = {
>  };
>  
>  #ifdef CONFIG_DEBUG_FS
> +static int reset_get(void *data, u64 *val)
> +{
> +     struct panfrost_device *pfdev =
> +             container_of(data, struct panfrost_device, base);
> +
> +     *val = atomic_read(&pfdev->reset.pending);
> +     return 0;
> +}
> +
> +static int reset_set(void *data, u64 val)
> +{
> +     struct panfrost_device *pfdev =
> +             container_of(data, struct panfrost_device, base);
> +     int ret;
> +
> +     ret = pm_runtime_get_if_in_use(pfdev->base.dev);
> +
> +     if (ret > 0) {

[Severity: Medium]
Does this strict condition handle configurations where power management is
disabled?

If the kernel is built without CONFIG_PM, or if runtime PM is disabled for
the device, pm_runtime_get_if_in_use() returns -EINVAL. Because the check
requires the return value to be strictly greater than 0, it will silently
skip the block.

Could this cause the debugfs reset knob to fail silently on these
configurations, making the testing capability unavailable without any
indication to the user?

> +             panfrost_device_schedule_reset(pfdev);
> +             flush_work(&pfdev->reset.work);
> +             pm_runtime_put(pfdev->base.dev);
> +     }
> +
> +     return 0;
> +}

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=10

Reply via email to