Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Mar 2013 02:51:51 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r248087 - in user/attilio/vmcontention: . sbin/geom/class/raid sys/amd64/amd64 sys/arm/arm sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/...
Message-ID:  <201303090251.r292ppiF073438@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Sat Mar  9 02:51:51 2013
New Revision: 248087
URL: http://svnweb.freebsd.org/changeset/base/248087

Log:
  MFC

Added:
  user/attilio/vmcontention/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c
     - copied unchanged from r248086, head/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c
  user/attilio/vmcontention/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h
     - copied unchanged from r248086, head/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h
  user/attilio/vmcontention/sys/cddl/compat/opensolaris/sys/vm.h
     - copied unchanged from r248086, head/sys/cddl/compat/opensolaris/sys/vm.h
  user/attilio/vmcontention/usr.bin/truss/arm-fbsd.c
     - copied unchanged from r248086, head/usr.bin/truss/arm-fbsd.c
Modified:
  user/attilio/vmcontention/UPDATING
  user/attilio/vmcontention/sbin/geom/class/raid/graid.8
  user/attilio/vmcontention/sys/amd64/amd64/machdep.c
  user/attilio/vmcontention/sys/amd64/amd64/pmap.c
  user/attilio/vmcontention/sys/arm/arm/cpufunc_asm_arm11x6.S
  user/attilio/vmcontention/sys/arm/arm/machdep.c
  user/attilio/vmcontention/sys/arm/arm/pmap-v6.c
  user/attilio/vmcontention/sys/arm/arm/pmap.c
  user/attilio/vmcontention/sys/cddl/compat/opensolaris/sys/vnode.h
  user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h
  user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  user/attilio/vmcontention/sys/compat/linprocfs/linprocfs.c
  user/attilio/vmcontention/sys/conf/files
  user/attilio/vmcontention/sys/dev/agp/agp.c
  user/attilio/vmcontention/sys/dev/agp/agp_i810.c
  user/attilio/vmcontention/sys/dev/drm/drmP.h
  user/attilio/vmcontention/sys/dev/drm2/drmP.h
  user/attilio/vmcontention/sys/dev/drm2/drm_fb_helper.c
  user/attilio/vmcontention/sys/dev/drm2/drm_global.c
  user/attilio/vmcontention/sys/dev/drm2/i915/i915_gem.c
  user/attilio/vmcontention/sys/dev/drm2/ttm/ttm_bo.c
  user/attilio/vmcontention/sys/dev/drm2/ttm/ttm_bo_vm.c
  user/attilio/vmcontention/sys/dev/drm2/ttm/ttm_memory.c
  user/attilio/vmcontention/sys/dev/drm2/ttm/ttm_tt.c
  user/attilio/vmcontention/sys/dev/hwpmc/hwpmc_mod.c
  user/attilio/vmcontention/sys/dev/md/md.c
  user/attilio/vmcontention/sys/dev/netmap/netmap.c
  user/attilio/vmcontention/sys/dev/oce/oce_hw.h
  user/attilio/vmcontention/sys/dev/oce/oce_sysctl.c
  user/attilio/vmcontention/sys/dev/sound/pcm/dsp.c
  user/attilio/vmcontention/sys/fs/fuse/fuse_io.c
  user/attilio/vmcontention/sys/fs/fuse/fuse_vnops.c
  user/attilio/vmcontention/sys/fs/nfsclient/nfs_clbio.c
  user/attilio/vmcontention/sys/fs/nfsclient/nfs_clnode.c
  user/attilio/vmcontention/sys/fs/nfsclient/nfs_clvnops.c
  user/attilio/vmcontention/sys/fs/nfsserver/nfs_nfsdport.c
  user/attilio/vmcontention/sys/fs/procfs/procfs_map.c
  user/attilio/vmcontention/sys/fs/tmpfs/tmpfs_subr.c
  user/attilio/vmcontention/sys/fs/tmpfs/tmpfs_vnops.c
  user/attilio/vmcontention/sys/geom/label/g_label_ntfs.c
  user/attilio/vmcontention/sys/geom/raid/g_raid.c
  user/attilio/vmcontention/sys/i386/i386/machdep.c
  user/attilio/vmcontention/sys/i386/i386/pmap.c
  user/attilio/vmcontention/sys/i386/xen/pmap.c
  user/attilio/vmcontention/sys/ia64/ia64/machdep.c
  user/attilio/vmcontention/sys/ia64/ia64/pmap.c
  user/attilio/vmcontention/sys/kern/imgact_elf.c
  user/attilio/vmcontention/sys/kern/kern_exec.c
  user/attilio/vmcontention/sys/kern/kern_proc.c
  user/attilio/vmcontention/sys/kern/kern_sharedpage.c
  user/attilio/vmcontention/sys/kern/kern_shutdown.c
  user/attilio/vmcontention/sys/kern/kern_timeout.c
  user/attilio/vmcontention/sys/kern/subr_param.c
  user/attilio/vmcontention/sys/kern/subr_uio.c
  user/attilio/vmcontention/sys/kern/sys_process.c
  user/attilio/vmcontention/sys/kern/sysv_shm.c
  user/attilio/vmcontention/sys/kern/uipc_shm.c
  user/attilio/vmcontention/sys/kern/uipc_syscalls.c
  user/attilio/vmcontention/sys/kern/vfs_aio.c
  user/attilio/vmcontention/sys/kern/vfs_bio.c
  user/attilio/vmcontention/sys/kern/vfs_cluster.c
  user/attilio/vmcontention/sys/kern/vfs_default.c
  user/attilio/vmcontention/sys/kern/vfs_subr.c
  user/attilio/vmcontention/sys/kern/vfs_syscalls.c
  user/attilio/vmcontention/sys/kern/vfs_vnops.c
  user/attilio/vmcontention/sys/mips/mips/machdep.c
  user/attilio/vmcontention/sys/mips/mips/pmap.c
  user/attilio/vmcontention/sys/modules/ath/Makefile
  user/attilio/vmcontention/sys/modules/zfs/Makefile
  user/attilio/vmcontention/sys/net/if.c
  user/attilio/vmcontention/sys/net/route.c
  user/attilio/vmcontention/sys/net/route.h
  user/attilio/vmcontention/sys/net80211/ieee80211.c
  user/attilio/vmcontention/sys/net80211/ieee80211_freebsd.c
  user/attilio/vmcontention/sys/net80211/ieee80211_freebsd.h
  user/attilio/vmcontention/sys/net80211/ieee80211_hostap.c
  user/attilio/vmcontention/sys/net80211/ieee80211_ht.c
  user/attilio/vmcontention/sys/net80211/ieee80211_hwmp.c
  user/attilio/vmcontention/sys/net80211/ieee80211_mesh.c
  user/attilio/vmcontention/sys/net80211/ieee80211_output.c
  user/attilio/vmcontention/sys/net80211/ieee80211_power.c
  user/attilio/vmcontention/sys/net80211/ieee80211_proto.h
  user/attilio/vmcontention/sys/net80211/ieee80211_superg.c
  user/attilio/vmcontention/sys/net80211/ieee80211_var.h
  user/attilio/vmcontention/sys/net80211/ieee80211_wds.c
  user/attilio/vmcontention/sys/nfsclient/nfs_bio.c
  user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c
  user/attilio/vmcontention/sys/nfsserver/nfs_serv.c
  user/attilio/vmcontention/sys/ofed/drivers/infiniband/core/umem.c
  user/attilio/vmcontention/sys/ofed/include/linux/linux_compat.c
  user/attilio/vmcontention/sys/pc98/pc98/machdep.c
  user/attilio/vmcontention/sys/powerpc/aim/machdep.c
  user/attilio/vmcontention/sys/powerpc/aim/mmu_oea.c
  user/attilio/vmcontention/sys/powerpc/aim/mmu_oea64.c
  user/attilio/vmcontention/sys/powerpc/booke/machdep.c
  user/attilio/vmcontention/sys/powerpc/booke/pmap.c
  user/attilio/vmcontention/sys/security/mac/mac_process.c
  user/attilio/vmcontention/sys/sparc64/conf/GENERIC
  user/attilio/vmcontention/sys/sparc64/sparc64/machdep.c
  user/attilio/vmcontention/sys/sparc64/sparc64/pmap.c
  user/attilio/vmcontention/sys/sys/callout.h
  user/attilio/vmcontention/sys/sys/systm.h
  user/attilio/vmcontention/sys/ufs/ffs/ffs_rawread.c
  user/attilio/vmcontention/sys/ufs/ffs/ffs_vnops.c
  user/attilio/vmcontention/sys/vm/default_pager.c
  user/attilio/vmcontention/sys/vm/device_pager.c
  user/attilio/vmcontention/sys/vm/phys_pager.c
  user/attilio/vmcontention/sys/vm/sg_pager.c
  user/attilio/vmcontention/sys/vm/swap_pager.c
  user/attilio/vmcontention/sys/vm/uma_core.c
  user/attilio/vmcontention/sys/vm/vm_fault.c
  user/attilio/vmcontention/sys/vm/vm_glue.c
  user/attilio/vmcontention/sys/vm/vm_init.c
  user/attilio/vmcontention/sys/vm/vm_kern.c
  user/attilio/vmcontention/sys/vm/vm_map.c
  user/attilio/vmcontention/sys/vm/vm_meter.c
  user/attilio/vmcontention/sys/vm/vm_mmap.c
  user/attilio/vmcontention/sys/vm/vm_object.c
  user/attilio/vmcontention/sys/vm/vm_object.h
  user/attilio/vmcontention/sys/vm/vm_page.c
  user/attilio/vmcontention/sys/vm/vm_pageout.c
  user/attilio/vmcontention/sys/vm/vm_pager.c
  user/attilio/vmcontention/sys/vm/vm_pager.h
  user/attilio/vmcontention/sys/vm/vm_reserv.c
  user/attilio/vmcontention/sys/vm/vnode_pager.c
  user/attilio/vmcontention/usr.bin/Makefile.arm
  user/attilio/vmcontention/usr.bin/truss/extern.h
  user/attilio/vmcontention/usr.bin/truss/main.c
  user/attilio/vmcontention/usr.sbin/pkg/pkg.c
Directory Properties:
  user/attilio/vmcontention/   (props changed)
  user/attilio/vmcontention/sbin/   (props changed)
  user/attilio/vmcontention/sys/   (props changed)
  user/attilio/vmcontention/sys/cddl/contrib/opensolaris/   (props changed)
  user/attilio/vmcontention/sys/conf/   (props changed)

Modified: user/attilio/vmcontention/UPDATING
==============================================================================
--- user/attilio/vmcontention/UPDATING	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/UPDATING	Sat Mar  9 02:51:51 2013	(r248087)
@@ -26,6 +26,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
 	disable the most expensive debugging functionality run
 	"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20130308:
+	CTL_DISABLE has also been added to the sparc64 GENERIC (for further
+	information, see the respective 20130304 entry).
+
 20130304:
 	Recent commits to callout(9) changed the size of struct callout,
 	so the KBI is probably heavily disturbed. Also, some functions

Modified: user/attilio/vmcontention/sbin/geom/class/raid/graid.8
==============================================================================
--- user/attilio/vmcontention/sbin/geom/class/raid/graid.8	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sbin/geom/class/raid/graid.8	Sat Mar  9 02:51:51 2013	(r248087)
@@ -305,6 +305,9 @@ Write errors are always considered as di
 Time to wait for missing array components on startup.
 .It Va kern.geom.raid. Ns Ar X Ns Va .enable : No 1
 Enable taste for specific metadata or transformation module.
+.It Va kern.geom.raid.legacy_aliases : No 0
+Enable geom raid emulation of /dev/ar%d devices from ataraid(4)
+This should aid the upgrade of systems from legacy to modern releases.
 .El
 .Sh EXIT STATUS
 Exit status is 0 on success, and non-zero if the command fails.

Modified: user/attilio/vmcontention/sys/amd64/amd64/machdep.c
==============================================================================
--- user/attilio/vmcontention/sys/amd64/amd64/machdep.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/amd64/amd64/machdep.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/pcpu.h>
 #include <sys/ptrace.h>
 #include <sys/reboot.h>
+#include <sys/rwlock.h>
 #include <sys/sched.h>
 #include <sys/signalvar.h>
 #ifdef SMP

Modified: user/attilio/vmcontention/sys/amd64/amd64/pmap.c
==============================================================================
--- user/attilio/vmcontention/sys/amd64/amd64/pmap.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/amd64/amd64/pmap.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -3556,7 +3556,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	    va >= kmi.clean_eva,
 	    ("pmap_enter: managed mapping within the clean submap"));
 	if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0)
-		VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+		VM_OBJECT_ASSERT_WLOCKED(m->object);
 	pa = VM_PAGE_TO_PHYS(m);
 	newpte = (pt_entry_t)(pa | PG_A | PG_V);
 	if ((access & VM_PROT_WRITE) != 0)
@@ -3823,7 +3823,7 @@ pmap_enter_object(pmap_t pmap, vm_offset
 	vm_page_t m, mpte;
 	vm_pindex_t diff, psize;
 
-	VM_OBJECT_LOCK_ASSERT(m_start->object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(m_start->object);
 	psize = atop(end - start);
 	mpte = NULL;
 	m = m_start;
@@ -4005,7 +4005,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs
 	vm_page_t p, pdpg;
 	int pat_mode;
 
-	VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(object);
 	KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG,
 	    ("pmap_object_init_pt: non-device object"));
 	if ((addr & (NBPDR - 1)) == 0 && (size & (NBPDR - 1)) == 0) {
@@ -4619,7 +4619,7 @@ pmap_is_modified(vm_page_t m)
 	 * concurrently set while the object is locked.  Thus, if PGA_WRITEABLE
 	 * is clear, no PTEs can have PG_M set.
 	 */
-	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(m->object);
 	if ((m->oflags & VPO_BUSY) == 0 &&
 	    (m->aflags & PGA_WRITEABLE) == 0)
 		return (FALSE);
@@ -4750,7 +4750,7 @@ pmap_remove_write(vm_page_t m)
 	 * another thread while the object is locked.  Thus, if PGA_WRITEABLE
 	 * is clear, no page table entries need updating.
 	 */
-	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(m->object);
 	if ((m->oflags & VPO_BUSY) == 0 &&
 	    (m->aflags & PGA_WRITEABLE) == 0)
 		return;
@@ -4894,7 +4894,7 @@ pmap_clear_modify(vm_page_t m)
 
 	KASSERT((m->oflags & VPO_UNMANAGED) == 0,
 	    ("pmap_clear_modify: page %p is not managed", m));
-	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(m->object);
 	KASSERT((m->oflags & VPO_BUSY) == 0,
 	    ("pmap_clear_modify: page %p is busy", m));
 

Modified: user/attilio/vmcontention/sys/arm/arm/cpufunc_asm_arm11x6.S
==============================================================================
--- user/attilio/vmcontention/sys/arm/arm/cpufunc_asm_arm11x6.S	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/arm/arm/cpufunc_asm_arm11x6.S	Sat Mar  9 02:51:51 2013	(r248087)
@@ -62,6 +62,8 @@
 #include <machine/asm.h>
 __FBSDID("$FreeBSD$");
 
+	.cpu arm1136js
+
 #if 0
 #define Invalidate_I_cache(Rtmp1, Rtmp2) \
 	mcr	p15, 0, Rtmp1, c7, c5, 0	/* Invalidate Entire I cache */

Modified: user/attilio/vmcontention/sys/arm/arm/machdep.c
==============================================================================
--- user/attilio/vmcontention/sys/arm/arm/machdep.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/arm/arm/machdep.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <sys/pcpu.h>
 #include <sys/ptrace.h>
+#include <sys/rwlock.h>
 #include <sys/sched.h>
 #include <sys/signalvar.h>
 #include <sys/syscallsubr.h>

Modified: user/attilio/vmcontention/sys/arm/arm/pmap-v6.c
==============================================================================
--- user/attilio/vmcontention/sys/arm/arm/pmap-v6.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/arm/arm/pmap-v6.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -2212,7 +2212,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs
     vm_pindex_t pindex, vm_size_t size)
 {
 
-	VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(object);
 	KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG,
 	    ("pmap_object_init_pt: non-device object"));
 }
@@ -3428,7 +3428,7 @@ pmap_clear_modify(vm_page_t m)
 
 	KASSERT((m->oflags & VPO_UNMANAGED) == 0,
 	    ("pmap_clear_modify: page %p is not managed", m));
-	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(m->object);
 	KASSERT((m->oflags & VPO_BUSY) == 0,
 	    ("pmap_clear_modify: page %p is busy", m));
 
@@ -3475,7 +3475,7 @@ pmap_remove_write(vm_page_t m)
 	 * another thread while the object is locked.  Thus, if PGA_WRITEABLE
 	 * is clear, no page table entries need updating.
 	 */
-	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(m->object);
 	if ((m->oflags & VPO_BUSY) != 0 ||
 	    (m->aflags & PGA_WRITEABLE) != 0)
 		pmap_clearbit(m, PVF_WRITE);

Modified: user/attilio/vmcontention/sys/arm/arm/pmap.c
==============================================================================
--- user/attilio/vmcontention/sys/arm/arm/pmap.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/arm/arm/pmap.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -3006,7 +3006,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs
     vm_pindex_t pindex, vm_size_t size)
 {
 
-	VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(object);
 	KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG,
 	    ("pmap_object_init_pt: non-device object"));
 }
@@ -4461,7 +4461,7 @@ pmap_clear_modify(vm_page_t m)
 
 	KASSERT((m->oflags & VPO_UNMANAGED) == 0,
 	    ("pmap_clear_modify: page %p is not managed", m));
-	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(m->object);
 	KASSERT((m->oflags & VPO_BUSY) == 0,
 	    ("pmap_clear_modify: page %p is busy", m));
 
@@ -4523,7 +4523,7 @@ pmap_remove_write(vm_page_t m)
 	 * another thread while the object is locked.  Thus, if PGA_WRITEABLE
 	 * is clear, no page table entries need updating.
 	 */
-	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(m->object);
 	if ((m->oflags & VPO_BUSY) != 0 ||
 	    (m->aflags & PGA_WRITEABLE) != 0)
 		pmap_clearbit(m, PVF_WRITE);

Copied: user/attilio/vmcontention/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c (from r248086, head/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmcontention/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c	Sat Mar  9 02:51:51 2013	(r248087, copy of r248086, head/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c)
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2013 EMC Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/freebsd_rwlock.h>
+
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/vm_object.h>
+#include <vm/vm_page.h>
+#include <vm/vm_pager.h>
+
+const int zfs_vm_pagerret_bad = VM_PAGER_BAD;
+const int zfs_vm_pagerret_error = VM_PAGER_ERROR;
+const int zfs_vm_pagerret_ok = VM_PAGER_OK;
+
+void
+zfs_vmobject_assert_wlocked(vm_object_t object)
+{
+
+	/*
+	 * This is not ideal because FILE/LINE used by assertions will not
+	 * be too helpful, but it must be an hard function for
+	 * compatibility reasons.
+	 */
+	VM_OBJECT_ASSERT_WLOCKED(object);
+}
+
+void
+zfs_vmobject_wlock(vm_object_t object)
+{
+
+	VM_OBJECT_WLOCK(object);
+}
+
+void
+zfs_vmobject_wunlock(vm_object_t object)
+{
+
+	VM_OBJECT_WUNLOCK(object);
+}

Copied: user/attilio/vmcontention/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h (from r248086, head/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmcontention/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h	Sat Mar  9 02:51:51 2013	(r248087, copy of r248086, head/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h)
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2013 EMC Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _OPENSOLARIS_SYS_FREEBSD_RWLOCK_H_
+#define	_OPENSOLARIS_SYS_FREEBSD_RWLOCK_H_
+
+#include_next <sys/rwlock.h>
+
+#endif

Copied: user/attilio/vmcontention/sys/cddl/compat/opensolaris/sys/vm.h (from r248086, head/sys/cddl/compat/opensolaris/sys/vm.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmcontention/sys/cddl/compat/opensolaris/sys/vm.h	Sat Mar  9 02:51:51 2013	(r248087, copy of r248086, head/sys/cddl/compat/opensolaris/sys/vm.h)
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2013 EMC Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _OPENSOLARIS_SYS_VM_H_
+#define	_OPENSOLARIS_SYS_VM_H_
+
+#ifdef _KERNEL
+
+extern const int zfs_vm_pagerret_bad;
+extern const int zfs_vm_pagerret_error;
+extern const int zfs_vm_pagerret_ok;
+
+void	zfs_vmobject_assert_wlocked(vm_object_t object);
+void	zfs_vmobject_wlock(vm_object_t object);
+void	zfs_vmobject_wunlock(vm_object_t object);
+
+#endif	/* _KERNEL */
+
+#endif	/* _OPENSOLARIS_SYS_VM_H_ */

Modified: user/attilio/vmcontention/sys/cddl/compat/opensolaris/sys/vnode.h
==============================================================================
--- user/attilio/vmcontention/sys/cddl/compat/opensolaris/sys/vnode.h	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/cddl/compat/opensolaris/sys/vnode.h	Sat Mar  9 02:51:51 2013	(r248087)
@@ -75,7 +75,8 @@ vn_is_readonly(vnode_t *vp)
 #define	vn_mountedvfs(vp)	((vp)->v_mountedhere)
 #define	vn_has_cached_data(vp)	\
 	((vp)->v_object != NULL && \
-	 (vp)->v_object->cached_page_count > 0)
+	 ((vp)->v_object->resident_page_count > 0 || \
+	  !vm_object_cache_is_empty((vp)->v_object)))
 #define	vn_exists(vp)		do { } while (0)
 #define	vn_invalid(vp)		do { } while (0)
 #define	vn_renamepath(tdvp, svp, tnm, lentnm)	do { } while (0)

Modified: user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h
==============================================================================
--- user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h	Sat Mar  9 02:51:51 2013	(r248087)
@@ -103,7 +103,6 @@ extern "C" {
 #include <vm/vm.h>
 #include <vm/vm_page.h>
 #include <vm/vm_object.h>
-#include <vm/vm_pager.h>
 #include <vm/vm_kern.h>
 #include <vm/vm_map.h>
 /* There is clash. vm_map.h defines the two below and vdev_cache.c use them. */

Modified: user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==============================================================================
--- user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -33,6 +33,7 @@
 #include <sys/sysmacros.h>
 #include <sys/resource.h>
 #include <sys/vfs.h>
+#include <sys/vm.h>
 #include <sys/vnode.h>
 #include <sys/file.h>
 #include <sys/stat.h>
@@ -329,7 +330,7 @@ page_busy(vnode_t *vp, int64_t start, in
 	vm_page_t pp;
 
 	obj = vp->v_object;
-	VM_OBJECT_LOCK_ASSERT(obj, MA_OWNED);
+	zfs_vmobject_assert_wlocked(obj);
 
 	for (;;) {
 		if ((pp = vm_page_lookup(obj, OFF_TO_IDX(start))) != NULL &&
@@ -377,7 +378,7 @@ page_hold(vnode_t *vp, int64_t start)
 	vm_page_t pp;
 
 	obj = vp->v_object;
-	VM_OBJECT_LOCK_ASSERT(obj, MA_OWNED);
+	zfs_vmobject_assert_wlocked(obj);
 
 	for (;;) {
 		if ((pp = vm_page_lookup(obj, OFF_TO_IDX(start))) != NULL &&
@@ -450,7 +451,7 @@ update_pages(vnode_t *vp, int64_t start,
 	ASSERT(obj != NULL);
 
 	off = start & PAGEOFFSET;
-	VM_OBJECT_LOCK(obj);
+	zfs_vmobject_wlock(obj);
 	for (start &= PAGEMASK; len > 0; start += PAGESIZE) {
 		vm_page_t pp;
 		int nbytes = imin(PAGESIZE - off, len);
@@ -467,23 +468,23 @@ update_pages(vnode_t *vp, int64_t start,
 			    ("zfs update_pages: unbusy page in putpages case"));
 			KASSERT(!pmap_page_is_write_mapped(pp),
 			    ("zfs update_pages: writable page in putpages case"));
-			VM_OBJECT_UNLOCK(obj);
+			zfs_vmobject_wunlock(obj);
 
 			va = zfs_map_page(pp, &sf);
 			(void) dmu_write(os, oid, start, nbytes, va, tx);
 			zfs_unmap_page(sf);
 
-			VM_OBJECT_LOCK(obj);
+			zfs_vmobject_wlock(obj);
 			vm_page_undirty(pp);
 		} else if ((pp = page_busy(vp, start, off, nbytes)) != NULL) {
-			VM_OBJECT_UNLOCK(obj);
+			zfs_vmobject_wunlock(obj);
 
 			va = zfs_map_page(pp, &sf);
 			(void) dmu_read(os, oid, start+off, nbytes,
 			    va+off, DMU_READ_PREFETCH);;
 			zfs_unmap_page(sf);
 
-			VM_OBJECT_LOCK(obj);
+			zfs_vmobject_wlock(obj);
 			page_unbusy(pp);
 		}
 		len -= nbytes;
@@ -491,7 +492,7 @@ update_pages(vnode_t *vp, int64_t start,
 	}
 	if (segflg != UIO_NOCOPY)
 		vm_object_pip_wakeupn(obj, 0);
-	VM_OBJECT_UNLOCK(obj);
+	zfs_vmobject_wunlock(obj);
 }
 
 /*
@@ -523,7 +524,7 @@ mappedread_sf(vnode_t *vp, int nbytes, u
 	ASSERT(obj != NULL);
 	ASSERT((uio->uio_loffset & PAGEOFFSET) == 0);
 
-	VM_OBJECT_LOCK(obj);
+	zfs_vmobject_wlock(obj);
 	for (start = uio->uio_loffset; len > 0; start += PAGESIZE) {
 		int bytes = MIN(PAGESIZE, len);
 
@@ -531,14 +532,14 @@ mappedread_sf(vnode_t *vp, int nbytes, u
 		    VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_IGN_SBUSY);
 		if (pp->valid == 0) {
 			vm_page_io_start(pp);
-			VM_OBJECT_UNLOCK(obj);
+			zfs_vmobject_wunlock(obj);
 			va = zfs_map_page(pp, &sf);
 			error = dmu_read(os, zp->z_id, start, bytes, va,
 			    DMU_READ_PREFETCH);
 			if (bytes != PAGESIZE && error == 0)
 				bzero(va + bytes, PAGESIZE - bytes);
 			zfs_unmap_page(sf);
-			VM_OBJECT_LOCK(obj);
+			zfs_vmobject_wlock(obj);
 			vm_page_io_finish(pp);
 			vm_page_lock(pp);
 			if (error) {
@@ -555,7 +556,7 @@ mappedread_sf(vnode_t *vp, int nbytes, u
 		uio->uio_offset += bytes;
 		len -= bytes;
 	}
-	VM_OBJECT_UNLOCK(obj);
+	zfs_vmobject_wunlock(obj);
 	return (error);
 }
 
@@ -587,7 +588,7 @@ mappedread(vnode_t *vp, int nbytes, uio_
 
 	start = uio->uio_loffset;
 	off = start & PAGEOFFSET;
-	VM_OBJECT_LOCK(obj);
+	zfs_vmobject_wlock(obj);
 	for (start &= PAGEMASK; len > 0; start += PAGESIZE) {
 		vm_page_t pp;
 		uint64_t bytes = MIN(PAGESIZE - off, len);
@@ -596,23 +597,23 @@ mappedread(vnode_t *vp, int nbytes, uio_
 			struct sf_buf *sf;
 			caddr_t va;
 
-			VM_OBJECT_UNLOCK(obj);
+			zfs_vmobject_wunlock(obj);
 			va = zfs_map_page(pp, &sf);
 			error = uiomove(va + off, bytes, UIO_READ, uio);
 			zfs_unmap_page(sf);
-			VM_OBJECT_LOCK(obj);
+			zfs_vmobject_wlock(obj);
 			page_unhold(pp);
 		} else {
-			VM_OBJECT_UNLOCK(obj);
+			zfs_vmobject_wunlock(obj);
 			error = dmu_read_uio(os, zp->z_id, uio, bytes);
-			VM_OBJECT_LOCK(obj);
+			zfs_vmobject_wlock(obj);
 		}
 		len -= bytes;
 		off = 0;
 		if (error)
 			break;
 	}
-	VM_OBJECT_UNLOCK(obj);
+	zfs_vmobject_wunlock(obj);
 	return (error);
 }
 
@@ -5684,7 +5685,7 @@ zfs_getpages(struct vnode *vp, vm_page_t
 	mfirst = m[reqstart];
 	mlast = m[reqstart + reqsize - 1];
 
-	VM_OBJECT_LOCK(object);
+	zfs_vmobject_wlock(object);
 
 	for (i = 0; i < reqstart; i++) {
 		vm_page_lock(m[i]);
@@ -5700,9 +5701,9 @@ zfs_getpages(struct vnode *vp, vm_page_t
 	if (mreq->valid && reqsize == 1) {
 		if (mreq->valid != VM_PAGE_BITS_ALL)
 			vm_page_zero_invalid(mreq, TRUE);
-		VM_OBJECT_UNLOCK(object);
+		zfs_vmobject_wunlock(object);
 		ZFS_EXIT(zfsvfs);
-		return (VM_PAGER_OK);
+		return (zfs_vm_pagerret_ok);
 	}
 
 	PCPU_INC(cnt.v_vnodein);
@@ -5716,16 +5717,16 @@ zfs_getpages(struct vnode *vp, vm_page_t
 				vm_page_unlock(m[i]);
 			}
 		}
-		VM_OBJECT_UNLOCK(object);
+		zfs_vmobject_wunlock(object);
 		ZFS_EXIT(zfsvfs);
-		return (VM_PAGER_BAD);
+		return (zfs_vm_pagerret_bad);
 	}
 
 	lsize = PAGE_SIZE;
 	if (IDX_TO_OFF(mlast->pindex) + lsize > object->un_pager.vnp.vnp_size)
 		lsize = object->un_pager.vnp.vnp_size - IDX_TO_OFF(mlast->pindex);
 
-	VM_OBJECT_UNLOCK(object);
+	zfs_vmobject_wunlock(object);
 
 	for (i = reqstart; i < reqstart + reqsize; i++) {
 		size = PAGE_SIZE;
@@ -5741,7 +5742,7 @@ zfs_getpages(struct vnode *vp, vm_page_t
 			break;
 	}
 
-	VM_OBJECT_LOCK(object);
+	zfs_vmobject_wlock(object);
 
 	for (i = reqstart; i < reqstart + reqsize; i++) {
 		if (!error)
@@ -5751,11 +5752,11 @@ zfs_getpages(struct vnode *vp, vm_page_t
 			vm_page_readahead_finish(m[i]);
 	}
 
-	VM_OBJECT_UNLOCK(object);
+	zfs_vmobject_wunlock(object);
 
 	ZFS_ACCESSTIME_STAMP(zfsvfs, zp);
 	ZFS_EXIT(zfsvfs);
-	return (error ? VM_PAGER_ERROR : VM_PAGER_OK);
+	return (error ? zfs_vm_pagerret_error : zfs_vm_pagerret_ok);
 }
 
 static int

Modified: user/attilio/vmcontention/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- user/attilio/vmcontention/sys/compat/linprocfs/linprocfs.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/compat/linprocfs/linprocfs.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -1031,9 +1031,9 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 		e_end = entry->end;
 		obj = entry->object.vm_object;
 		for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) {
-			VM_OBJECT_LOCK(tobj);
+			VM_OBJECT_WLOCK(tobj);
 			if (lobj != obj)
-				VM_OBJECT_UNLOCK(lobj);
+				VM_OBJECT_WUNLOCK(lobj);
 			lobj = tobj;
 		}
 		last_timestamp = map->timestamp;
@@ -1049,11 +1049,11 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 			else
 				vp = NULL;
 			if (lobj != obj)
-				VM_OBJECT_UNLOCK(lobj);
+				VM_OBJECT_WUNLOCK(lobj);
 			flags = obj->flags;
 			ref_count = obj->ref_count;
 			shadow_count = obj->shadow_count;
-			VM_OBJECT_UNLOCK(obj);
+			VM_OBJECT_WUNLOCK(obj);
 			if (vp) {
 				vn_fullpath(td, vp, &name, &freename);
 				vn_lock(vp, LK_SHARED | LK_RETRY);

Modified: user/attilio/vmcontention/sys/conf/files
==============================================================================
--- user/attilio/vmcontention/sys/conf/files	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/conf/files	Sat Mar  9 02:51:51 2013	(r248087)
@@ -157,6 +157,7 @@ cddl/compat/opensolaris/kern/opensolaris
 cddl/compat/opensolaris/kern/opensolaris_taskq.c			optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_uio.c				optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_vfs.c				optional zfs compile-with "${ZFS_C}"
+cddl/compat/opensolaris/kern/opensolaris_vm.c				optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_zone.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/acl/acl_common.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/avl/avl.c				optional zfs compile-with "${ZFS_C}"

Modified: user/attilio/vmcontention/sys/dev/agp/agp.c
==============================================================================
--- user/attilio/vmcontention/sys/dev/agp/agp.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/dev/agp/agp.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
+#include <sys/rwlock.h>
 
 #include <dev/agp/agppriv.h>
 #include <dev/agp/agpvar.h>
@@ -544,7 +545,7 @@ agp_generic_bind_memory(device_t dev, st
 	 * because vm_page_grab() may sleep and we can't hold a mutex
 	 * while sleeping.
 	 */
-	VM_OBJECT_LOCK(mem->am_obj);
+	VM_OBJECT_WLOCK(mem->am_obj);
 	for (i = 0; i < mem->am_size; i += PAGE_SIZE) {
 		/*
 		 * Find a page from the object and wire it
@@ -557,14 +558,14 @@ agp_generic_bind_memory(device_t dev, st
 		    VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
 		AGP_DPF("found page pa=%#jx\n", (uintmax_t)VM_PAGE_TO_PHYS(m));
 	}
-	VM_OBJECT_UNLOCK(mem->am_obj);
+	VM_OBJECT_WUNLOCK(mem->am_obj);
 
 	mtx_lock(&sc->as_lock);
 
 	if (mem->am_is_bound) {
 		device_printf(dev, "memory already bound\n");
 		error = EINVAL;
-		VM_OBJECT_LOCK(mem->am_obj);
+		VM_OBJECT_WLOCK(mem->am_obj);
 		i = 0;
 		goto bad;
 	}
@@ -573,7 +574,7 @@ agp_generic_bind_memory(device_t dev, st
 	 * Bind the individual pages and flush the chipset's
 	 * TLB.
 	 */
-	VM_OBJECT_LOCK(mem->am_obj);
+	VM_OBJECT_WLOCK(mem->am_obj);
 	for (i = 0; i < mem->am_size; i += PAGE_SIZE) {
 		m = vm_page_lookup(mem->am_obj, OFF_TO_IDX(i));
 
@@ -601,7 +602,7 @@ agp_generic_bind_memory(device_t dev, st
 		}
 		vm_page_wakeup(m);
 	}
-	VM_OBJECT_UNLOCK(mem->am_obj);
+	VM_OBJECT_WUNLOCK(mem->am_obj);
 
 	/*
 	 * Flush the cpu cache since we are providing a new mapping
@@ -622,7 +623,7 @@ agp_generic_bind_memory(device_t dev, st
 	return 0;
 bad:
 	mtx_unlock(&sc->as_lock);
-	VM_OBJECT_LOCK_ASSERT(mem->am_obj, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(mem->am_obj);
 	for (k = 0; k < mem->am_size; k += PAGE_SIZE) {
 		m = vm_page_lookup(mem->am_obj, OFF_TO_IDX(k));
 		if (k >= i)
@@ -631,7 +632,7 @@ bad:
 		vm_page_unwire(m, 0);
 		vm_page_unlock(m);
 	}
-	VM_OBJECT_UNLOCK(mem->am_obj);
+	VM_OBJECT_WUNLOCK(mem->am_obj);
 
 	return error;
 }
@@ -658,14 +659,14 @@ agp_generic_unbind_memory(device_t dev, 
 	 */
 	for (i = 0; i < mem->am_size; i += AGP_PAGE_SIZE)
 		AGP_UNBIND_PAGE(dev, mem->am_offset + i);
-	VM_OBJECT_LOCK(mem->am_obj);
+	VM_OBJECT_WLOCK(mem->am_obj);
 	for (i = 0; i < mem->am_size; i += PAGE_SIZE) {
 		m = vm_page_lookup(mem->am_obj, atop(i));
 		vm_page_lock(m);
 		vm_page_unwire(m, 0);
 		vm_page_unlock(m);
 	}
-	VM_OBJECT_UNLOCK(mem->am_obj);
+	VM_OBJECT_WUNLOCK(mem->am_obj);
 		
 	agp_flush_cache();
 	AGP_FLUSH_TLB(dev);

Modified: user/attilio/vmcontention/sys/dev/agp/agp_i810.c
==============================================================================
--- user/attilio/vmcontention/sys/dev/agp/agp_i810.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/dev/agp/agp_i810.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
+#include <sys/rwlock.h>
 
 #include <dev/agp/agppriv.h>
 #include <dev/agp/agpreg.h>
@@ -1967,10 +1968,10 @@ agp_i810_alloc_memory(device_t dev, int 
 			 * Allocate and wire down the page now so that we can
 			 * get its physical address.
 			 */
-			VM_OBJECT_LOCK(mem->am_obj);
+			VM_OBJECT_WLOCK(mem->am_obj);
 			m = vm_page_grab(mem->am_obj, 0, VM_ALLOC_NOBUSY |
 			    VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
-			VM_OBJECT_UNLOCK(mem->am_obj);
+			VM_OBJECT_WUNLOCK(mem->am_obj);
 			mem->am_physical = VM_PAGE_TO_PHYS(m);
 		} else {
 			/* Our allocation is already nicely wired down for us.
@@ -2005,12 +2006,12 @@ agp_i810_free_memory(device_t dev, struc
 			/*
 			 * Unwire the page which we wired in alloc_memory.
 			 */
-			VM_OBJECT_LOCK(mem->am_obj);
+			VM_OBJECT_WLOCK(mem->am_obj);
 			m = vm_page_lookup(mem->am_obj, 0);
 			vm_page_lock(m);
 			vm_page_unwire(m, 0);
 			vm_page_unlock(m);
-			VM_OBJECT_UNLOCK(mem->am_obj);
+			VM_OBJECT_WUNLOCK(mem->am_obj);
 		} else {
 			contigfree(sc->argb_cursor, mem->am_size, M_AGP);
 			sc->argb_cursor = NULL;

Modified: user/attilio/vmcontention/sys/dev/drm/drmP.h
==============================================================================
--- user/attilio/vmcontention/sys/dev/drm/drmP.h	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/dev/drm/drmP.h	Sat Mar  9 02:51:51 2013	(r248087)
@@ -59,6 +59,7 @@ struct drm_file;
 #include <sys/fcntl.h>
 #include <sys/uio.h>
 #include <sys/filio.h>
+#include <sys/rwlock.h>
 #include <sys/sysctl.h>
 #include <sys/bus.h>
 #include <sys/queue.h>

Modified: user/attilio/vmcontention/sys/dev/drm2/drmP.h
==============================================================================
--- user/attilio/vmcontention/sys/dev/drm2/drmP.h	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/dev/drm2/drmP.h	Sat Mar  9 02:51:51 2013	(r248087)
@@ -58,6 +58,7 @@ struct drm_file;
 #include <sys/fcntl.h>
 #include <sys/uio.h>
 #include <sys/filio.h>
+#include <sys/rwlock.h>
 #include <sys/selinfo.h>
 #include <sys/sysctl.h>
 #include <sys/bus.h>

Modified: user/attilio/vmcontention/sys/dev/drm2/drm_fb_helper.c
==============================================================================
--- user/attilio/vmcontention/sys/dev/drm2/drm_fb_helper.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/dev/drm2/drm_fb_helper.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -555,8 +555,11 @@ static void drm_fb_helper_crtc_free(stru
 	for (i = 0; i < helper->connector_count; i++)
 		free(helper->connector_info[i], DRM_MEM_KMS);
 	free(helper->connector_info, DRM_MEM_KMS);
-	for (i = 0; i < helper->crtc_count; i++)
+	for (i = 0; i < helper->crtc_count; i++) {
 		free(helper->crtc_info[i].mode_set.connectors, DRM_MEM_KMS);
+		if (helper->crtc_info[i].mode_set.mode)
+			drm_mode_destroy(helper->dev, helper->crtc_info[i].mode_set.mode);
+	}
 	free(helper->crtc_info, DRM_MEM_KMS);
 }
 

Modified: user/attilio/vmcontention/sys/dev/drm2/drm_global.c
==============================================================================
--- user/attilio/vmcontention/sys/dev/drm2/drm_global.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/dev/drm2/drm_global.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -104,6 +104,7 @@ void drm_global_item_unref(struct drm_gl
 	MPASS(ref->object == item->object);
 	if (--item->refcount == 0) {
 		ref->release(ref);
+		free(item->object, M_DRM_GLOBAL);
 		item->object = NULL;
 	}
 	sx_xunlock(&item->mutex);

Modified: user/attilio/vmcontention/sys/dev/drm2/i915/i915_gem.c
==============================================================================
--- user/attilio/vmcontention/sys/dev/drm2/i915/i915_gem.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/dev/drm2/i915/i915_gem.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -990,14 +990,14 @@ i915_gem_swap_io(struct drm_device *dev,
 	vm_obj = obj->base.vm_obj;
 	ret = 0;
 
-	VM_OBJECT_LOCK(vm_obj);
+	VM_OBJECT_WLOCK(vm_obj);
 	vm_object_pip_add(vm_obj, 1);
 	while (size > 0) {
 		obj_pi = OFF_TO_IDX(offset);
 		obj_po = offset & PAGE_MASK;
 
 		m = i915_gem_wire_page(vm_obj, obj_pi);
-		VM_OBJECT_UNLOCK(vm_obj);
+		VM_OBJECT_WUNLOCK(vm_obj);
 
 		sched_pin();
 		sf = sf_buf_alloc(m, SFB_CPUPRIVATE);
@@ -1031,7 +1031,7 @@ i915_gem_swap_io(struct drm_device *dev,
 		}
 		sf_buf_free(sf);
 		sched_unpin();
-		VM_OBJECT_LOCK(vm_obj);
+		VM_OBJECT_WLOCK(vm_obj);
 		if (rw == UIO_WRITE)
 			vm_page_dirty(m);
 		vm_page_reference(m);
@@ -1044,7 +1044,7 @@ i915_gem_swap_io(struct drm_device *dev,
 			break;
 	}
 	vm_object_pip_wakeup(vm_obj);
-	VM_OBJECT_UNLOCK(vm_obj);
+	VM_OBJECT_WUNLOCK(vm_obj);
 
 	return (ret);
 }
@@ -1357,7 +1357,7 @@ i915_gem_pager_fault(vm_object_t vm_obj,
 	} else
 		oldm = NULL;
 retry:
-	VM_OBJECT_UNLOCK(vm_obj);
+	VM_OBJECT_WUNLOCK(vm_obj);
 unlocked_vmobj:
 	cause = ret = 0;
 	m = NULL;
@@ -1407,7 +1407,7 @@ unlocked_vmobj:
 		list_move_tail(&obj->mm_list, &dev_priv->mm.inactive_list);
 
 	obj->fault_mappable = true;
-	VM_OBJECT_LOCK(vm_obj);
+	VM_OBJECT_WLOCK(vm_obj);
 	m = vm_phys_fictitious_to_vm_page(dev->agp->base + obj->gtt_offset +
 	    offset);
 	if (m == NULL) {
@@ -1452,7 +1452,7 @@ out:
 		kern_yield(PRI_USER);
 		goto unlocked_vmobj;
 	}
-	VM_OBJECT_LOCK(vm_obj);
+	VM_OBJECT_WLOCK(vm_obj);
 	vm_object_pip_wakeup(vm_obj);
 	return (VM_PAGER_ERROR);
 }
@@ -2208,12 +2208,12 @@ i915_gem_object_get_pages_gtt(struct drm
 	obj->pages = malloc(page_count * sizeof(vm_page_t), DRM_I915_GEM,
 	    M_WAITOK);
 	vm_obj = obj->base.vm_obj;
-	VM_OBJECT_LOCK(vm_obj);
+	VM_OBJECT_WLOCK(vm_obj);
 	for (i = 0; i < page_count; i++) {
 		if ((obj->pages[i] = i915_gem_wire_page(vm_obj, i)) == NULL)
 			goto failed;
 	}
-	VM_OBJECT_UNLOCK(vm_obj);
+	VM_OBJECT_WUNLOCK(vm_obj);
 	if (i915_gem_object_needs_bit17_swizzle(obj))
 		i915_gem_object_do_bit_17_swizzle(obj);
 	return (0);
@@ -2226,7 +2226,7 @@ failed:
 		vm_page_unlock(m);
 		atomic_add_long(&i915_gem_wired_pages_cnt, -1);
 	}
-	VM_OBJECT_UNLOCK(vm_obj);
+	VM_OBJECT_WUNLOCK(vm_obj);
 	free(obj->pages, DRM_I915_GEM);
 	obj->pages = NULL;
 	return (-EIO);
@@ -2272,7 +2272,7 @@ i915_gem_object_put_pages_gtt(struct drm
 	if (obj->madv == I915_MADV_DONTNEED)
 		obj->dirty = 0;
 	page_count = obj->base.size / PAGE_SIZE;
-	VM_OBJECT_LOCK(obj->base.vm_obj);
+	VM_OBJECT_WLOCK(obj->base.vm_obj);
 #if GEM_PARANOID_CHECK_GTT
 	i915_gem_assert_pages_not_mapped(obj->base.dev, obj->pages, page_count);
 #endif
@@ -2287,7 +2287,7 @@ i915_gem_object_put_pages_gtt(struct drm
 		vm_page_unlock(m);
 		atomic_add_long(&i915_gem_wired_pages_cnt, -1);
 	}
-	VM_OBJECT_UNLOCK(obj->base.vm_obj);
+	VM_OBJECT_WUNLOCK(obj->base.vm_obj);
 	obj->dirty = 0;
 	free(obj->pages, DRM_I915_GEM);
 	obj->pages = NULL;
@@ -2309,7 +2309,7 @@ i915_gem_release_mmap(struct drm_i915_ge
 	if (devobj != NULL) {
 		page_count = OFF_TO_IDX(obj->base.size);
 
-		VM_OBJECT_LOCK(devobj);
+		VM_OBJECT_WLOCK(devobj);
 retry:
 		for (i = 0; i < page_count; i++) {
 			m = vm_page_lookup(devobj, i);
@@ -2319,7 +2319,7 @@ retry:
 				goto retry;
 			cdev_pager_free_page(devobj, m);
 		}
-		VM_OBJECT_UNLOCK(devobj);
+		VM_OBJECT_WUNLOCK(devobj);
 		vm_object_deallocate(devobj);
 	}
 
@@ -2437,9 +2437,9 @@ i915_gem_object_truncate(struct drm_i915
 	vm_object_t vm_obj;
 
 	vm_obj = obj->base.vm_obj;
-	VM_OBJECT_LOCK(vm_obj);
+	VM_OBJECT_WLOCK(vm_obj);
 	vm_object_page_remove(vm_obj, 0, 0, false);
-	VM_OBJECT_UNLOCK(vm_obj);
+	VM_OBJECT_WUNLOCK(vm_obj);
 	obj->madv = I915_MADV_PURGED_INTERNAL;
 }
 
@@ -2488,7 +2488,7 @@ i915_gem_wire_page(vm_object_t object, v
 	vm_page_t m;
 	int rv;
 
-	VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
+	VM_OBJECT_ASSERT_WLOCKED(object);
 	m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
 	if (m->valid != VM_PAGE_BITS_ALL) {
 		if (vm_pager_has_page(object, pindex, NULL, NULL)) {
@@ -3567,13 +3567,13 @@ i915_gem_detach_phys_object(struct drm_d
 	vaddr = obj->phys_obj->handle->vaddr;
 
 	page_count = obj->base.size / PAGE_SIZE;
-	VM_OBJECT_LOCK(obj->base.vm_obj);
+	VM_OBJECT_WLOCK(obj->base.vm_obj);
 	for (i = 0; i < page_count; i++) {
 		m = i915_gem_wire_page(obj->base.vm_obj, i);
 		if (m == NULL)
 			continue; /* XXX */
 
-		VM_OBJECT_UNLOCK(obj->base.vm_obj);
+		VM_OBJECT_WUNLOCK(obj->base.vm_obj);
 		sf = sf_buf_alloc(m, 0);
 		if (sf != NULL) {
 			dst = (char *)sf_buf_kva(sf);
@@ -3582,7 +3582,7 @@ i915_gem_detach_phys_object(struct drm_d
 		}
 		drm_clflush_pages(&m, 1);
 
-		VM_OBJECT_LOCK(obj->base.vm_obj);
+		VM_OBJECT_WLOCK(obj->base.vm_obj);
 		vm_page_reference(m);
 		vm_page_lock(m);
 		vm_page_dirty(m);
@@ -3590,7 +3590,7 @@ i915_gem_detach_phys_object(struct drm_d
 		vm_page_unlock(m);
 		atomic_add_long(&i915_gem_wired_pages_cnt, -1);
 	}
-	VM_OBJECT_UNLOCK(obj->base.vm_obj);
+	VM_OBJECT_WUNLOCK(obj->base.vm_obj);
 	intel_gtt_chipset_flush();
 
 	obj->phys_obj->cur_obj = NULL;
@@ -3632,7 +3632,7 @@ i915_gem_attach_phys_object(struct drm_d
 
 	page_count = obj->base.size / PAGE_SIZE;
 
-	VM_OBJECT_LOCK(obj->base.vm_obj);
+	VM_OBJECT_WLOCK(obj->base.vm_obj);
 	ret = 0;
 	for (i = 0; i < page_count; i++) {
 		m = i915_gem_wire_page(obj->base.vm_obj, i);
@@ -3640,14 +3640,14 @@ i915_gem_attach_phys_object(struct drm_d
 			ret = -EIO;
 			break;
 		}
-		VM_OBJECT_UNLOCK(obj->base.vm_obj);
+		VM_OBJECT_WUNLOCK(obj->base.vm_obj);
 		sf = sf_buf_alloc(m, 0);
 		src = (char *)sf_buf_kva(sf);
 		dst = (char *)obj->phys_obj->handle->vaddr + IDX_TO_OFF(i);
 		memcpy(dst, src, PAGE_SIZE);
 		sf_buf_free(sf);
 
-		VM_OBJECT_LOCK(obj->base.vm_obj);
+		VM_OBJECT_WLOCK(obj->base.vm_obj);
 
 		vm_page_reference(m);
 		vm_page_lock(m);
@@ -3655,7 +3655,7 @@ i915_gem_attach_phys_object(struct drm_d
 		vm_page_unlock(m);
 		atomic_add_long(&i915_gem_wired_pages_cnt, -1);
 	}
-	VM_OBJECT_UNLOCK(obj->base.vm_obj);
+	VM_OBJECT_WUNLOCK(obj->base.vm_obj);
 
 	return (0);
 }

Modified: user/attilio/vmcontention/sys/dev/drm2/ttm/ttm_bo.c
==============================================================================
--- user/attilio/vmcontention/sys/dev/drm2/ttm/ttm_bo.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/dev/drm2/ttm/ttm_bo.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -1400,7 +1400,6 @@ static void ttm_bo_global_kobj_release(s
 
 	ttm_mem_unregister_shrink(glob->mem_glob, &glob->shrink);
 	vm_page_free(glob->dummy_read_page);
-	free(glob, M_DRM_GLOBAL);
 }
 
 void ttm_bo_global_release(struct drm_global_reference *ref)

Modified: user/attilio/vmcontention/sys/dev/drm2/ttm/ttm_bo_vm.c
==============================================================================
--- user/attilio/vmcontention/sys/dev/drm2/ttm/ttm_bo_vm.c	Sat Mar  9 02:42:52 2013	(r248086)
+++ user/attilio/vmcontention/sys/dev/drm2/ttm/ttm_bo_vm.c	Sat Mar  9 02:51:51 2013	(r248087)
@@ -118,7 +118,7 @@ ttm_bo_vm_fault(vm_object_t vm_obj, vm_o
 	} else
 		oldm = NULL;
 retry:
-	VM_OBJECT_UNLOCK(vm_obj);
+	VM_OBJECT_WUNLOCK(vm_obj);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303090251.r292ppiF073438>