Drop take the {ttm,gem} vmobjlock in the fault handler.

- We don't need this lock.
- uvm does nothing between taking it and calling the fault handler.
- Now that the uvm_aobj shares vmobjlock with the {ttm,gem} uvm
  object, we must not hold the lock when we call uvm_obj_wirepages on
  the uvm_aobj.

XXX pullup to netbsd-7
This commit is contained in:
riastradh 2014-08-20 13:48:08 +00:00
parent 233c59f4d5
commit f40a74cd43
2 changed files with 11 additions and 3 deletions

View File

@ -1842,6 +1842,9 @@ i915_gem_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr, struct vm_page **pps,
intel_runtime_pm_get(dev_priv);
/* Thanks, uvm, but we don't need this lock. */
mutex_exit(uobj->vmobjlock);
ret = i915_mutex_lock_interruptible(dev);
if (ret)
goto out;
@ -1880,6 +1883,7 @@ unpin:
unlock:
mutex_unlock(&dev->struct_mutex);
out:
mutex_enter(uobj->vmobjlock);
uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj);
if (ret == -ERESTART)
uvm_wait("i915flt");

View File

@ -1,4 +1,4 @@
/* $NetBSD: ttm_bo_vm.c,v 1.3 2014/08/18 01:17:34 riastradh Exp $ */
/* $NetBSD: ttm_bo_vm.c,v 1.4 2014/08/20 13:48:08 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.3 2014/08/18 01:17:34 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.4 2014/08/20 13:48:08 riastradh Exp $");
#include <sys/types.h>
@ -92,6 +92,9 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr,
unsigned mmapflags;
int ret;
/* Thanks, uvm, but we don't need this lock. */
mutex_exit(uobj->vmobjlock);
/* Copy-on-write mappings make no sense for the graphics aperture. */
if (UVM_ET_ISCOPYONWRITE(ufi->entry)) {
ret = -EIO;
@ -199,7 +202,8 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr,
out3: pmap_update(ufi->orig_map->pmap);
out2: ttm_mem_io_unlock(man);
out1: ttm_bo_unreserve(bo);
out0: uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj);
out0: mutex_enter(uobj->vmobjlock);
uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj);
/* XXX errno Linux->NetBSD */
return -ret;
}