From: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
To: "Pan, Xinhui" <Xinhui.Pan@amd.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Koenig, Christian" <Christian.Koenig@amd.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>
Subject: Re: [PATCH] drm/amdgpu: Fix a deadlock if previous GEM object allocation fails
Date: Tue, 31 Aug 2021 00:03:55 -0400 [thread overview]
Message-ID: <0a52e64c-c5c7-ab65-4370-94374e2d0458@amd.com> (raw)
In-Reply-To: <DM4PR12MB5165AFECE854E6A4E82A05DF87CC9@DM4PR12MB5165.namprd12.prod.outlook.com>
On 2021-08-30 11:24 p.m., Pan, Xinhui wrote:
> [AMD Official Use Only]
>
> [AMD Official Use Only]
>
> Unreserve root BO before return otherwise next allocation got deadlock.
>
> Signed-off-by: xinhui pan <xinhui.pan@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 85b292ed5c43..c9db7d2c5816 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -355,19 +355,18 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
> DRM_DEBUG("Failed to allocate GEM object (%llu, %d, %llu, %d)\n",
> size, initial_domain, args->in.alignment, r);
> }
> +
> + if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID)
> + amdgpu_bo_unreserve(vm->root.bo);
> return r;
> }
>
> if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) {
> - if (!r) {
> - struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
> + struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
>
> - abo->parent = amdgpu_bo_ref(vm->root.bo);
> - }
> + abo->parent = amdgpu_bo_ref(vm->root.bo);
> amdgpu_bo_unreserve(vm->root.bo);
> }
> - if (r)
> - return r;
The above early return seems to be needed for -ERESTARTSYS case.
Andrey
>
> r = drm_gem_handle_create(filp, gobj, &handle);
> /* drop reference from allocate - handle holds it now */
> --
> 2.25.1
next prev parent reply other threads:[~2021-08-31 4:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-31 3:24 [PATCH] drm/amdgpu: Fix a deadlock if previous GEM object allocation fails Pan, Xinhui
2021-08-31 4:03 ` Andrey Grodzovsky [this message]
2021-08-31 5:38 ` Pan, Xinhui
2021-08-31 5:47 ` Pan, Xinhui
2021-08-31 6:19 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0a52e64c-c5c7-ab65-4370-94374e2d0458@amd.com \
--to=andrey.grodzovsky@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox