From: "Koenig, Christian" <Christian.Koenig-5C7GfCeVMHo@public.gmane.org>
To: "Grodzovsky,
Andrey" <Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org>,
"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: "Olsak, Marek" <Marek.Olsak-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH v3] drm/amdgpu: Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES
Date: Sun, 3 Feb 2019 15:51:28 +0000 [thread overview]
Message-ID: <2d32f38c-5ea7-d967-2a5d-bdc11fbb5e7b@amd.com> (raw)
In-Reply-To: <1549057286-31201-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
Am 01.02.19 um 22:41 schrieb Andrey Grodzovsky:
> New chunk for dependency on start of job's execution instead on
> the end. This is used for GPU deadlock prevention when
> userspace uses mid-IB fences to wait for mid-IB work on other rings.
>
> v2: Fix typo in AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES
> v3: Bump KMS version
>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> Suggested-by: Christian Koenig <Christian.Koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 12 +++++++++++-
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
> include/uapi/drm/amdgpu_drm.h | 1 +
> 3 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 1c49b82..3f21eca 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -214,6 +214,7 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs
> case AMDGPU_CHUNK_ID_DEPENDENCIES:
> case AMDGPU_CHUNK_ID_SYNCOBJ_IN:
> case AMDGPU_CHUNK_ID_SYNCOBJ_OUT:
> + case AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES:
> break;
>
> default:
> @@ -1090,6 +1091,14 @@ static int amdgpu_cs_process_fence_dep(struct amdgpu_cs_parser *p,
>
> fence = amdgpu_ctx_get_fence(ctx, entity,
> deps[i].handle);
> +
> + if (chunk->chunk_id == AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES) {
> + struct drm_sched_fence *s_fence = to_drm_sched_fence(fence);
> +
> + dma_fence_put(fence);
> + fence = dma_fence_get(&s_fence->scheduled);
You need to change the order here or otherwise the dma_fence_put could
destroy the fence we want.
Apart from that looks really good to me,
Christian.
> + }
> +
> if (IS_ERR(fence)) {
> r = PTR_ERR(fence);
> amdgpu_ctx_put(ctx);
> @@ -1177,7 +1186,8 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev,
>
> chunk = &p->chunks[i];
>
> - if (chunk->chunk_id == AMDGPU_CHUNK_ID_DEPENDENCIES) {
> + if (chunk->chunk_id == AMDGPU_CHUNK_ID_DEPENDENCIES ||
> + chunk->chunk_id == AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES) {
> r = amdgpu_cs_process_fence_dep(p, chunk);
> if (r)
> return r;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index c806f98..1158a6f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -71,9 +71,10 @@
> * - 3.25.0 - Add support for sensor query info (stable pstate sclk/mclk).
> * - 3.26.0 - GFX9: Process AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE.
> * - 3.27.0 - Add new chunk to to AMDGPU_CS to enable BO_LIST creation.
> + * - 3.28.0 - Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES
> */
> #define KMS_DRIVER_MAJOR 3
> -#define KMS_DRIVER_MINOR 27
> +#define KMS_DRIVER_MINOR 28
> #define KMS_DRIVER_PATCHLEVEL 0
>
> int amdgpu_vram_limit = 0;
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
> index faaad04..43d03a2 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -526,6 +526,7 @@ struct drm_amdgpu_gem_va {
> #define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04
> #define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05
> #define AMDGPU_CHUNK_ID_BO_HANDLES 0x06
> +#define AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES 0x07
>
> struct drm_amdgpu_cs_chunk {
> __u32 chunk_id;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-02-03 15:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-01 21:41 [PATCH v3] drm/amdgpu: Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES Andrey Grodzovsky
[not found] ` <1549057286-31201-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-02-03 15:51 ` Koenig, Christian [this message]
[not found] ` <2d32f38c-5ea7-d967-2a5d-bdc11fbb5e7b-5C7GfCeVMHo@public.gmane.org>
2019-02-04 15:45 ` Grodzovsky, Andrey
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=2d32f38c-5ea7-d967-2a5d-bdc11fbb5e7b@amd.com \
--to=christian.koenig-5c7gfcevmho@public.gmane.org \
--cc=Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org \
--cc=Marek.Olsak-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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