[Intel-gfx] [PATCH] drm/i915/selftests: ditch the kernel context

Chris Wilson chris at chris-wilson.co.uk
Tue Oct 10 13:54:33 UTC 2017


Quoting Matthew Auld (2017-10-10 14:30:30)
> There's really no good reason to be using the kernel context for the
> huge-page livetests. Also with the introduction of commit bef27bdb6cfb
> ("drm/i915: Assert we do not try to expand VMA for hugepage inside GGTT")
> we start hitting the bug on in the selftests, since the kernel context
> will always return true for i915_vma_is_ggtt(), so now seems like the
> opportune time to instead create our own context.
> 

Also
Fixes: 4049866f0913 ("drm/i915/selftests: huge page tests")
> Fixes: bef27bdb6cfb ("drm/i915: Assert we do not try to expand VMA for hugepage inside GGTT")

I think it's worth saying that the explosion is a result of the two :)

> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/selftests/huge_pages.c | 57 +++++++++++++++++++----------
>  1 file changed, 38 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c
> index b8b9d0822199..c53f8474113a 100644
> --- a/drivers/gpu/drm/i915/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/selftests/huge_pages.c
> @@ -1047,10 +1047,10 @@ static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)
>         return err;
>  }
>  
> -static int igt_write_huge(struct drm_i915_gem_object *obj)
> +static int igt_write_huge(struct i915_gem_context *ctx,
> +                         struct drm_i915_gem_object *obj)

These all seem to follow through nicely.

> @@ -1707,9 +1711,24 @@ int i915_gem_huge_page_live_selftests(struct drm_i915_private *dev_priv)
>                 return 0;
>         }
>  
> +       file = mock_file(dev_priv);
> +       if (IS_ERR(file))
> +               return PTR_ERR(file);
> +
>         mutex_lock(&dev_priv->drm.struct_mutex);
> -       err = i915_subtests(tests, dev_priv);
> +
> +       ctx = live_context(dev_priv, file);
> +       if (IS_ERR(ctx)) {
> +               err = PTR_ERR(ctx);
> +               goto out_unlock;
> +       }
> +
> +       err = i915_subtests(tests, ctx);
> +
> +out_unlock:
>         mutex_unlock(&dev_priv->drm.struct_mutex);
>  
> +       mock_file_free(dev_priv, file);
> +
>         return err;

Oh, we could do s/dev_priv/i915/ here now.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the Intel-gfx mailing list