[Intel-gfx] [PATCH 3/7] drm/i915: Track user GTT faulting per-vma

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Mon Oct 9 12:14:33 UTC 2017


On Mon, 2017-10-09 at 09:43 +0100, Chris Wilson wrote:
> We don't wish to refault the entire object (other vma) when unbinding
> one partial vma. To do this track which vma have been faulted into the
> user's address space.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

<SNIP>

> @@ -683,6 +683,29 @@ static void __i915_vma_iounmap(struct i915_vma *vma)
>  	vma->iomap = NULL;
>  }
>  
> +void i915_vma_revoke_mmap(struct i915_vma *vma)
> +{
> +	struct drm_vma_offset_node *node = &vma->obj->base.vma_node;
> +
> +	lockdep_assert_held(&vma->vm->i915->drm.struct_mutex);
> +
> +	if (!i915_vma_has_userfault(vma))
> +		return;
> +
> +	GEM_BUG_ON(!i915_vma_is_map_and_fenceable(vma));
> +	GEM_BUG_ON(!vma->obj->userfault_count);
> +
> +	unmap_mapping_range(vma->vm->i915->drm.anon_inode->i_mapping,
> +			    drm_vma_node_offset_addr(node) +
> +			    (vma->ggtt_view.partial.offset << PAGE_SHIFT),

Maybe compute this on a separate variable to not to confuse reader with
strange indent. "drm_vma_node_offset_addr(node) + vma_offset" would
read nicely.

Every other patch I read that touches the ggtt_views could use the
variables to be in page counts and others in byte counts...

Anyway,

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

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


More information about the Intel-gfx mailing list