Re: [PATCH v2 1/2] drm/i915: Do an unlocked wait before set-cache-level ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> writes:

> On Thu, Jan 19, 2017 at 01:42:47PM +0200, Mika Kuoppala wrote:
>> Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> writes:
>> 
>> > Since a change in cache level is likely to trigger an unbind, avoid
>> > waiting under the mutex by preemptively doing an unlocked wait.
>> >
>> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
>> > ---
>> >  drivers/gpu/drm/i915/i915_gem.c | 29 +++++++++++++++++++----------
>> >  1 file changed, 19 insertions(+), 10 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
>> > index c1c2765bb8d0..0926c291404c 100644
>> > --- a/drivers/gpu/drm/i915/i915_gem.c
>> > +++ b/drivers/gpu/drm/i915/i915_gem.c
>> > @@ -3384,7 +3384,7 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
>> >  	struct drm_i915_gem_caching *args = data;
>> >  	struct drm_i915_gem_object *obj;
>> >  	enum i915_cache_level level;
>> > -	int ret;
>> > +	int ret = 0;
>> >  
>> >  	switch (args->caching) {
>> >  	case I915_CACHING_NONE:
>> > @@ -3409,20 +3409,29 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
>> >  		return -EINVAL;
>> >  	}
>> >  
>> > -	ret = i915_mutex_lock_interruptible(dev);
>> > +	obj = i915_gem_object_lookup(file, args->handle);
>> 
>> Does this need to be i915_gem_object_lookup_rcu?
>
> No. That's a special case for when the caller knows it is using RCU for
> the entire duration of the access and so doesn't need to acquire a
> reference to the object.

get_caching distracted me and I got it backwards. Actually looking
at the i915_gem_object_lookup would have saved a mail.

Reviewed-by: Mika Kuoppala <mika.kuoppala@xxxxxxxxx>

> -Chris
>
> -- 
> Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux