From: kettenis Date: Fri, 23 Oct 2015 08:21:58 +0000 (+0000) Subject: Fix uvm_object reference counting. While these reference counts aren't reaaly X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ba395deab2e149180f60fcc812dcbd9efe9f0cde;p=openbsd 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@ --- 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: