mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm:amd:amdgpu: Fix missing bo unlock in failure path
@ 2023-04-24  5:59 Sukrut Bellary
  2023-04-24  7:07 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Sukrut Bellary @ 2023-04-24  5:59 UTC (permalink / raw)
  To: daniel, airlied, sumit.semwal, Hawking.Zhang, Julia.Lawall, dri-devel
  Cc: Sukrut Bellary, alexander.deucher, christian.koenig, Xinhui.Pan,
	amd-gfx, linux-kernel, linux-media, linaro-mm-sig

smatch warning - inconsistent handling of buffer object reserve
and unreserve.

Signed-off-by: Sukrut Bellary <sukrut.bellary@linux.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 278416acf060..5de44d7e92de 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -4686,8 +4686,10 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
 		return r;
 
 	r = amdgpu_bo_kmap(ring->mqd_obj, &ring->mqd_ptr);
-	if (unlikely(r != 0))
+	if (unlikely(r != 0)) {
+		amdgpu_bo_unreserve(ring->mqd_obj);
 		return r;
+	}
 
 	gfx_v8_0_kiq_init_queue(ring);
 	amdgpu_bo_kunmap(ring->mqd_obj);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm:amd:amdgpu: Fix missing bo unlock in failure path
  2023-04-24  5:59 [PATCH] drm:amd:amdgpu: Fix missing bo unlock in failure path Sukrut Bellary
@ 2023-04-24  7:07 ` Christian König
  2023-04-24 15:01   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2023-04-24  7:07 UTC (permalink / raw)
  To: Sukrut Bellary, daniel, airlied, sumit.semwal, Hawking.Zhang,
	Julia.Lawall, dri-devel
  Cc: alexander.deucher, Xinhui.Pan, amd-gfx, linux-kernel,
	linux-media, linaro-mm-sig

Am 24.04.23 um 07:59 schrieb Sukrut Bellary:
> smatch warning - inconsistent handling of buffer object reserve
> and unreserve.
>
> Signed-off-by: Sukrut Bellary <sukrut.bellary@linux.com>

For now that patch is Reviewed-by: Christian König 
<christian.koenig@amd.com>.

But for the record mapping/unmapping the MQD like this is a very bad 
idea in the first place.

We could need to shuffle memory around for that during resume and that 
is not something we really want to do.

Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index 278416acf060..5de44d7e92de 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -4686,8 +4686,10 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
>   		return r;
>   
>   	r = amdgpu_bo_kmap(ring->mqd_obj, &ring->mqd_ptr);
> -	if (unlikely(r != 0))
> +	if (unlikely(r != 0)) {
> +		amdgpu_bo_unreserve(ring->mqd_obj);
>   		return r;
> +	}
>   
>   	gfx_v8_0_kiq_init_queue(ring);
>   	amdgpu_bo_kunmap(ring->mqd_obj);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm:amd:amdgpu: Fix missing bo unlock in failure path
  2023-04-24  7:07 ` Christian König
@ 2023-04-24 15:01   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2023-04-24 15:01 UTC (permalink / raw)
  To: Christian König
  Cc: Sukrut Bellary, daniel, airlied, sumit.semwal, Hawking.Zhang,
	Julia.Lawall, dri-devel, Xinhui.Pan, linux-kernel, amd-gfx,
	linaro-mm-sig, alexander.deucher, linux-media

On Mon, Apr 24, 2023 at 3:07 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 24.04.23 um 07:59 schrieb Sukrut Bellary:
> > smatch warning - inconsistent handling of buffer object reserve
> > and unreserve.
> >
> > Signed-off-by: Sukrut Bellary <sukrut.bellary@linux.com>
>
> For now that patch is Reviewed-by: Christian König
> <christian.koenig@amd.com>.

Applied.  Thanks.

>
> But for the record mapping/unmapping the MQD like this is a very bad
> idea in the first place.
>
> We could need to shuffle memory around for that during resume and that
> is not something we really want to do.

We should probably just keep the MQDs mapped.  On suspend we need to
save out the MQD state so it can be restored on resume when the MQDs
are in vram.

Alex

>
> Christian.
>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > index 278416acf060..5de44d7e92de 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > @@ -4686,8 +4686,10 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)
> >               return r;
> >
> >       r = amdgpu_bo_kmap(ring->mqd_obj, &ring->mqd_ptr);
> > -     if (unlikely(r != 0))
> > +     if (unlikely(r != 0)) {
> > +             amdgpu_bo_unreserve(ring->mqd_obj);
> >               return r;
> > +     }
> >
> >       gfx_v8_0_kiq_init_queue(ring);
> >       amdgpu_bo_kunmap(ring->mqd_obj);
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-24 15:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-24  5:59 [PATCH] drm:amd:amdgpu: Fix missing bo unlock in failure path Sukrut Bellary
2023-04-24  7:07 ` Christian König
2023-04-24 15:01   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®