LIST_HEAD(still_in_list);
intel_wakeref_t wakeref;
struct i915_vma *vma;
- int ret = 0;
+ int ret;
if (!atomic_read(&obj->bind_count))
return 0;
*/
wakeref = intel_runtime_pm_get(rpm);
+try_again:
+ ret = 0;
spin_lock(&obj->vma.lock);
while (!ret && (vma = list_first_entry_or_null(&obj->vma.list,
struct i915_vma,
} else {
if (i915_vma_is_closed(vma)) {
spin_unlock(&obj->vma.lock);
+ i915_vma_parked(vm->gt);
goto err_vm;
}
}
list_splice(&still_in_list, &obj->vma.list);
spin_unlock(&obj->vma.lock);
+ if (ret == -EAGAIN && flags & I915_GEM_OBJECT_UNBIND_ACTIVE) {
+ rcu_barrier(); /* flush the i915_vm_release() */
+ goto try_again;
+ }
+
intel_runtime_pm_put(rpm, wakeref);
return ret;