[Intel-gfx] [PATCH 25/42] drm/i915: Use lockless object free

John Harrison John.C.Harrison at Intel.com
Tue Oct 11 09:56:49 UTC 2016


Needs a description?

On 07/10/2016 10:46, Chris Wilson wrote:
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/i915_drv.c         |  2 +-
>   drivers/gpu/drm/i915/i915_drv.h         | 10 +---------
>   drivers/gpu/drm/i915/i915_gem.c         | 20 ++++++++++----------
>   drivers/gpu/drm/i915/i915_gem_tiling.c  |  2 +-
>   drivers/gpu/drm/i915/i915_gem_userptr.c |  4 ++--
>   drivers/gpu/drm/i915/intel_display.c    |  6 +++---
>   drivers/gpu/drm/i915/intel_overlay.c    |  4 ++--
>   drivers/gpu/drm/i915/intel_pm.c         |  2 +-
>   8 files changed, 21 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index f7d48f97993d..2e29eedd21b2 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -2606,7 +2606,7 @@ static struct drm_driver driver = {
>   	.set_busid = drm_pci_set_busid,
>   
>   	.gem_close_object = i915_gem_close_object,
> -	.gem_free_object = i915_gem_free_object,
> +	.gem_free_object_unlocked = i915_gem_free_object,
>   	.gem_vm_ops = &i915_gem_vm_ops,
>   
>   	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e79a5cb78b5d..89d3b5a16826 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2396,19 +2396,12 @@ __attribute__((nonnull))
>   static inline void
>   i915_gem_object_put(struct drm_i915_gem_object *obj)
>   {
> -	drm_gem_object_unreference(&obj->base);
> +	__drm_gem_object_unreference(&obj->base);
>   }
>   
>   __deprecated
>   extern void drm_gem_object_unreference(struct drm_gem_object *);
>   
> -__attribute__((nonnull))
> -static inline void
> -i915_gem_object_put_unlocked(struct drm_i915_gem_object *obj)
> -{
> -	drm_gem_object_unreference_unlocked(&obj->base);
> -}
> -
>   __deprecated
>   extern void drm_gem_object_unreference_unlocked(struct drm_gem_object *);
>   
> @@ -2510,7 +2503,6 @@ static inline struct i915_vma *i915_vma_get(struct i915_vma *vma)
>   
>   static inline void i915_vma_put(struct i915_vma *vma)
>   {
> -	lockdep_assert_held(&vma->vm->dev->struct_mutex);
>   	i915_gem_object_put(vma->obj);
>   }
>   
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 7cd49dd1d3f8..28e1064baad5 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -616,7 +616,7 @@ i915_gem_create(struct drm_file *file,
>   
>   	ret = drm_gem_handle_create(file, &obj->base, &handle);
>   	/* drop reference from allocate - handle holds it now */
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	if (ret)
>   		return ret;
>   
> @@ -1115,7 +1115,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
>   
>   	i915_gem_object_unpin_pages(obj);
>   out:
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	return ret;
>   }
>   
> @@ -1450,7 +1450,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
>   
>   	i915_gem_object_unpin_pages(obj);
>   err:
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	return ret;
>   }
>   
> @@ -1560,7 +1560,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
>   err_pages:
>   	i915_gem_object_unpin_pages(obj);
>   err_unlocked:
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	return ret;
>   }
>   
> @@ -1591,7 +1591,7 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
>   		}
>   	}
>   
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	return err;
>   }
>   
> @@ -1637,7 +1637,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
>   	 * pages from.
>   	 */
>   	if (!obj->base.filp) {
> -		i915_gem_object_put_unlocked(obj);
> +		i915_gem_object_put(obj);
>   		return -EINVAL;
>   	}
>   
> @@ -1649,7 +1649,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
>   		struct vm_area_struct *vma;
>   
>   		if (down_write_killable(&mm->mmap_sem)) {
> -			i915_gem_object_put_unlocked(obj);
> +			i915_gem_object_put(obj);
>   			return -EINTR;
>   		}
>   		vma = find_vma(mm, addr);
> @@ -1663,7 +1663,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
>   		/* This may race, but that's ok, it only gets set */
>   		WRITE_ONCE(obj->frontbuffer_ggtt_origin, ORIGIN_CPU);
>   	}
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	if (IS_ERR((void *)addr))
>   		return addr;
>   
> @@ -2073,7 +2073,7 @@ i915_gem_mmap_gtt(struct drm_file *file,
>   	if (ret == 0)
>   		*offset = drm_vma_node_offset_addr(&obj->base.vma_node);
>   
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	return ret;
>   }
>   
> @@ -2881,7 +2881,7 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>   			args->timeout_ns = 0;
>   	}
>   
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	return ret;
>   }
>   
> diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
> index ec48e403adfe..d8fc4782b8db 100644
> --- a/drivers/gpu/drm/i915/i915_gem_tiling.c
> +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
> @@ -200,7 +200,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
>   
>   	if (!i915_tiling_ok(dev,
>   			    args->stride, obj->base.size, args->tiling_mode)) {
> -		i915_gem_object_put_unlocked(obj);
> +		i915_gem_object_put(obj);
>   		return -EINVAL;
>   	}
>   
> diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
> index 136c493b15b2..6f7ac0e783ec 100644
> --- a/drivers/gpu/drm/i915/i915_gem_userptr.c
> +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
> @@ -542,7 +542,7 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work)
>   	release_pages(pvec, pinned, 0);
>   	drm_free_large(pvec);
>   
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	put_task_struct(work->task);
>   	kfree(work);
>   }
> @@ -802,7 +802,7 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file
>   		ret = drm_gem_handle_create(file, &obj->base, &handle);
>   
>   	/* drop reference from allocate - handle holds it now */
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	if (ret)
>   		return ret;
>   
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 5ee7bab6e560..8beec0b651cd 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11026,7 +11026,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev,
>   
>   	fb = intel_framebuffer_create(dev, &mode_cmd, obj);
>   	if (IS_ERR(fb))
> -		i915_gem_object_put_unlocked(obj);
> +		i915_gem_object_put(obj);
>   
>   	return fb;
>   }
> @@ -12330,7 +12330,7 @@ cleanup:
>   	crtc->primary->fb = old_fb;
>   	update_state_fb(crtc->primary);
>   
> -	i915_gem_object_put_unlocked(obj);
> +	i915_gem_object_put(obj);
>   	drm_framebuffer_unreference(work->old_fb);
>   
>   	spin_lock_irq(&dev->event_lock);
> @@ -15837,7 +15837,7 @@ intel_user_framebuffer_create(struct drm_device *dev,
>   
>   	fb = intel_framebuffer_create(dev, &mode_cmd, obj);
>   	if (IS_ERR(fb))
> -		i915_gem_object_put_unlocked(obj);
> +		i915_gem_object_put(obj);
>   
>   	return fb;
>   }
> diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
> index 7c392547711f..58d5c5eed487 100644
> --- a/drivers/gpu/drm/i915/intel_overlay.c
> +++ b/drivers/gpu/drm/i915/intel_overlay.c
> @@ -1222,7 +1222,7 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,
>   out_unlock:
>   	mutex_unlock(&dev->struct_mutex);
>   	drm_modeset_unlock_all(dev);
> -	i915_gem_object_put_unlocked(new_bo);
> +	i915_gem_object_put(new_bo);
>   out_free:
>   	kfree(params);
>   
> @@ -1466,7 +1466,7 @@ void intel_cleanup_overlay(struct drm_i915_private *dev_priv)
>   	 * hardware should be off already */
>   	WARN_ON(dev_priv->overlay->active);
>   
> -	i915_gem_object_put_unlocked(dev_priv->overlay->reg_bo);
> +	i915_gem_object_put(dev_priv->overlay->reg_bo);
>   	kfree(dev_priv->overlay);
>   }
>   
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 7f1748a1e614..27fc4c9c8cd0 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -5864,7 +5864,7 @@ static void valleyview_cleanup_pctx(struct drm_i915_private *dev_priv)
>   	if (WARN_ON(!dev_priv->vlv_pctx))
>   		return;
>   
> -	i915_gem_object_put_unlocked(dev_priv->vlv_pctx);
> +	i915_gem_object_put(dev_priv->vlv_pctx);
>   	dev_priv->vlv_pctx = NULL;
>   }
>   



More information about the Intel-gfx mailing list