[Intel-gfx] [PATCH 6/6] drm/i915/selftests: prefer random sizes for the huge-GTT-page smoke tests

Chris Wilson chris at chris-wilson.co.uk
Fri Oct 18 22:43:18 UTC 2019


Quoting Matthew Auld (2019-10-18 17:55:58)
> Ditch the dubious static list of sizes to enumerate, in favour of
> choosing a random size within the limits of each backing store. With
> repeated CI runs this should give us a wider range of object sizes, and
> in turn more page-size combinations, while using less machine time.
> 
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> ---
>  .../gpu/drm/i915/gem/selftests/huge_pages.c   | 198 +++++++++---------
>  1 file changed, 94 insertions(+), 104 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> index d4892769b739..3f7ac4473f33 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> @@ -1314,20 +1314,33 @@ static int igt_ppgtt_exhaust_huge(void *arg)
>         return err;
>  }
>  
> +static u32 igt_random_size(struct rnd_state *prng,
> +                          u32 min_page_size,
> +                          u32 max_page_size)
> +{
> +       u32 size;
> +       u32 mask;
> +
> +       GEM_BUG_ON(!is_power_of_2(min_page_size));
> +       GEM_BUG_ON(!is_power_of_2(max_page_size));
> +       GEM_BUG_ON(min_page_size < PAGE_SIZE);
> +       GEM_BUG_ON(min_page_size > max_page_size);
> +
> +       mask = GENMASK_ULL(ilog2(max_page_size), PAGE_SHIFT);

mask = (max_page_size - 1) & PAGE_MASK;

Easier to understand?

> +       size = prandom_u32_state(prng) & mask;
> +       if (size < min_page_size)
> +               size |= min_page_size;
> +
> +       return size;
> +}
> +
>  static int igt_ppgtt_internal_huge(void *arg)
>  {
>         struct i915_gem_context *ctx = arg;
>         struct drm_i915_private *i915 = ctx->i915;
>         struct drm_i915_gem_object *obj;
> -       static const unsigned int sizes[] = {
> -               SZ_64K,
> -               SZ_128K,
> -               SZ_256K,
> -               SZ_512K,
> -               SZ_1M,
> -               SZ_2M,
> -       };
> -       int i;
> +       I915_RND_STATE(prng);
> +       u32 size;
>         int err;

I skipped to the final patch. Did you also leave in checking of the usual
suspects?

The randomised smoketesting looks good,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

The only question being whether we can do some limited smart testing to
catch the most likely bugs.
-Chris


More information about the Intel-gfx mailing list