From 7fd8d2b8312d16cfec9a1fddff0468e60cb515a9 Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 25 Jan 2022 21:19:21 +0000 Subject: [PATCH] reduce diff to linux vm_fault_cpu() 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/pci/drm/i915/gem/i915_gem_mman.c b/sys/dev/pci/drm/i915/gem/i915_gem_mman.c index e9d978d3e5e..14daad18e21 100644 --- a/sys/dev/pci/drm/i915/gem/i915_gem_mman.c +++ b/sys/dev/pci/drm/i915/gem/i915_gem_mman.c @@ -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); } -- 2.20.1