Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] drm/panfrost: Spurious drm_WARN_ON during GPU reset with active 
perfcnt
--

commit d9ae50cec3ff06c2a614193efb813114ed5ac709
Author: Boris Brezillon <[email protected]>
Date:   Thu Oct 15 18:22:31 2026 +0000

    drm/panfrost: Enable cycle counting when perfcnt is enabled

    If we don't do that, we end up with invalid timestamps in the block
    headers.

> diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c 
> b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> index a9def452d5ef9..b26da057a1a01 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c

[ ... ]

> @@ -84,6 +86,7 @@ static int panfrost_perfcnt_hw_enable(struct 
> panfrost_device *pfdev)
>               return ret;
>  
>       perfcnt->owns_as_ref = true;
> +     panfrost_cycle_counter_get(pfdev);

[Severity: Medium]
Will this cause a spurious drm_WARN_ON() during a GPU reset?

When a GPU reset is triggered (e.g. by a job timeout), panfrost_device_reset()
is called. This function calls panfrost_gpu_soft_reset() before it handles
the perfcnt state via panfrost_perfcnt_reset():

drivers/gpu/drm/panfrost/panfrost_device.c:panfrost_device_reset() {
    ...
        panfrost_gpu_soft_reset(pfdev);
    ...
        panfrost_perfcnt_reset(pfdev);
}

Inside panfrost_gpu_soft_reset(), it expects all cycle counter references
to be released:

drivers/gpu/drm/panfrost/panfrost_gpu.c:panfrost_gpu_soft_reset() {
    ...
        /*
         * All in-flight jobs should have released their cycle
         * counter references upon reset, but let us make sure
         */
        if (drm_WARN_ON(&pfdev->base, 
atomic_read(&pfdev->cycle_counter.use_count) != 0))
                atomic_set(&pfdev->cycle_counter.use_count, 0);
    ...
}

Because the perfcnt still holds the reference when panfrost_gpu_soft_reset()
is called, won't this trigger the drm_WARN_ON() and potentially panic the kernel
if panic_on_warn is enabled?

>  
>       as = ret;
>       cfg = GPU_PERFCNT_CFG_AS(as) |

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/20261015-panfrost-reset-races-fixes-v1-0-bb74c1786...@collabora.com?part=1

Reply via email to