Commit a725d711 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Ignore most failures during evict-vm

Removing all vma from the VM is best effort -- we only remove all those
ready to be removed, so forgive and VMA that becomes pinned. While
forgiving those that become pinned, also take a second look for any that
became unpinned as we waited.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Acked-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191205113726.413351-1-chris@chris-wilson.co.uk
parent 05975cd9
......@@ -359,9 +359,7 @@ int i915_gem_evict_for_node(struct i915_address_space *vm,
*/
int i915_gem_evict_vm(struct i915_address_space *vm)
{
struct list_head eviction_list;
struct i915_vma *vma, *next;
int ret;
int ret = 0;
lockdep_assert_held(&vm->mutex);
trace_i915_gem_evict_vm(vm);
......@@ -377,7 +375,10 @@ int i915_gem_evict_vm(struct i915_address_space *vm)
return ret;
}
INIT_LIST_HEAD(&eviction_list);
do {
struct i915_vma *vma, *vn;
LIST_HEAD(eviction_list);
list_for_each_entry(vma, &vm->bound_list, vm_link) {
if (i915_vma_is_pinned(vma))
continue;
......@@ -385,13 +386,19 @@ int i915_gem_evict_vm(struct i915_address_space *vm)
__i915_vma_pin(vma);
list_add(&vma->evict_link, &eviction_list);
}
if (list_empty(&eviction_list))
break;
ret = 0;
list_for_each_entry_safe(vma, next, &eviction_list, evict_link) {
list_for_each_entry_safe(vma, vn, &eviction_list, evict_link) {
__i915_vma_unpin(vma);
if (ret == 0)
ret = __i915_vma_unbind(vma);
if (ret != -EINTR) /* "Get me out of here!" */
ret = 0;
}
} while (ret == 0);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment