[AMD Official Use Only - AMD Internal Distribution Only] > -----Original Message----- > From: Pierre-Eric Pelloux-Prayer <[email protected]> > Sent: Monday, March 2, 2026 2:09 PM > To: SHANMUGAM, SRINIVASAN <[email protected]>; > Koenig, Christian <[email protected]>; Deucher, Alexander > <[email protected]> > Cc: [email protected]; Dan Carpenter <[email protected]>; > Pelloux-Prayer, Pierre-Eric <[email protected]> > Subject: Re: [PATCH] drm/amdgpu: Fix mutex handling in > amdgpu_benchmark_do_move() > > > > Le 28/02/2026 à 17:26, Srinivasan Shanmugam a écrit : > > amdgpu_benchmark_do_move() can exit the loop early if > > amdgpu_copy_buffer() or dma_fence_wait() fails. > > > > In the error path, the function jumps to the exit label without > > releasing adev->mman.default_entity.lock, which leaves the mutex held > > and results in a lock imbalance. > > > > This can block subsequent users of default_entity and potentially > > cause deadlocks. > > > > Move the mutex_unlock() to the common exit path so the lock is > > released on both success and error returns. > > > > This fixes: > > drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c:57 > > amdgpu_benchmark_do_move() > > warn: inconsistent returns '&adev->mman.default_entity.lock'. > > > > Fixes: 64c9e5ec16fa ("drm/amdgpu: add missing lock in > > amdgpu_benchmark_do_move") > > Reported-by: Dan Carpenter <[email protected]> > > Cc: Pierre-Eric Pelloux-Prayer <[email protected]> > > Cc: Christian König <[email protected]> > > Cc: Alex Deucher <[email protected]> > > Signed-off-by: Srinivasan Shanmugam <[email protected]> > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c > > index 98ccd7ab9e9a..024d1fe36716 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c > > @@ -33,7 +33,7 @@ static int amdgpu_benchmark_do_move(struct > amdgpu_device *adev, unsigned size, > > { > > ktime_t stime, etime; > > struct dma_fence *fence; > > - int i, r; > > + int i, r = 0; > > > > This change is unrelated. Other than that the commit looks good, thanks!
Thanks Pierre! I added r = 0 to avoid returning an uninitialized value when n == 0, but agree it’s orthogonal to the mutex fix. I’ll respin: drop that init for a minimal mutex-only fix. Srini > > Pierre-Eric
