[Intel-gfx] [PATCH 08/23] drm/i915: Move vma lookup to its own lock

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 17 16:44:53 UTC 2019


Quoting Tvrtko Ursulin (2019-01-17 16:27:04)
> 
> On 17/01/2019 14:34, Chris Wilson wrote:
> > Remove the struct_mutex requirement for looking up the vma for an
> > object.
> 
> Another patch with missing change log.
> 
> I see that you at least fixed the tree typo since the round I last 
> reviewed. But I also had some other questions which I did not see you 
> commented on.
> 
> Anyways, it is very hard to review without change logs.. I am not sure 
> why is this series particularly bad in this respect.

The short explanation, as given on the next patch,

                rb = *p;
                pos = rb_entry(rb, struct i915_vma, obj_node);

+               /*
+                * If the view already exists in the tree, another thread
+                * already created a matching vma, so return the older instance
+                * and dispose of ours.
+                */
                cmp = i915_vma_compare(pos, vm, view);
                if (cmp == 0) {
                        spin_unlock(&obj->vma.lock);
@@ -294,6 +299,7 @@ i915_vma_instance(struct drm_i915_gem_object *obj,
        vma = vma_lookup(obj, vm, view);
        spin_unlock(&obj->vma.lock);

+       /* vma_create() will resolve the race if another creates the vma */
        if (unlikely(!vma))
                vma = vma_create(obj, vm, view);

which should explain why the whitespace is peculiar and the early return
returns pos not vma.
-Chris


More information about the Intel-gfx mailing list