[Intel-gfx] [PATCH 2/9] drm: kselftest for drm_mm_reserve_node()

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Fri Dec 9 14:31:50 UTC 2016


On pe, 2016-12-09 at 13:08 +0000, Chris Wilson wrote:
> Exercise drm_mm_reserve_node(), check that we can't reserve an already
> occupied range and that the lists are correct after reserving/removing.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/drm_mm_selftests.h |   1 +
>  drivers/gpu/drm/test-drm_mm.c      | 143 +++++++++++++++++++++++++++++++++++++

Once there is more thorough coverage, I think we should have
drm/selftest/drm_mm.{h,c} 

> +static int __igt_reserve(int count, u64 size)
> +{
> +	struct drm_mm mm;
> +	struct drm_mm_node *node, *next;
> +	int *order, n;
> +	int ret;
> +
> +	/* Fill a range with lots of nodes, check it doesn't fail too early */
> +
> +	ret = -ENOMEM;
> +	order = random_order(count);
> +	if (!order)
> +		goto err;
> +
> +	ret = -EINVAL;
> +	drm_mm_init(&mm, 0, count * size);
> +	if (!drm_mm_clean(&mm)) {
> +		pr_err("mm not empty on creation\n");
> +		goto out;
> +	}

This code gets covered already done in more basic test, I think we
should avoid duplication from the start as we now have trouble with
runtime of tests.

> +static int igt_reserve(void *ignored)
> +{
> +	int n, ret;
> +
> +	for (n = 1; n < 50; n++) {

The right amount of loops might be something to discuss.

> +		ret = __igt_reserve(8192, (1ull << n) - 1);

BIT_ULL(n) - 1?

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list