Re: [PATCH 54/55] drm/i915: Mark the context and address space as closed

Joonas Lahtinen
2016-07-27T10:14:08Z

On ma, 2016-07-25 at 18:32 +0100, Chris Wilson wrote:
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -907,6 +907,7 @@ struct i915_gem_context {
>   struct list_head link;
>
>   u8 remap_slice;
> + bool closed:1;

Not a whole bool? I think it could be.

>
> +static void i915_ppgtt_close(struct i915_address_space *vm)
> +{
> + struct list_head *phases[] = {
> + &vm->active_list,
> + &vm->inactive_list,
> + &vm->unbound_list,
> + NULL,
> + }, **phase;
> +
> + GEM_BUG_ON(vm->closed);
> + vm->closed = true;
> +
> + for (phase = phases; *phase; phase++) {
> + struct i915_vma *vma, *vn;
> +
> + list_for_each_entry_safe(vma, vn, *phase, vm_link)
> + if (!vma->closed)
> + i915_vma_close(vma);
> + }

Pretty sure rather listing three three function calls here would be
nicer;

i915_ppgtt_do_close(vm->active_list);
i915_ppgtt_do_close(vm->inactive_list);
...

Patch really makes the tracking easier to follow, there also seems to
be a hint of paranoia, but it's with GEM_BUG_ON() so should not hurt.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

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