Skip to content

Commit

Permalink
drm/i915: Add object locking to vm_fault_cpu
Browse files Browse the repository at this point in the history
Take a simple lock so we hold ww around (un)pin_pages as needed.

Signed-off-by: Maarten Lankhorst <[email protected]>
Reviewed-by: Thomas Hellström <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
mlankhorst authored and danvet committed Mar 24, 2021
1 parent 1b32102 commit 9fa1f47
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/i915/gem/i915_gem_mman.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ static vm_fault_t vm_fault_cpu(struct vm_fault *vmf)
area->vm_flags & VM_WRITE))
return VM_FAULT_SIGBUS;

if (i915_gem_object_lock_interruptible(obj, NULL))
return VM_FAULT_NOPAGE;

err = i915_gem_object_pin_pages(obj);
if (err)
goto out;
Expand All @@ -269,6 +272,7 @@ static vm_fault_t vm_fault_cpu(struct vm_fault *vmf)
i915_gem_object_unpin_pages(obj);

out:
i915_gem_object_unlock(obj);
return i915_error_to_vmf_fault(err);
}

Expand Down

0 comments on commit 9fa1f47

Please sign in to comment.