From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: amd-gfx@lists.freedesktop.org, Marek.Olsak@amd.com
Cc: "Christian König" <christian.koenig@amd.com>
Subject: [PATCH 01/10] drm/amdgpu: install ctx entities with cmpxchg
Date: Thu, 3 Mar 2022 09:22:59 +0100 [thread overview]
Message-ID: <20220303082308.38217-2-christian.koenig@amd.com> (raw)
In-Reply-To: <20220303082308.38217-1-christian.koenig@amd.com>
Since we removed the context lock we need to make sure that not two threads
are trying to install an entity at the same time.
Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: e68efb27647f ("drm/amdgpu: remove ctx->lock")
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index c1f8b0e37b93..72c5f1c53d6b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -204,9 +204,15 @@ static int amdgpu_ctx_init_entity(struct amdgpu_ctx *ctx, u32 hw_ip,
if (r)
goto error_free_entity;
- ctx->entities[hw_ip][ring] = entity;
+ /* It's not an error if we fail to install the new entity */
+ if (cmpxchg(&ctx->entities[hw_ip][ring], NULL, entity))
+ goto cleanup_entity;
+
return 0;
+cleanup_entity:
+ drm_sched_entity_fini(&entity->entity);
+
error_free_entity:
kfree(entity);
--
2.25.1
next prev parent reply other threads:[~2022-03-03 8:23 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 8:22 Gang submit Christian König
2022-03-03 8:22 ` Christian König [this message]
2022-03-03 19:52 ` [PATCH 01/10] drm/amdgpu: install ctx entities with cmpxchg Andrey Grodzovsky
2022-03-03 8:23 ` [PATCH 02/10] drm/amdgpu: header cleanup Christian König
2022-03-03 19:56 ` Andrey Grodzovsky
2022-03-03 8:23 ` [PATCH 03/10] drm/amdgpu: cleanup and reorder amdgpu_cs.c Christian König
2022-03-03 8:23 ` [PATCH 04/10] drm/amdgpu: remove SRIOV and MCBP dependencies from the CS Christian König
2022-03-03 8:23 ` [PATCH 05/10] drm/amdgpu: use job and ib structures directly in CS parsers Christian König
2022-03-03 20:16 ` Andrey Grodzovsky
2022-03-03 8:23 ` [PATCH 06/10] drm/amdgpu: properly imbed the IBs into the job Christian König
2022-03-03 20:25 ` Andrey Grodzovsky
2022-03-03 8:23 ` [PATCH 07/10] drm/amdgpu: move setting the job resources Christian König
2022-03-03 8:23 ` [PATCH 08/10] drm/amdgpu: initialize the vmid_wait with the stub fence Christian König
2022-03-03 20:31 ` Andrey Grodzovsky
2022-03-03 8:23 ` [PATCH 09/10] drm/amdgpu: add gang submit backend Christian König
2022-03-04 17:10 ` Andrey Grodzovsky
2022-03-05 18:40 ` Christian König
2022-03-07 15:40 ` Andrey Grodzovsky
2022-03-07 15:59 ` Christian König
2022-03-07 16:02 ` Andrey Grodzovsky
2022-03-03 8:23 ` [PATCH 10/10] drm/amdgpu: add gang submit frontend Christian König
2022-03-07 17:02 ` Andrey Grodzovsky
2022-06-01 12:09 ` Mohan Marimuthu, Yogesh
2022-06-01 12:11 ` Christian König
2022-06-01 13:21 ` Mohan Marimuthu, Yogesh
2022-09-06 1:43 ` Gang submit Liu, Monk
2022-09-06 9:02 ` 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=20220303082308.38217-2-christian.koenig@amd.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Marek.Olsak@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
/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