drm - Fix deadlock in ttm pager
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 10 Jan 2015 17:35:24 +0000 (09:35 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 10 Jan 2015 17:35:24 +0000 (09:35 -0800)
* Fix a deadlock which most often occurs via the ttm (radeon) VM pager.
  A similar path is also used by i915 (all intel).

* Basically removes an unnecessary lock in the paging path which was creating
  the deadlock.

Reported-by: ivadasz, ftigeot
sys/vm/device_pager.c

index 7e2fca3..7328279 100644 (file)
@@ -220,6 +220,9 @@ dev_pager_dealloc(vm_object_t object)
 
 /*
  * No requirements.
+ *
+ * WARNING! Do not obtain dev_pager_mtx here, doing so will cause a
+ *         deadlock in DRMs VM paging code.
  */
 static int
 dev_pager_getpage(vm_object_t object, vm_page_t *mpp, int seqaccess)
@@ -227,14 +230,11 @@ dev_pager_getpage(vm_object_t object, vm_page_t *mpp, int seqaccess)
        vm_page_t page;
        int error;
 
-       mtx_lock(&dev_pager_mtx);
-
        page = *mpp;
 
-       error = object->un_pager.devp.ops->cdev_pg_fault(object,
-            IDX_TO_OFF(page->pindex), PROT_READ, mpp);
-
-       mtx_unlock(&dev_pager_mtx);
+       error = object->un_pager.devp.ops->cdev_pg_fault(
+                       object, IDX_TO_OFF(page->pindex),
+                       PROT_READ, mpp);
 
        return (error);
 }