Subject: problem in mips pmap figured out...
To: None <port-evbmips@NetBSD.org, port-mips@NetBSD.org>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: port-mips
Date: 03/29/2006 13:03:33
I've figured out the problem in the MIPS pmap that breaks munmap() of
mapped 64-bit paddr_ts (i.e. high PCI memory space on evbmips.)
It turns out that the code was trying to pmap_remove_pv of unmanaged
(high physical memory) mappings. Note that pmap_enter already checks
these mappings, and does not enter them, so it is a bad idea to try to
remove them. :-)
Here's my diff, which seems to fix it. Please review, and if OK, then I
will commit:
*** pmap.c.~1.166.~ Sat Dec 24 12:07:19 2005
--- pmap.c Wed Mar 29 12:52:07 2006
***************
*** 730,736 ****
pmap->pm_stats.wired_count--;
pmap->pm_stats.resident_count--;
pg = PHYS_TO_VM_PAGE(mips_tlbpfn_to_paddr(entry));
! pmap_remove_pv(pmap, sva, pg);
if (MIPS_HAS_R4K_MMU)
/* See above about G bit */
pte->pt_entry = MIPS3_PG_NV | MIPS3_PG_G;
--- 730,737 ----
pmap->pm_stats.wired_count--;
pmap->pm_stats.resident_count--;
pg = PHYS_TO_VM_PAGE(mips_tlbpfn_to_paddr(entry));
! if (pg)
! pmap_remove_pv(pmap, sva, pg);
if (MIPS_HAS_R4K_MMU)
/* See above about G bit */
pte->pt_entry = MIPS3_PG_NV | MIPS3_PG_G;
***************
*** 789,795 ****
pmap->pm_stats.wired_count--;
pmap->pm_stats.resident_count--;
pg = PHYS_TO_VM_PAGE(mips_tlbpfn_to_paddr(entry));
! pmap_remove_pv(pmap, sva, pg);
pte->pt_entry = mips_pg_nv_bit();
/*
* Flush the TLB for the given address.
--- 790,797 ----
pmap->pm_stats.wired_count--;
pmap->pm_stats.resident_count--;
pg = PHYS_TO_VM_PAGE(mips_tlbpfn_to_paddr(entry));
! if (pg)
! pmap_remove_pv(pmap, sva, pg);
pte->pt_entry = mips_pg_nv_bit();
/*
* Flush the TLB for the given address.
--
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134 Fax: 951 325-2191