summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2015-10-23 08:21:58 +0000
committerkettenis <kettenis@openbsd.org>2015-10-23 08:21:58 +0000
commitba395deab2e149180f60fcc812dcbd9efe9f0cde (patch)
tree0ce29318e639b30e774ed5eb34345427f7db9858
parentsimplify argv back compat (diff)
downloadwireguard-openbsd-ba395deab2e149180f60fcc812dcbd9efe9f0cde.tar.xz
wireguard-openbsd-ba395deab2e149180f60fcc812dcbd9efe9f0cde.zip
Fix uvm_object reference counting. While these reference counts aren't reaaly
used (ttm bo's have their own reference counts), we can't let the reference count go negative as this will freak out the upper uvm layers. Since the uvm_object reference count is still a useful debugging tool (ddb will display it for example), adjust it such that the uvm_object reference count represents the number of references held by the uvm layer. tested by matthieu@ ok jsg@
-rw-r--r--sys/dev/pci/drm/ttm/ttm_bo.c4
-rw-r--r--sys/dev/pci/drm/ttm/ttm_bo_vm.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/pci/drm/ttm/ttm_bo.c b/sys/dev/pci/drm/ttm/ttm_bo.c
index 20cbf3fc21a..523c25a606c 100644
--- a/sys/dev/pci/drm/ttm/ttm_bo.c
+++ b/sys/dev/pci/drm/ttm/ttm_bo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttm_bo.c,v 1.18 2015/09/27 11:09:26 jsg Exp $ */
+/* $OpenBSD: ttm_bo.c,v 1.19 2015/10/23 08:21:58 kettenis Exp $ */
/**************************************************************************
*
* Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
@@ -1224,7 +1224,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
}
bo->destroy = destroy;
- uvm_objinit(&bo->uobj, NULL, 1);
+ uvm_objinit(&bo->uobj, NULL, 0);
kref_init(&bo->kref);
kref_init(&bo->list_kref);
atomic_set(&bo->cpu_writers, 0);
diff --git a/sys/dev/pci/drm/ttm/ttm_bo_vm.c b/sys/dev/pci/drm/ttm/ttm_bo_vm.c
index a3ad2c9a05a..cd7a8b47fa5 100644
--- a/sys/dev/pci/drm/ttm/ttm_bo_vm.c
+++ b/sys/dev/pci/drm/ttm/ttm_bo_vm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttm_bo_vm.c,v 1.8 2015/09/27 11:09:26 jsg Exp $ */
+/* $OpenBSD: ttm_bo_vm.c,v 1.9 2015/10/23 08:21:58 kettenis Exp $ */
/**************************************************************************
*
* Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
@@ -337,6 +337,8 @@ ttm_bo_mmap(voff_t off, vsize_t size, struct ttm_bo_device *bdev)
vma->vm_private_data = bo;
vma->vm_flags |= VM_IO | VM_MIXEDMAP | VM_DONTEXPAND | VM_DONTDUMP;
+#else
+ bo->uobj.uo_refs++;
#endif
return &bo->uobj;
out_unref: