Date: Sun, 7 May 2006 21:22:33 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96787 for review Message-ID: <200605072122.k47LMXG5023563@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96787 Change 96787 by kmacy@kmacy_storage:sun4v_rwbuf on 2006/05/07 21:22:08 largely more verbose error checking remove redundant page zeroing Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#47 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#47 (text+ko) ==== @@ -179,7 +179,7 @@ #ifdef PMAP_DEBUG #define KDPRINTF if (pmap_debug) printf #define DPRINTF \ - if ((PCPU_GET(cpumask) & PCPU_GET(curpmap)->pm_active) == 0) \ + if ((PCPU_GET(curpmap)->pm_context != 0) && (PCPU_GET(cpumask) & PCPU_GET(curpmap)->pm_active) == 0) \ panic("cpumask(0x%x) & active (0x%x) == 0 pid == %d\n", \ PCPU_GET(cpumask), PCPU_GET(curpmap)->pm_active, curthread->td_proc->p_pid); \ if (pmap_debug) printf @@ -392,20 +392,18 @@ pmap_t pmap, oldpmap; DPRINTF("activating pmap for %d\n", td->td_tid); - spinlock_enter(); + critical_enter(); pmap = vmspace_pmap(td->td_proc->p_vmspace); oldpmap = PCPU_GET(curpmap); #if defined(SMP) atomic_clear_int(&oldpmap->pm_active, PCPU_GET(cpumask)); - pmap->pm_tlbactive = pmap->pm_active = PCPU_GET(cpumask); - + atomic_set_int(&pmap->pm_tlbactive, PCPU_GET(cpumask)); + atomic_set_int(&pmap->pm_active, PCPU_GET(cpumask)); #else oldpmap->pm_active &= ~1; pmap->pm_active |= 1; pmap->pm_tlbactive |= 1; #endif - /* XXX Is this necessary? */ - pmap_invalidate_all(pmap); pmap->pm_hashscratch = tte_hash_set_scratchpad_user(pmap->pm_hash, pmap->pm_context); pmap->pm_tsbscratch = tsb_set_scratchpad_user(&pmap->pm_tsb); @@ -413,7 +411,7 @@ hv_set_ctxnon0(1, pmap->pm_tsb_ra); stxa(MMU_CID_S, ASI_MMU_CONTEXTID, pmap->pm_context); membar(Sync); - spinlock_exit(); + critical_exit(); } vm_offset_t @@ -564,8 +562,6 @@ kernel_hash_pa = pmap_bootstrap_alloc(PAGE_SIZE_4M); if (kernel_hash_pa & PAGE_MASK_4M) panic("pmap_bootstrap: hashtable pa unaligned\n"); - pmap_scrub_pages(kernel_hash_pa, PAGE_SIZE_4M); - printf("allocated hash\n"); /* * Set up TSB descriptors for the hypervisor * @@ -620,11 +616,6 @@ kernel_td[TSB4M_INDEX].hvtsb_rsvd = 0; kernel_td[TSB4M_INDEX].hvtsb_pa = pa; - pmap_scrub_pages(kernel_td[TSB8K_INDEX].hvtsb_pa, tsb_8k_size); - - pmap_scrub_pages(kernel_td[TSB4M_INDEX].hvtsb_pa, tsb_4m_size); - - /* * allocate MMU fault status areas for all CPUS */ @@ -657,6 +648,9 @@ for (i = 0; phys_avail[i + 2] != 0; i += 2) KDPRINTF("phys_avail[%d]=0x%lx phys_avail[%d]=0x%lx\n", i, phys_avail[i], i+1, phys_avail[i+1]); + KDPRINTF("phys_avail[%d]=0x%lx phys_avail[%d]=0x%lx\n", + i, phys_avail[i], i+1, phys_avail[i+1]); + Maxmem = sparc64_btop(phys_avail[i + 1]); /* @@ -897,6 +891,14 @@ tte_data = pa = VM_PAGE_TO_PHYS(m); otte_data = tte_hash_lookup(pmap->pm_hash, va); opa = TTE_GET_PA(otte_data); +#ifdef PMAP_DEBUG + if (opa > (1 << 31)) + panic("opa out of range 0x%lx\n", opa); + if ((vm_offset_t)PHYS_TO_VM_PAGE(opa) > ((1UL << 31) | VM_MIN_DIRECT_ADDRESS)) { + DELAY(curcpu*5000); + panic("om out of range %p\n", PHYS_TO_VM_PAGE(opa)); + } +#endif /* * Mapping has not changed, must be protection or wiring change. */ @@ -1003,7 +1005,7 @@ tte_t tte_data; if (pmap->pm_context) - DPRINTF("pmap_enter_quick(ctx=0x%lx va=%lx, pa=0x%lx prot=%x)\n", + KDPRINTF("pmap_enter_quick(ctx=0x%lx va=%lx, pa=0x%lx prot=%x)\n", pmap->pm_context, va, VM_PAGE_TO_PHYS(m), prot); mtx_assert(&vm_page_queue_mtx, MA_OWNED); @@ -1128,7 +1130,7 @@ { pv_entry_t pv; - DPRINTF("pmap_insert_entry(va=0x%lx, pa=0x%lx)\n", va, VM_PAGE_TO_PHYS(m)); + KDPRINTF("pmap_insert_entry(va=0x%lx, pa=0x%lx)\n", va, VM_PAGE_TO_PHYS(m)); pv = get_pv_entry(pmap); pv->pv_va = va; pv->pv_pmap = pmap; @@ -1172,7 +1174,7 @@ if (cpumask == pmap->pm_tlbactive) return; - if (pmap != kernel_pmap) + if (pmap->pm_context != 0) active = (pmap->pm_tlbactive & ~cpumask); else active = PCPU_GET(other_cpus); @@ -1485,8 +1487,7 @@ pmap_pinit0(pmap_t pmap) { PMAP_LOCK_INIT(pmap); - pmap->pm_active = ~0; - pmap->pm_tlbactive = ~0; + pmap->pm_active = pmap->pm_tlbactive = ~0; pmap->pm_context = 0; PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvlist); @@ -1505,8 +1506,7 @@ pmap->pm_hash = tte_hash_create(pmap->pm_context, &pmap->pm_hashscratch); pmap->pm_tsb_ra = tsb_init(&pmap->pm_tsb, &pmap->pm_tsbscratch); - pmap->pm_active = 0; - pmap->pm_tlbactive = 0; + pmap->pm_active = pmap->pm_tlbactive = 0; TAILQ_INIT(&pmap->pm_pvlist); PMAP_LOCK_INIT(pmap); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -1741,7 +1741,7 @@ break; } } - KASSERT(pv != NULL, ("pmap_remove_entry: pv not found")); + KASSERT(pv != NULL, ("pmap_remove_entry: pv not found va=0x%lx pa=0x%lx", va, VM_PAGE_TO_PHYS(m))); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); m->md.pv_list_count--; if (TAILQ_EMPTY(&m->md.pv_list))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605072122.k47LMXG5023563>