Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] drm/v3d: counter pollution due to skipped job tracking with global 
perfmon
--

commit 16d01b295e0df230e5bdde84096f44906f1411fe
Author: Maíra Canal <[email protected]>

drm/v3d: Skip perfmon serialization while a global perfmon is set

A global perfmon counts concurrent activity from every job, so no dependency
is added while one is set. This patch skips the accumulator for the jobs
carrying no perfmon while a global perfmon is enabled.

> diff --git a/drivers/gpu/drm/v3d/v3d_submit.c 
> b/drivers/gpu/drm/v3d/v3d_submit.c
> index bc3c43fd4fd9e..7548faab67baa 100644
> --- a/drivers/gpu/drm/v3d/v3d_submit.c
> +++ b/drivers/gpu/drm/v3d/v3d_submit.c

[ ... ]

> @@ -375,11 +375,10 @@ v3d_serialize_for_perfmon(struct v3d_job *job)
>       if (!atomic_read(&v3d->perfmon_state.nperfmons))
>               return 0;
>  
> -     scoped_guard(spinlock_irqsave, &v3d->perfmon_state.lock)
> -             is_global_perfmon = !!v3d->global_perfmon;
> -
> -     if (is_global_perfmon)
> -             goto publish;
> +     scoped_guard(spinlock_irqsave, &v3d->perfmon_state.lock) {
> +             if (!job->perfmon && v3d->global_perfmon)
> +                     return 0;

[Severity: Medium]
Does this early return cause subsequent local perfmon jobs to overlap with
untracked ones?

If a user sets a global perfmon and a job without a local perfmon is
submitted, v3d_serialize_for_perfmon() returns early here. By skipping the
publish step, the job is never added to last_hw_fence.

If the global perfmon is subsequently cleared and a job with a local perfmon
is submitted, it will check last_hw_fence but won't find a dependency for
the previously untracked job.

Could this result in both jobs executing concurrently and polluting the
performance counters for the local perfmon?

> +     }
>  
>       if (job->perfmon) {

[ ... ]

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/20260921-v3d-quick-exit-perfmon-serialize-v1-0-e58aea107...@igalia.com?part=2

Reply via email to