Date: Thu, 4 May 2006 22:38:30 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96671 for review Message-ID: <200605042238.k44McU6Z071720@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96671 Change 96671 by kmacy@kmacy_storage:sun4v_rwbuf on 2006/05/04 22:38:10 pmap_kenter doesn't guarantee that the mapping isn't already in use so change to tte_hash_update avoid duplicate entry in pmap_enter_quick Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#44 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#44 (text+ko) ==== @@ -962,13 +962,11 @@ tte_data |= VTD_X; if (wired) tte_data |= VTD_WIRED; - if (pmap == kernel_pmap) tte_data |= TTE_KERNEL_MINFLAGS; - else - tte_data |= TTE_MINFLAGS; + - otte_data = tte_hash_update(pmap->pm_hash, va, tte_data); + otte_data = tte_hash_update(pmap->pm_hash, va, tte_data | TTE_MINFLAGS); invlva = FALSE; if ((otte_data & ~(VTD_W|VTD_REF)) != tte_data) { if (otte_data & VTD_V) { @@ -1005,7 +1003,7 @@ vm_page_t mpte) { - uint64_t tte_data; + tte_t tte_data; if (pmap->pm_context) DPRINTF("pmap_enter_quick(ctx=0x%lx va=%lx, pa=0x%lx prot=%x)\n", @@ -1013,9 +1011,12 @@ mtx_assert(&vm_page_queue_mtx, MA_OWNED); VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + PMAP_LOCK(pmap); - + if (tte_hash_lookup(pmap->pm_hash, va)) + goto done; + tte_data = VM_PAGE_TO_PHYS(m); /* * Enter on the PV list if part of our managed memory. Note that we @@ -1034,10 +1035,9 @@ if (pmap == kernel_pmap) tte_data |= TTE_KERNEL_MINFLAGS; - else - tte_data |= TTE_MINFLAGS; tte_hash_insert(pmap->pm_hash, va, tte_data | TTE_MINFLAGS); +done: PMAP_UNLOCK(pmap); return (0); @@ -1342,7 +1342,7 @@ static void pmap_kenter(vm_offset_t va, vm_paddr_t pa) { - tte_hash_insert(kernel_pmap->pm_hash, va, pa | TTE_KERNEL | VTD_8K); + tte_hash_update(kernel_pmap->pm_hash, va, pa | TTE_KERNEL | VTD_8K); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605042238.k44McU6Z071720>