Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] drm/panfrost: missing PM runtime reference in
  panfrost_reset_work() [1]
--

commit 8ce48d8d6cacef2958a594210836f127d449cef8
Author: Arun Iyengar <[email protected]>

drm/panfrost: Don't resume a soft-stopped job after a GPU reset

This commit tracks GPU resets and fails soft-stopped jobs with -ECANCELED in
panfrost_job_run() if a GPU reset occurred after the job was stopped.

> diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c 
> b/drivers/gpu/drm/panfrost/panfrost_job.c
> index 3a46dd61cf87f..e1f3e5d717976 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_job.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_job.c

[ ... ]

> @@ -728,6 +741,7 @@ panfrost_reset(struct panfrost_device *pfdev,
>                       panfrost_devfreq_record_idle(&pfdev->pfdevfreq);
>               }
>       }
> +     pfdev->reset.count++;
>       memset(pfdev->jobs, 0, sizeof(pfdev->jobs));
>       spin_unlock(&pfdev->js->job_lock);

[Severity: Critical]
This problem wasn't introduced by this patch, but can panfrost_reset() access
hardware registers while the GPU is runtime suspended [1]?

Between panfrost_device_schedule_reset() queueing reset.work and the
workqueue executing panfrost_reset_work(), the active context can complete
and drop its runtime PM reference, allowing the GPU to suspend and gate its
clocks and power domains.  panfrost_reset_work() then calls panfrost_reset()
without holding a runtime PM reference:

drivers/gpu/drm/panfrost/panfrost_job.c:panfrost_reset_work() {
        struct panfrost_device *pfdev;

        pfdev = container_of(work, struct panfrost_device, reset.work);
        panfrost_reset(pfdev, NULL);
}

When panfrost_reset() writes to MMIO registers such as JOB_INT_MASK on the
powered-down device, it triggers a synchronous external abort.

[1] https://sashiko.dev/#/bug/linux-57c30678-e800-4756-b926-145408a6717d

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=4

Reply via email to