reduce diff to linux vm_fault_cpu()
authorjsg <jsg@openbsd.org>
Tue, 25 Jan 2022 21:19:21 +0000 (21:19 +0000)
committerjsg <jsg@openbsd.org>
Tue, 25 Jan 2022 21:19:21 +0000 (21:19 +0000)
adds change made in linux 9fa1f4785f2a54286ccb8a850cda5661f0a3aaf9
drm/i915: Add object locking to vm_fault_cpu

sys/dev/pci/drm/i915/gem/i915_gem_mman.c

index e9d978d..14daad1 100644 (file)
@@ -563,6 +563,9 @@ vm_fault_cpu(struct i915_mmap_offset *mmo, struct uvm_faultinfo *ufi,
                return VM_PAGER_BAD;
        }
 
+       if (i915_gem_object_lock_interruptible(obj, NULL))
+               return VM_PAGER_ERROR;
+
        err = i915_gem_object_pin_pages(obj);
        if (err)
                goto out;
@@ -602,6 +605,7 @@ vm_fault_cpu(struct i915_mmap_offset *mmo, struct uvm_faultinfo *ufi,
        i915_gem_object_unpin_pages(obj);
 
 out:
+       i915_gem_object_unlock(obj);
        uvmfault_unlockall(ufi, NULL, &obj->base.uobj);
        return i915_error_to_vmf_fault(err);
 }