[Intel-gfx] [PATCH 03/11] drm/i915: Remove pinned check from madvise_ioctl

Daniel Vetter daniel at ffwll.ch
Wed Jan 28 01:52:06 PST 2015


On Mon, Jan 26, 2015 at 04:43:17AM -0800, Rodrigo Vivi wrote:
> From: Chris Wilson <chris at chris-wilson.co.uk>
> 
> We don't need to incur the overhead of checking whether the object is
> pinned prior to changing its madvise. If the object is pinned, the
> madvise will not take effect until it is unpinned and so we cannot free
> the pages being pointed at by hardware. Marking a pinned object with
> allocated pages as DONTNEED will not trigger any undue warnings. The check
> is therefore superfluous, and by removing it we can remove a linear walk
> over all the vma the object has.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

I'd still would like to see some igt testcase which marks a pinned scanout
buffer asl DONTNEED. Just to make sure we don't accidentally create a gap
somewhere for a CVE to sneak through.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 6c40365..123ce34 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4365,11 +4365,6 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
>  		goto unlock;
>  	}
>  
> -	if (i915_gem_obj_is_pinned(obj)) {
> -		ret = -EINVAL;
> -		goto out;
> -	}
> -
>  	if (obj->pages &&
>  	    obj->tiling_mode != I915_TILING_NONE &&
>  	    dev_priv->quirks & QUIRK_PIN_SWIZZLED_PAGES) {
> @@ -4388,7 +4383,6 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
>  
>  	args->retained = obj->madv != __I915_MADV_PURGED;
>  
> -out:
>  	drm_gem_object_unreference(&obj->base);
>  unlock:
>  	mutex_unlock(&dev->struct_mutex);
> -- 
> 1.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the Intel-gfx mailing list