From owner-p4-projects@FreeBSD.ORG Thu May 4 22:38:31 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5E5C916A403; Thu, 4 May 2006 22:38:31 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 36D8C16A401 for ; Thu, 4 May 2006 22:38:31 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 02FCD43D45 for ; Thu, 4 May 2006 22:38:31 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k44McUDj071731 for ; Thu, 4 May 2006 22:38:30 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k44McU6Z071720 for perforce@freebsd.org; Thu, 4 May 2006 22:38:30 GMT (envelope-from kmacy@freebsd.org) Date: Thu, 4 May 2006 22:38:30 GMT Message-Id: <200605042238.k44McU6Z071720@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 96671 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2006 22:38:31 -0000 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); } /*