Re: [PATCH 09/34] drm: kselftest for drm_mm_insert_node()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On ma, 2016-12-12 at 11:53 +0000, Chris Wilson wrote:
> Exercise drm_mm_insert_node(), check that we can't overfill a range and
> that the lists are correct after reserving/removing.
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

<SNIP>

> +static int __igt_insert(int count, u64 size)
> +{

<SNIP>

> +	for (n = 0; n < count; n++) {
> +		int err;
> +
> +		node = &nodes[n];
> +		err = drm_mm_insert_node(&mm, node, size, 0,
> +					 DRM_MM_SEARCH_DEFAULT);
> +		if (err) {
> +			pr_err("insert failed, step %d, start %llu\n",
> +			       n, nodes[n].start);
> +			ret = err;
> +			goto out;
> +		}
> +
> +		if (!drm_mm_node_allocated(node)) {
> +			pr_err("inserted node not allocated! step %d, start %llu\n",
> +			       n, node->start);
> +			goto out;
> +		}
> +	}
> +
> +	/* Repeated use should then fail */
> +	if (1) {

Why if (1)? What are you not telling me.

<SNIP>

> +		if (1) {

Ditto.

> +			struct drm_mm_node tmp;
> +
> +			memset(&tmp, 0, sizeof(tmp));
> +			if (!drm_mm_insert_node(&mm, &tmp, size, 0,
> +						DRM_MM_SEARCH_DEFAULT)) {
> +				drm_mm_remove_node(&tmp);
> +				pr_err("impossible insert succeeded, start %llu\n",
> +				       tmp.start);
> +				goto out;
> +			}
> +		}
> +

Second instance of the code below, could be helper?

> +		m = 0;
> +		drm_mm_for_each_node(node, &mm) {
> +			if (node->start != m * size) {
> +				pr_err("node %d out of order, expected start %llx, found %llx\n",
> +				       m, m * size, node->start);
> +				goto out;
> +			}
> +
> +			if (node->size != size) {
> +				pr_err("node %d has wrong size, expected size %llx, found %llx\n",
> +				       m, size, node->size);
> +				goto out;
> +			}
> +
> +			if (node->hole_follows) {
> +				pr_err("node %d is followed by a hole!\n", m);
> +				goto out;
> +			}
> +
> +			m++;
> +		}
> +	}
> +

I still do not have a solid opinion what is a decent amount of
iterations to do at each place.

With the helper isolated;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux