Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 May 2014 22:39:00 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r266599 - in user/attilio/rm_vmobj_cache/sys: dev/drm2/ttm x86/iommu
Message-ID:  <201405232239.s4NMd0pZ093197@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Fri May 23 22:39:00 2014
New Revision: 266599
URL: http://svnweb.freebsd.org/changeset/base/266599

Log:
  Page allocated by vm_page_alloc_contig() are always unmanaged, then
  wire them.

Modified:
  user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_bo.c
  user/attilio/rm_vmobj_cache/sys/x86/iommu/intel_utils.c

Modified: user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_bo.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_bo.c	Fri May 23 21:24:31 2014	(r266598)
+++ user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_bo.c	Fri May 23 22:39:00 2014	(r266599)
@@ -1472,6 +1472,7 @@ static void ttm_bo_global_kobj_release(s
 {
 
 	ttm_mem_unregister_shrink(glob->mem_glob, &glob->shrink);
+	vm_page_unwire(glob->dummy_read_page, 0);
 	vm_page_free(glob->dummy_read_page);
 }
 
@@ -1494,7 +1495,7 @@ int ttm_bo_global_init(struct drm_global
 	mtx_init(&glob->lru_lock, "ttmlru", NULL, MTX_DEF);
 	glob->mem_glob = bo_ref->mem_glob;
 	glob->dummy_read_page = vm_page_alloc_contig(NULL, 0,
-	    VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ,
+	    VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED,
 	    1, 0, VM_MAX_ADDRESS, PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE);
 
 	if (unlikely(glob->dummy_read_page == NULL)) {
@@ -1518,6 +1519,7 @@ int ttm_bo_global_init(struct drm_global
 	return (0);
 
 out_no_shrink:
+	vm_page_unwire(glob->dummy_read_page, 0);
 	vm_page_free(glob->dummy_read_page);
 out_no_drp:
 	free(glob, M_DRM_GLOBAL);

Modified: user/attilio/rm_vmobj_cache/sys/x86/iommu/intel_utils.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/x86/iommu/intel_utils.c	Fri May 23 21:24:31 2014	(r266598)
+++ user/attilio/rm_vmobj_cache/sys/x86/iommu/intel_utils.c	Fri May 23 22:39:00 2014	(r266599)
@@ -272,8 +272,8 @@ dmar_pgalloc(vm_object_t obj, vm_pindex_
 			break;
 		}
 		m = vm_page_alloc_contig(obj, idx, VM_ALLOC_NOBUSY |
-		    VM_ALLOC_SYSTEM | VM_ALLOC_NODUMP | zeroed, 1, 0,
-		    dmar_high, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT);
+		    VM_ALLOC_SYSTEM | VM_ALLOC_NODUMP | VM_ALLOC_WIRED |
+		    zeroed, 1, 0, dmar_high, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT);
 		if ((flags & DMAR_PGF_OBJL) == 0)
 			VM_OBJECT_WUNLOCK(obj);
 		if (m != NULL) {
@@ -302,6 +302,7 @@ dmar_pgfree(vm_object_t obj, vm_pindex_t
 		VM_OBJECT_WLOCK(obj);
 	m = vm_page_lookup(obj, idx);
 	if (m != NULL) {
+		vm_page_unwire(m, 0);
 		vm_page_free(m);
 		atomic_subtract_int(&dmar_tbl_pagecnt, 1);
 	}



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