[Intel-gfx] [PATCH 18/22] drm/i915/selftests: huge page tests
Chris Wilson
chris at chris-wilson.co.uk
Mon Sep 25 19:17:58 UTC 2017
Quoting Matthew Auld (2017-09-25 19:47:33)
> +static int igt_tmpfs_fallback(void *arg)
> +{
> + struct drm_i915_private *i915 = arg;
> + struct vfsmount *gemfs = i915->mm.gemfs;
> + struct drm_i915_gem_object *obj;
> + int err = 0;
> +
> + /*
> + * Make sure that we don't burst into a ball of flames upon falling back
> + * to tmpfs, which we rely on if on the off-chance we encouter a failure
> + * when setting up gemfs.
> + */
> +
> + i915->mm.gemfs = NULL;
> +
> + obj = i915_gem_object_create(i915, PAGE_SIZE);
> + if (IS_ERR(obj)) {
> + err = PTR_ERR(obj);
> + goto out_restore;
> + }
> +
> + err = i915_gem_object_pin_pages(obj);
> + if (err)
> + goto out_put;
> +
> + i915_gem_object_unpin_pages(obj);
> +out_put:
> + i915_gem_object_put(obj);
> +out_restore:
> + i915->mm.gemfs = gemfs;
> +
> + return err;
> +}
Very sensible! Do a vaddr = pin_map(); *vaddr; unpin_map() in the
middle (instead of just pin_pages). Could do with a vma_bind as well to
check that dma_map_sg() is also happy.
-Chris
More information about the Intel-gfx
mailing list