Re: [PATCH v3 3/3] drm/panthor: Take reqs_lock in soft_reset for clearing pending_reqs
Boris Brezillon <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.comp.video.dri.devel |
|---|---|
| Organization | Collabora |
| Message-ID | <[email protected]> |
On Tue, 11 Aug 2026 16:08:33 +0200 Nicolas Frattaroli <[email protected]> wrote: > panthor_gpu_soft_reset() sets pending_reqs to 0 without taking the > requisite reqs_lock. > > Fix this by taking the lock for the duration of the modification. > > Fixes: 5cd894e258c4 ("drm/panthor: Add the GPU logical block") > Signed-off-by: Nicolas Frattaroli <[email protected]> > --- > drivers/gpu/drm/panthor/panthor_gpu.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c > index cb5319d1c5de..12e7e29b35b5 100644 > --- a/drivers/gpu/drm/panthor/panthor_gpu.c > +++ b/drivers/gpu/drm/panthor/panthor_gpu.c > @@ -405,7 +405,10 @@ int panthor_gpu_soft_reset(struct panthor_device *ptdev) > return -ETIMEDOUT; > } > > - ptdev->gpu->pending_reqs = 0; > + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { > + ptdev->gpu->pending_reqs = 0; > + } In practice, this happens when nothing else interacts with the GPU (IRQs have been suspended, and any access to the HW should be filtered out/delayed until the reset is effective), but I agree it's safer and more consistent to have this assigned done under the reqs_lock. Reviewed-by: Boris Brezillon <[email protected]>