Date: Thu, 23 Dec 2004 20:48:48 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 67609 for review Message-ID: <200412232048.iBNKmmS5085059@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=67609 Change 67609 by jhb@jhb_slimer on 2004/12/23 20:48:47 IFC @67608. Loop back simple changes from jhb_clock. Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/pmap.c#67 integrate .. //depot/projects/smpng/sys/amd64/amd64/pmap.c#40 integrate .. //depot/projects/smpng/sys/arm/arm/pmap.c#11 integrate .. //depot/projects/smpng/sys/i386/i386/intr_machdep.c#12 integrate .. //depot/projects/smpng/sys/i386/i386/local_apic.c#22 integrate .. //depot/projects/smpng/sys/i386/i386/mp_machdep.c#78 integrate .. //depot/projects/smpng/sys/i386/i386/pmap.c#80 integrate .. //depot/projects/smpng/sys/i386/include/apicreg.h#3 integrate .. //depot/projects/smpng/sys/i386/include/intr_machdep.h#5 integrate .. //depot/projects/smpng/sys/ia64/ia64/pmap.c#67 integrate .. //depot/projects/smpng/sys/powerpc/powerpc/pmap.c#49 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/pmap.c#55 integrate .. //depot/projects/smpng/sys/vm/vm_fault.c#44 integrate .. //depot/projects/smpng/sys/vm/vm_map.c#69 integrate Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/pmap.c#67 (text+ko) ==== @@ -148,7 +148,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.175 2004/12/15 19:55:03 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.176 2004/12/23 20:16:09 alc Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1799,7 +1799,6 @@ * 2. Not wired. * 3. Read access. * 4. No page table pages. - * 5. Tlbflush is deferred to calling procedure. * 6. Page IS managed. * but is *MUCH* faster than pmap_enter... */ @@ -1810,7 +1809,8 @@ register pt_entry_t *pte; int managed; - vm_page_lock_queues(); + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); PMAP_LOCK(pmap); /* @@ -1905,7 +1905,6 @@ *pte = pmap_phys_to_pte(VM_PAGE_TO_PHYS(m)) | PG_V | PG_KRE | PG_URE | managed; out: alpha_pal_imb(); /* XXX overkill? */ - vm_page_unlock_queues(); PMAP_UNLOCK(pmap); return mpte; } ==== //depot/projects/smpng/sys/amd64/amd64/pmap.c#40 (text+ko) ==== @@ -75,7 +75,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.513 2004/12/21 19:25:56 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.514 2004/12/23 20:16:09 alc Exp $"); /* * Manages physical address maps. @@ -2007,7 +2007,6 @@ * 2. Not wired. * 3. Read access. * 4. No page table pages. - * 5. Tlbflush is deferred to calling procedure. * 6. Page IS managed. * but is *MUCH* faster than pmap_enter... */ @@ -2018,7 +2017,8 @@ pt_entry_t *pte; vm_paddr_t pa; - vm_page_lock_queues(); + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); PMAP_LOCK(pmap); /* @@ -2110,7 +2110,6 @@ else pte_store(pte, pa | PG_V | PG_U | PG_MANAGED); out: - vm_page_unlock_queues(); PMAP_UNLOCK(pmap); return mpte; } ==== //depot/projects/smpng/sys/arm/arm/pmap.c#11 (text+ko) ==== @@ -147,7 +147,7 @@ #include "opt_vm.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/pmap.c,v 1.21 2004/12/15 19:55:04 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/pmap.c,v 1.22 2004/12/23 20:16:10 alc Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -3409,7 +3409,6 @@ * 2. Not wired. * 3. Read access. * 4. No page table pages. - * 5. Tlbflush is deferred to calling procedure. * 6. Page IS managed. * but is *MUCH* faster than pmap_enter... */ @@ -3418,7 +3417,6 @@ pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t mpte) { - vm_page_lock_queues(); vm_page_busy(m); vm_page_unlock_queues(); VM_OBJECT_UNLOCK(m->object); @@ -3429,7 +3427,6 @@ VM_OBJECT_LOCK(m->object); vm_page_lock_queues(); vm_page_wakeup(m); - vm_page_unlock_queues(); return (NULL); } ==== //depot/projects/smpng/sys/i386/i386/intr_machdep.c#12 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/i386/intr_machdep.c,v 1.12 2004/12/06 22:25:01 ups Exp $ + * $FreeBSD: src/sys/i386/i386/intr_machdep.c,v 1.13 2004/12/23 20:34:18 jhb Exp $ */ /* @@ -286,6 +286,17 @@ is->is_straycount = &intrcnt[is->is_index + 1]; } +void +intrcnt_add(const char *name, u_long **countp) +{ + + mtx_lock_spin(&intr_table_lock); + *countp = &intrcnt[intrcnt_index]; + intrcnt_setname(name, intrcnt_index); + intrcnt_index++; + mtx_unlock_spin(&intr_table_lock); +} + static void intr_init(void *dummy __unused) { ==== //depot/projects/smpng/sys/i386/i386/local_apic.c#22 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/local_apic.c,v 1.10 2004/12/23 19:47:58 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/local_apic.c,v 1.11 2004/12/23 20:42:53 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -97,10 +97,10 @@ static struct lvt lvts[LVT_MAX + 1] = { { 1, 1, 1, 1, APIC_LVT_DM_EXTINT, 0 }, /* LINT0: masked ExtINT */ { 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 }, /* LINT1: NMI */ - { 1, 1, 1, 1, APIC_LVT_DM_FIXED, 0 }, /* Timer: needs a vector */ - { 1, 1, 1, 1, APIC_LVT_DM_FIXED, 0 }, /* Error: needs a vector */ + { 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_TIMER_INT }, /* Timer */ + { 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_ERROR_INT }, /* Error */ { 1, 1, 1, 1, APIC_LVT_DM_FIXED, 0 }, /* PMC */ - { 1, 1, 1, 1, APIC_LVT_DM_FIXED, 0 }, /* Thermal: needs a vector */ + { 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_THERMAL_INT }, /* Thermal */ }; static inthand_t *ioint_handlers[] = { @@ -116,6 +116,9 @@ volatile lapic_t *lapic; +static void lapic_enable(void); +static uint32_t lvt_mode(struct lapic *la, u_int pin, uint32_t value); + static uint32_t lvt_mode(struct lapic *la, u_int pin, uint32_t value) { @@ -149,11 +152,7 @@ /* Use a vector of 0. */ break; case APIC_LVT_DM_FIXED: -#if 0 value |= lvt->lvt_vector; -#else - panic("Fixed LINT pins not supported"); -#endif break; default: panic("bad APIC LVT delivery mode: %#x\n", value); @@ -167,7 +166,6 @@ void lapic_init(uintptr_t addr) { - u_int32_t value; /* Map the local APIC and setup the spurious interrupt handler. */ KASSERT(trunc_page(addr) == addr, @@ -177,10 +175,7 @@ GSEL(GCODE_SEL, SEL_KPL)); /* Perform basic initialization of the BSP's local APIC. */ - value = lapic->svr; - value &= ~(APIC_SVR_VECTOR | APIC_SVR_FOCUS); - value |= (APIC_SVR_FEN | APIC_SVR_SWEN | APIC_SPURIOUS_INT); - lapic->svr = value; + lapic_enable(); /* Set BSP's per-CPU local APIC ID. */ PCPU_SET(apic_id, lapic_id()); @@ -233,6 +228,9 @@ lapic->id, lapic->version, lapic->ldr, lapic->dfr); printf(" lint0: 0x%08x lint1: 0x%08x TPR: 0x%08x SVR: 0x%08x\n", lapic->lvt_lint0, lapic->lvt_lint1, lapic->tpr, lapic->svr); + printf(" timer: 0x%08x therm: 0x%08x err: 0x%08x pcm: 0x%08x\n", + lapic->lvt_timer, lapic->lvt_thermal, lapic->lvt_error, + lapic->lvt_pcint); } void @@ -260,12 +258,6 @@ eflags = intr_disable(); maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; - /* Program LINT[01] LVT entries. */ - lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0); - lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1); - - /* XXX: more LVT entries */ - /* Initialize the TPR to allow all interrupts. */ lapic_set_tpr(0); @@ -283,10 +275,14 @@ lapic->ldr = value; /* Setup spurious vector and enable the local APIC. */ - value = lapic->svr; - value &= ~(APIC_SVR_VECTOR | APIC_SVR_FOCUS); - value |= (APIC_SVR_FEN | APIC_SVR_SWEN | APIC_SPURIOUS_INT); - lapic->svr = value; + lapic_enable(); + + /* Program LINT[01] LVT entries. */ + lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0); + lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1); + + /* XXX: more LVT entries */ + intr_restore(eflags); } @@ -301,6 +297,18 @@ lapic->svr = value; } +static void +lapic_enable(void) +{ + u_int32_t value; + + /* Program the spurious vector to enable the local APIC. */ + value = lapic->svr; + value &= ~(APIC_SVR_VECTOR | APIC_SVR_FOCUS); + value |= (APIC_SVR_FEN | APIC_SVR_SWEN | APIC_SPURIOUS_INT); + lapic->svr = value; +} + int lapic_id(void) { ==== //depot/projects/smpng/sys/i386/i386/mp_machdep.c#78 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/mp_machdep.c,v 1.242 2004/12/07 20:15:01 ups Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/mp_machdep.c,v 1.243 2004/12/23 20:35:51 jhb Exp $"); #include "opt_apic.h" #include "opt_cpu.h" @@ -1135,8 +1135,8 @@ ipi_selected(map, IPI_HARDCLOCK); } - -void ipi_bitmap_handler(struct clockframe frame) +void +ipi_bitmap_handler(struct clockframe frame) { int cpu = PCPU_GET(cpuid); u_int ipi_bitmap; @@ -1170,7 +1170,6 @@ critical_exit(); } - /* * send an IPI to a set of cpus. */ ==== //depot/projects/smpng/sys/i386/i386/pmap.c#80 (text+ko) ==== @@ -73,7 +73,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/pmap.c,v 1.519 2004/12/15 19:55:04 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/pmap.c,v 1.520 2004/12/23 20:16:10 alc Exp $"); /* * Manages physical address maps. @@ -2050,7 +2050,6 @@ * 2. Not wired. * 3. Read access. * 4. No page table pages. - * 5. Tlbflush is deferred to calling procedure. * 6. Page IS managed. * but is *MUCH* faster than pmap_enter... */ @@ -2061,7 +2060,8 @@ pt_entry_t *pte; vm_paddr_t pa; - vm_page_lock_queues(); + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); PMAP_LOCK(pmap); /* @@ -2153,7 +2153,6 @@ else pte_store(pte, pa | PG_V | PG_U | PG_MANAGED); out: - vm_page_unlock_queues(); PMAP_UNLOCK(pmap); return mpte; } ==== //depot/projects/smpng/sys/i386/include/apicreg.h#3 (text+ko) ==== @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/include/apicreg.h,v 1.26 2003/12/10 21:33:07 jhb Exp $ + * $FreeBSD: src/sys/i386/include/apicreg.h,v 1.27 2004/12/23 20:35:07 jhb Exp $ */ #ifndef _MACHINE_APICREG_H_ @@ -330,8 +330,13 @@ #define APIC_LVTT_DS 0x00001000 #define APIC_LVTT_M 0x00010000 #define APIC_LVTT_TM 0x00020000 +# define APIC_LVTT_TM_ONE_SHOT 0x00000000 +# define APIC_LVTT_TM_PERIODIC 0x00020000 +/* APIC timer current count */ +#define APIC_TIMER_MAX_COUNT 0xffffffff + /* fields in TDCR */ #define APIC_TDCR_2 0x00 #define APIC_TDCR_4 0x01 ==== //depot/projects/smpng/sys/i386/include/intr_machdep.h#5 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/include/intr_machdep.h,v 1.5 2004/08/02 15:31:10 scottl Exp $ + * $FreeBSD: src/sys/i386/include/intr_machdep.h,v 1.6 2004/12/23 20:34:18 jhb Exp $ */ #ifndef __MACHINE_INTR_MACHDEP_H__ @@ -100,6 +100,7 @@ int intr_remove_handler(void *cookie); void intr_resume(void); void intr_suspend(void); +void intrcnt_add(const char *name, u_long **countp); #endif /* !LOCORE */ #endif /* _KERNEL */ ==== //depot/projects/smpng/sys/ia64/ia64/pmap.c#67 (text+ko) ==== @@ -46,7 +46,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.156 2004/12/15 19:55:04 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.157 2004/12/23 20:16:10 alc Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -1612,7 +1612,6 @@ * 2. Not wired. * 3. Read access. * 4. No page table pages. - * 5. Tlbflush is deferred to calling procedure. * 6. Page IS managed. * but is *MUCH* faster than pmap_enter... */ @@ -1624,7 +1623,8 @@ pmap_t oldpmap; boolean_t managed; - vm_page_lock_queues(); + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); PMAP_LOCK(pmap); oldpmap = pmap_install(pmap); @@ -1666,7 +1666,6 @@ pmap_set_pte(pte, va, VM_PAGE_TO_PHYS(m), FALSE, managed); reinstall: - vm_page_unlock_queues(); pmap_install(oldpmap); PMAP_UNLOCK(pmap); return (NULL); ==== //depot/projects/smpng/sys/powerpc/powerpc/pmap.c#49 (text+ko) ==== @@ -91,7 +91,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/pmap.c,v 1.91 2004/12/15 19:55:04 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/powerpc/powerpc/pmap.c,v 1.92 2004/12/23 20:16:11 alc Exp $"); /* * Manages physical address maps. @@ -1048,7 +1048,6 @@ pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m, vm_page_t mpte) { - vm_page_lock_queues(); vm_page_busy(m); vm_page_unlock_queues(); VM_OBJECT_UNLOCK(m->object); @@ -1058,7 +1057,6 @@ VM_OBJECT_LOCK(m->object); vm_page_lock_queues(); vm_page_wakeup(m); - vm_page_unlock_queues(); return (NULL); } ==== //depot/projects/smpng/sys/sparc64/sparc64/pmap.c#55 (text+ko) ==== @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $FreeBSD: src/sys/sparc64/sparc64/pmap.c,v 1.142 2004/12/15 19:55:05 alc Exp $ + * $FreeBSD: src/sys/sparc64/sparc64/pmap.c,v 1.143 2004/12/23 20:16:11 alc Exp $ */ /* @@ -1401,7 +1401,6 @@ pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m, vm_page_t mpte) { - vm_page_lock_queues(); vm_page_busy(m); vm_page_unlock_queues(); VM_OBJECT_UNLOCK(m->object); @@ -1411,7 +1410,6 @@ VM_OBJECT_LOCK(m->object); vm_page_lock_queues(); vm_page_wakeup(m); - vm_page_unlock_queues(); return (NULL); } ==== //depot/projects/smpng/sys/vm/vm_fault.c#44 (text+ko) ==== @@ -72,7 +72,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/vm/vm_fault.c,v 1.199 2004/12/15 19:55:05 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/vm/vm_fault.c,v 1.200 2004/12/23 20:16:11 alc Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -977,12 +977,11 @@ (m->busy == 0) && (m->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) { - if ((m->queue - m->pc) == PQ_CACHE) { - vm_page_lock_queues(); + vm_page_lock_queues(); + if ((m->queue - m->pc) == PQ_CACHE) vm_page_deactivate(m); - vm_page_unlock_queues(); - } mpte = pmap_enter_quick(pmap, addr, m, mpte); + vm_page_unlock_queues(); } VM_OBJECT_UNLOCK(lobject); } ==== //depot/projects/smpng/sys/vm/vm_map.c#69 (text+ko) ==== @@ -63,7 +63,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/vm/vm_map.c,v 1.362 2004/12/15 19:55:05 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/vm/vm_map.c,v 1.363 2004/12/23 20:16:11 alc Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1369,6 +1369,7 @@ vm_offset_t tmpidx; int psize; vm_page_t p, mpte; + boolean_t are_queues_locked; if ((prot & VM_PROT_READ) == 0 || object == NULL) return; @@ -1392,6 +1393,7 @@ psize = object->size - pindex; } + are_queues_locked = FALSE; mpte = NULL; if ((p = TAILQ_FIRST(&object->memq)) != NULL) { @@ -1420,15 +1422,18 @@ if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL && (p->busy == 0) && (p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) { - if ((p->queue - p->pc) == PQ_CACHE) { + if (!are_queues_locked) { + are_queues_locked = TRUE; vm_page_lock_queues(); + } + if ((p->queue - p->pc) == PQ_CACHE) vm_page_deactivate(p); - vm_page_unlock_queues(); - } mpte = pmap_enter_quick(map->pmap, addr + ptoa(tmpidx), p, mpte); } } + if (are_queues_locked) + vm_page_unlock_queues(); unlock_return: VM_OBJECT_UNLOCK(object); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412232048.iBNKmmS5085059>