From owner-p4-projects@FreeBSD.ORG Fri Mar 12 11:03:09 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A78B116A4D0; Fri, 12 Mar 2004 11:03:09 -0800 (PST) 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 7C35F16A4CE for ; Fri, 12 Mar 2004 11:03:09 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B6B543D3F for ; Fri, 12 Mar 2004 11:03:09 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i2CJ39Ge056822 for ; Fri, 12 Mar 2004 11:03:09 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i2CJ38R3056819 for perforce@freebsd.org; Fri, 12 Mar 2004 11:03:09 -0800 (PST) (envelope-from jmallett@freebsd.org) Date: Fri, 12 Mar 2004 11:03:09 -0800 (PST) Message-Id: <200403121903.i2CJ38R3056819@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 48801 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2004 19:03:10 -0000 http://perforce.freebsd.org/chv.cgi?CH=48801 Change 48801 by jmallett@jmallett_oingo on 2004/03/12 11:03:06 submit the night's work... add some comments... set up xcontext, curious to see if that works... panic when i don't mean printf... printf when i can't live with panic, right now. Affected files ... .. //depot/projects/mips/sys/mips/mips/tlb.c#23 edit Differences ... ==== //depot/projects/mips/sys/mips/mips/tlb.c#23 (text+ko) ==== @@ -59,6 +59,14 @@ pt_entry_t *kptmap; vm_size_t kptsize; +/* + * I think I want to keep a "wired" TLB map here, with space for PTEs + * for the whole TLB, allocated in tlb_bootstrap(), and then sourced + * for invalidate() operations, this has the added effect of making + * invalidate_all() update wired entries, without making it just avoid + * a part of the TLB. + */ + #ifdef notyet /* * XXX Move the ASID code here. @@ -78,7 +86,7 @@ kptsize = pages; kptmap = (pt_entry_t *) (*ptalloc)(kptsize * sizeof (pt_entry_t)); - printf("Kernel page table maps %ld %dK pages\n", pages, PAGE_SIZE / 1024); + printf("Kernel page table maps %ld %dK pages and is %ldK\n", pages, PAGE_SIZE / 1024, (kptsize * sizeof (pt_entry_t)) / 1024); /* * Set global bit on all pages. @@ -99,6 +107,11 @@ * Just one wired TLB entry. */ mips_wr_wired(1); + + /* + * Set up page table. + */ + mips_wr_xcontext((uintptr_t)kptmap); } void @@ -113,7 +126,7 @@ if (pte_valid(pte)) tlb_invalidate_page(va); if ((bits & PG_V) == 0) - printf("pmap %p entering invalid mapping for va %lx to pa %lx [%lx]\n", + panic("pmap %p entering invalid mapping for va %lx to pa %lx [%lx]", pmap, (u_long)va, (u_long)pa, (u_long)bits); *pte &= PG_G; *pte |= MIPS_PA_TO_PFN(pa) | bits; @@ -211,6 +224,15 @@ /* * PTE was not dirty and is being written to. XXX kernel only for now. + * + * XXX So it looks like something is broken above, because we end up + * with duplicate EntryHi's in the TLB, and that's how we get here. + * I think maybe the TLBL/TLBS routing is wrong, but I'm not prepared + * to bet on that. I will probably do a brief indirection though, and + * check tlbp. I guess ideally the TLBMiss handler would be called with + * an Index, since we can obviously just choose a Random one, and so + * forth, rather than using tlbwr, that'd make overloading said handler + * a lot easier. But I'm probably just a bad person. */ void tlb_modified(void *badvaddr) @@ -228,8 +250,10 @@ panic("write to invalid page"); if (pte_ro(pte)) panic("write to ro page"); - if (pte_dirty(pte)) - panic("dirty page caused a TLBMod"); + if (pte_dirty(pte)) { + tlb_invalidate_all(); + printf("dirty page caused a TLBMod\n"); + } /* * Mark the page dirty.