Re: [PATCH 05/34] drm: kselftest for drm_mm_init()

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

 



On ma, 2016-12-12 at 11:53 +0000, Chris Wilson wrote:
> Simple first test to just exercise initialisation of struct drm_mm.
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

<SNIP>

> +	drm_mm_for_each_hole(hole, &mm, start, end) {
> +		if (start != 0 || end != 4096) {
> +			pr_err("empty mm has incorrect hole, found (%llx, %llx), expect (%llx, %llx)\n",
> +			       start, end,
> +			       0ull, 4096ull);
> +			goto out;
> +		}
> +	}

While in paranoia mode, make sure there is just one hole?

> +
> > +	memset(&tmp, 0, sizeof(tmp));
> > +	tmp.start = 0;
> > +	tmp.size = 4096;
> > +	ret = drm_mm_reserve_node(&mm, &tmp);
> > +	if (ret) {
> > +		pr_err("failed to reserve whole drm_mm\n");
> > +		goto out;
> +	}

Should be no more holes.

drm_mm_for_each_hole() {
	pr_err();
	goto out;
}

> +	drm_mm_remove_node(&tmp);
> +

And it should again have a hole.

<SNIP>

> +static int igt_debug(void *ignored)
> +{
> +	struct drm_mm mm;
> +	struct drm_mm_node nodes[2];
> +	int ret;
> +
> +	drm_mm_init(&mm, 0, 4096);
> +
> +	memset(nodes, 0, sizeof(nodes));
> +	nodes[0].start = 512;
> +	nodes[0].size = 1024;
> +	ret = drm_mm_reserve_node(&mm, &nodes[0]);
> +	if (ret) {
> +		pr_err("failed to reserve node[0] {start=%lld, size=%lld)\n",
> +		       nodes[0].start, nodes[0].size);
> +		return ret;
> +	}
> +
> +	nodes[1].start = 512 - 1024 - 512;

Would be more clear if you used nodes[0].start. This also goes to
negative address which proves my point.

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