diff mbox series

[i-g-t] igt/amdgpu_amd_prime: Bail if we fail to create more contexts

Message ID 20181213115703.24192-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [i-g-t] igt/amdgpu_amd_prime: Bail if we fail to create more contexts | expand

Commit Message

Chris Wilson Dec. 13, 2018, 11:57 a.m. UTC
amdgpu has started to report out of space after creating a few contexts.
This is not the scope of this test as here we just verifying that fences
created in amd can be imported and used for synchronisation by i915 and
for that we just need at least one context created!

References: https://bugs.freedesktop.org/show_bug.cgi?id=109049
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/amdgpu/amd_prime.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Antonio Argenziano Dec. 13, 2018, 3:28 p.m. UTC | #1
On 13/12/18 03:57, Chris Wilson wrote:
> amdgpu has started to report out of space after creating a few contexts.
> This is not the scope of this test as here we just verifying that fences
> created in amd can be imported and used for synchronisation by i915 and
> for that we just need at least one context created!
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=109049
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

LGTM.

Reviwed-by: Antonio Argenziano <antonio.argenziano@intel.com>

> ---
>   tests/amdgpu/amd_prime.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/amdgpu/amd_prime.c b/tests/amdgpu/amd_prime.c
> index bda0ce83d..518c88963 100644
> --- a/tests/amdgpu/amd_prime.c
> +++ b/tests/amdgpu/amd_prime.c
> @@ -354,8 +354,8 @@ static void amd_to_i915(int i915, int amd, amdgpu_device_handle device)

doesn't i915_to_amd have the same issue?

Antonio

>   			contexts = realloc(contexts, size * sizeof(*contexts));
>   		}
>   
> -		r = amdgpu_cs_ctx_create(device, &contexts[count]);
> -		igt_assert_eq(r, 0);
> +		if (amdgpu_cs_ctx_create(device, &contexts[count]))
> +			break;
>   
>   		r = amdgpu_cs_submit(contexts[count], 0, &ibs_request, 1);
>   		igt_assert_eq(r, 0);
> @@ -364,6 +364,7 @@ static void amd_to_i915(int i915, int amd, amdgpu_device_handle device)
>   	}
>   
>   	igt_info("Reservation width = %ld\n", count);
> +	igt_require(count);
>   
>   	amdgpu_bo_export(ib_result_handle,
>   			 amdgpu_bo_handle_type_dma_buf_fd,
>
Chris Wilson Dec. 13, 2018, 3:36 p.m. UTC | #2
Quoting Antonio Argenziano (2018-12-13 15:28:00)
> 
> 
> On 13/12/18 03:57, Chris Wilson wrote:
> > amdgpu has started to report out of space after creating a few contexts.
> > This is not the scope of this test as here we just verifying that fences
> > created in amd can be imported and used for synchronisation by i915 and
> > for that we just need at least one context created!
> > 
> > References: https://bugs.freedesktop.org/show_bug.cgi?id=109049
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> LGTM.
> 
> Reviwed-by: Antonio Argenziano <antonio.argenziano@intel.com>
> 
> > ---
> >   tests/amdgpu/amd_prime.c | 5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tests/amdgpu/amd_prime.c b/tests/amdgpu/amd_prime.c
> > index bda0ce83d..518c88963 100644
> > --- a/tests/amdgpu/amd_prime.c
> > +++ b/tests/amdgpu/amd_prime.c
> > @@ -354,8 +354,8 @@ static void amd_to_i915(int i915, int amd, amdgpu_device_handle device)
> 
> doesn't i915_to_amd have the same issue?

Only if you manage to run out of swap in 2s or used gen11. We don't like
to mention the feature improvements.
-Chris
Alex Deucher Dec. 13, 2018, 3:41 p.m. UTC | #3
On Thu, Dec 13, 2018 at 6:57 AM Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> amdgpu has started to report out of space after creating a few contexts.
> This is not the scope of this test as here we just verifying that fences
> created in amd can be imported and used for synchronisation by i915 and
> for that we just need at least one context created!
>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=109049
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  tests/amdgpu/amd_prime.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tests/amdgpu/amd_prime.c b/tests/amdgpu/amd_prime.c
> index bda0ce83d..518c88963 100644
> --- a/tests/amdgpu/amd_prime.c
> +++ b/tests/amdgpu/amd_prime.c
> @@ -354,8 +354,8 @@ static void amd_to_i915(int i915, int amd, amdgpu_device_handle device)
>                         contexts = realloc(contexts, size * sizeof(*contexts));
>                 }
>
> -               r = amdgpu_cs_ctx_create(device, &contexts[count]);
> -               igt_assert_eq(r, 0);
> +               if (amdgpu_cs_ctx_create(device, &contexts[count]))
> +                       break;
>
>                 r = amdgpu_cs_submit(contexts[count], 0, &ibs_request, 1);
>                 igt_assert_eq(r, 0);
> @@ -364,6 +364,7 @@ static void amd_to_i915(int i915, int amd, amdgpu_device_handle device)
>         }
>
>         igt_info("Reservation width = %ld\n", count);
> +       igt_require(count);
>
>         amdgpu_bo_export(ib_result_handle,
>                          amdgpu_bo_handle_type_dma_buf_fd,
> --
> 2.20.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Chris Wilson Dec. 13, 2018, 3:45 p.m. UTC | #4
Quoting Chris Wilson (2018-12-13 15:36:43)
> Quoting Antonio Argenziano (2018-12-13 15:28:00)
> > 
> > 
> > On 13/12/18 03:57, Chris Wilson wrote:
> > > amdgpu has started to report out of space after creating a few contexts.
> > > This is not the scope of this test as here we just verifying that fences
> > > created in amd can be imported and used for synchronisation by i915 and
> > > for that we just need at least one context created!
> > > 
> > > References: https://bugs.freedesktop.org/show_bug.cgi?id=109049
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > 
> > LGTM.
> > 
> > Reviwed-by: Antonio Argenziano <antonio.argenziano@intel.com>
> > 
> > > ---
> > >   tests/amdgpu/amd_prime.c | 5 +++--
> > >   1 file changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/tests/amdgpu/amd_prime.c b/tests/amdgpu/amd_prime.c
> > > index bda0ce83d..518c88963 100644
> > > --- a/tests/amdgpu/amd_prime.c
> > > +++ b/tests/amdgpu/amd_prime.c
> > > @@ -354,8 +354,8 @@ static void amd_to_i915(int i915, int amd, amdgpu_device_handle device)
> > 
> > doesn't i915_to_amd have the same issue?
> 
> Only if you manage to run out of swap in 2s or used gen11. We don't like
> to mention the feature improvements.

Actually, in i915 we use asynchronous destruction of contexts and so
immediately release the resources and can reallocate as required. But
amdgpu uses synchronous context destruction and so we have to hold on to
the context even though we only want to import the fence into i915.

If we run out of contexts here with i915 (even on icl), it's a kernel
bug.
-Chris
diff mbox series

Patch

diff --git a/tests/amdgpu/amd_prime.c b/tests/amdgpu/amd_prime.c
index bda0ce83d..518c88963 100644
--- a/tests/amdgpu/amd_prime.c
+++ b/tests/amdgpu/amd_prime.c
@@ -354,8 +354,8 @@  static void amd_to_i915(int i915, int amd, amdgpu_device_handle device)
 			contexts = realloc(contexts, size * sizeof(*contexts));
 		}
 
-		r = amdgpu_cs_ctx_create(device, &contexts[count]);
-		igt_assert_eq(r, 0);
+		if (amdgpu_cs_ctx_create(device, &contexts[count]))
+			break;
 
 		r = amdgpu_cs_submit(contexts[count], 0, &ibs_request, 1);
 		igt_assert_eq(r, 0);
@@ -364,6 +364,7 @@  static void amd_to_i915(int i915, int amd, amdgpu_device_handle device)
 	}
 
 	igt_info("Reservation width = %ld\n", count);
+	igt_require(count);
 
 	amdgpu_bo_export(ib_result_handle,
 			 amdgpu_bo_handle_type_dma_buf_fd,