Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] The debugfs reset knob silently ignores manual reset requests if the 
GPU is idle or if the kernel is built without CONFIG_PM, returning success 
without performing the requested reset.
--

--- Patch [7]: [PATCH v5 07/11] drm/panfrost: Add debugfs knob for manually 
triggering a GPU reset ---
commit b4df81709774bfc91adda2d5d8e8a0109269e143
Author: Adrián Larumbe <[email protected]>

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

This commit adds a debugfs knob to manually trigger a GPU reset. This is
intended to help test potential races between the GPU reset sequence and
other parts of the code accessing HW registers.

> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c 
> b/drivers/gpu/drm/panfrost/panfrost_device.c
> index 52f4b8c6a05fe..5b66173c75b9b 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.c

[ ... ]

> +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) {
> +             panfrost_device_schedule_reset(pfdev);
> +             flush_work(&pfdev->reset.work);
> +             pm_runtime_put(pfdev->base.dev);
> +     }
> +
> +     return 0;

[Severity: Medium]
Will this silently ignore the manual reset request when the GPU is idle or if
CONFIG_PM is disabled?

If pm_runtime_get_if_in_use() returns <= 0, such as 0 when the device is idle
or -EINVAL when the kernel is built without CONFIG_PM, the reset is bypassed.
However, the function still returns 0 (success).

This could cause test scripts writing to this debugfs file to become flaky or
unreliable, as they will falsely assume the GPU was reset. Would it be better
to return an error code when the reset is skipped?

> +}

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

Reply via email to