From owner-freebsd-arm@FreeBSD.ORG Tue Jul 7 14:02:34 2009 Return-Path: Delivered-To: freebsd-arm@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00FED1065673; Tue, 7 Jul 2009 14:02:34 +0000 (UTC) (envelope-from tinguely@casselton.net) Received: from casselton.net (casselton.net [63.165.140.2]) by mx1.freebsd.org (Postfix) with ESMTP id B11D38FC14; Tue, 7 Jul 2009 14:02:33 +0000 (UTC) (envelope-from tinguely@casselton.net) Received: from casselton.net (localhost [127.0.0.1]) by casselton.net (8.14.3/8.14.3) with ESMTP id n67E2Wmm010355; Tue, 7 Jul 2009 09:02:32 -0500 (CDT) (envelope-from tinguely@casselton.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=casselton.net; s=ccnMail; t=1246975352; bh=KMg9yhtXy5UTtOhLkKJhLvthfhASD1AAm1s43XBWIko=; h=Date:From:Message-Id:To:Subject:Cc:In-Reply-To; b=HUxG/NTTddULYU/QsZiMH8S015FL02VXsuGH7EIqn3vCXAU1ydP3sy6YVbsC6Vwte 6xeGlcJVz9kIZ5Lzg9UNu8S1hgo6ucIcMM8bLmS1scDyt96Frhyvh5ifWnEpKquj0B XDy5LnwNkc+4RyNj86xnMs5lbS80CeASIeuh4Y8Y= Received: (from tinguely@localhost) by casselton.net (8.14.3/8.14.2/Submit) id n67E2WgH010354; Tue, 7 Jul 2009 09:02:32 -0500 (CDT) (envelope-from tinguely) Date: Tue, 7 Jul 2009 09:02:32 -0500 (CDT) From: Mark Tinguely Message-Id: <200907071402.n67E2WgH010354@casselton.net> To: mih@semihalf.com, stas@FreeBSD.org, tinguely@casselton.net In-Reply-To: <200907061714.n66HEqsV063372@casselton.net> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.2 (casselton.net [127.0.0.1]); Tue, 07 Jul 2009 09:02:32 -0500 (CDT) Cc: freebsd-arm@FreeBSD.org Subject: Re: pmap problem in FreeBSD current X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jul 2009 14:02:34 -0000 In arm_remap_nocache()/arm_unmap_nocache() a kernel shadow mapping is made for BUS_DMA_COHERENT pages but is not removed. It is probably one place that causes undeleted mappings required us to add the tail "if" statement in pmap_nuke_pv() that I mentioned yesterday. FYI future ideas: we can get rid of the shadow KVA for the BUS_DMA_COHERENT by setting a bit in the page flags to denote a no_cache situation. The pmap code can see that bit and refraim from turning caching on in pmap_fix_cache(). Speaking of pmap_nuke_pv() and in regards to my yesterday email, the more I think of it, the more I believe the line "pg->md.pvh_attrs &= ~PVF_MOD;" should remain in the code. The line, "vm_page_flag_clear(pg, PG_WRITEABLE);" should be remove to avoid corruption. It would be nice to remove all these unremoved mappings so that "if" statement in pmap_nuke_pv() is unecessary. If we can't find all of these unremoved mappings, we may need to clean out md.pv_kva when a page is freed (or allocated) because we may be tricked into thinking the page is shared when it really is not. This would not cause corruption, but the cache will be turned off unnecessarily on a really unshared page. vm_machdep.c: void arm_unmap_nocache(void *addr, vm_size_t size) { vm_offset_t raddr = (vm_offset_t)addr; int i; size = round_page(size); i = (raddr - arm_nocache_startaddr) / (PAGE_SIZE); - for (; size > 0; size -= PAGE_SIZE, i++) + for (; size > 0; size -= PAGE_SIZE, i++) { arm_nocache_allocated[i / BITS_PER_INT] &= ~(1 << (i % BITS_PER_INT)); + pmap_kremove(raddr); + raddr += PAGE_SIZE; } --Mark Tinguely