All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES
@ 2019-02-01 19:51 Andrey Grodzovsky
       [not found] ` <1549050670-18395-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Andrey Grodzovsky @ 2019-02-01 19:51 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Andrey Grodzovsky, Marek.Olsak-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo

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.

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 +++++++++++-
 include/uapi/drm/amdgpu_drm.h          |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 1c49b82..3c374ec 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_DEPENDENCIESD) {
+			struct drm_sched_fence *s_fence = to_drm_sched_fence(fence);
+
+			dma_fence_put(fence);
+			fence = dma_fence_get(&s_fence->scheduled);
+		}
+
 		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/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;
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* [PATCH v2] drm/amdgpu: Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES
       [not found] ` <1549050670-18395-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
@ 2019-02-01 19:59   ` Andrey Grodzovsky
       [not found]     ` <1549051196-25609-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Andrey Grodzovsky @ 2019-02-01 19:59 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Andrey Grodzovsky, Marek.Olsak-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo

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

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 +++++++++++-
 include/uapi/drm/amdgpu_drm.h          |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

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);
+		}
+
 		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/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;
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH v2] drm/amdgpu: Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES
       [not found]     ` <1549051196-25609-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
@ 2019-02-01 20:09       ` Marek Olšák
       [not found]         ` <CAAxE2A6EnRR4OUJkspWqdhDqHiJuTevW+=G+YycyOrnxtLGiuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Olšák @ 2019-02-01 20:09 UTC (permalink / raw)
  To: Andrey Grodzovsky
  Cc: Marek Olšák, Christian König, amd-gfx mailing list


[-- Attachment #1.1: Type: text/plain, Size: 3422 bytes --]

Reviewed-by: Marek Olšák <marek.olsak-5C7GfCeVMHo@public.gmane.org>
Tested-by: Marek Olšák <marek.olsak-5C7GfCeVMHo@public.gmane.org>

On Fri, Feb 1, 2019 at 3:00 PM Andrey Grodzovsky <andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
wrote:

> 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
>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
> Suggested-by: Christian Koenig <Christian.Koenig-5C7GfCeVMHo@public.gmane.org>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 12 +++++++++++-
>  include/uapi/drm/amdgpu_drm.h          |  1 +
>  2 files changed, 12 insertions(+), 1 deletion(-)
>
> 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);
> +               }
> +
>                 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/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;
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>

[-- Attachment #1.2: Type: text/html, Size: 4591 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH v2] drm/amdgpu: Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES
       [not found]         ` <CAAxE2A6EnRR4OUJkspWqdhDqHiJuTevW+=G+YycyOrnxtLGiuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-02-01 21:12           ` Marek Olšák
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Olšák @ 2019-02-01 21:12 UTC (permalink / raw)
  To: Andrey Grodzovsky
  Cc: Marek Olšák, Christian König, amd-gfx mailing list


[-- Attachment #1.1: Type: text/plain, Size: 3673 bytes --]

Can you also bump the KMS version?

Thanks,
Marek

On Fri, Feb 1, 2019 at 3:09 PM Marek Olšák <maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Reviewed-by: Marek Olšák <marek.olsak-5C7GfCeVMHo@public.gmane.org>
> Tested-by: Marek Olšák <marek.olsak-5C7GfCeVMHo@public.gmane.org>
>
> On Fri, Feb 1, 2019 at 3:00 PM Andrey Grodzovsky <
> andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org> wrote:
>
>> 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
>>
>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
>> Suggested-by: Christian Koenig <Christian.Koenig-5C7GfCeVMHo@public.gmane.org>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 12 +++++++++++-
>>  include/uapi/drm/amdgpu_drm.h          |  1 +
>>  2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> 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);
>> +               }
>> +
>>                 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/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;
>> --
>> 2.7.4
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>>
>

[-- Attachment #1.2: Type: text/html, Size: 5126 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2019-02-01 21:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-01 19:51 [PATCH] drm/amdgpu: Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES Andrey Grodzovsky
     [not found] ` <1549050670-18395-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-02-01 19:59   ` [PATCH v2] " Andrey Grodzovsky
     [not found]     ` <1549051196-25609-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-02-01 20:09       ` Marek Olšák
     [not found]         ` <CAAxE2A6EnRR4OUJkspWqdhDqHiJuTevW+=G+YycyOrnxtLGiuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-02-01 21:12           ` Marek Olšák

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.