Index: conf/options.i386 =================================================================== RCS file: /home/ncvs/src/sys/conf/options.i386,v retrieving revision 1.212 diff -u -r1.212 options.i386 --- conf/options.i386 14 Mar 2004 23:03:56 -0000 1.212 +++ conf/options.i386 3 Jun 2004 18:15:35 -0000 @@ -7,6 +7,7 @@ DISABLE_PG_G opt_pmap.h DISABLE_PSE opt_pmap.h I586_PMC_GUPROF opt_i586_guprof.h +LAZYPMAP opt_pmap.h MAXMEM MPTABLE_FORCE_HTT NO_MIXED_MODE Index: i386/i386/apic_vector.s =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/apic_vector.s,v retrieving revision 1.101 diff -u -r1.101 apic_vector.s --- i386/i386/apic_vector.s 26 May 2004 07:43:41 -0000 1.101 +++ i386/i386/apic_vector.s 3 Jun 2004 18:15:36 -0000 @@ -41,6 +41,7 @@ #include #include "assym.s" +#include "opt_pmap.h" /* * Macros to create and destroy a trap frame. @@ -384,7 +385,8 @@ movl $0, LA_EOI(%eax) /* End Of Interrupt to APIC */ POP_FRAME iret - + +#ifdef LAZYPMAP /* * Clean up when we lose out on the lazy context switch optimization. * ie: when we are about to release a PTD but a cpu is still borrowing it. @@ -404,4 +406,5 @@ movl $0, LA_EOI(%eax) /* End Of Interrupt to APIC */ POP_FRAME iret -#endif /* SMP */ +#endif /* LAZYPMAP */ +#endif /* SMP */ Index: i386/i386/mp_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/mp_machdep.c,v retrieving revision 1.230 diff -u -r1.230 mp_machdep.c --- i386/i386/mp_machdep.c 24 Jan 2004 19:52:47 -0000 1.230 +++ i386/i386/mp_machdep.c 3 Jun 2004 18:15:36 -0000 @@ -29,6 +29,7 @@ #include "opt_apic.h" #include "opt_cpu.h" #include "opt_kstack_pages.h" +#include "opt_pmap.h" #if !defined(lint) #if !defined(SMP) @@ -362,9 +363,11 @@ setidt(IPI_STATCLOCK, IDTVEC(statclock), SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); +#ifdef LAZYPMAP /* Install an inter-CPU IPI for lazy pmap release */ setidt(IPI_LAZYPMAP, IDTVEC(lazypmap), SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); +#endif /* Install an inter-CPU IPI for all-CPU rendezvous */ setidt(IPI_RENDEZVOUS, IDTVEC(rendezvous), Index: i386/i386/pmap.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/pmap.c,v retrieving revision 1.467 diff -u -r1.467 pmap.c --- i386/i386/pmap.c 28 May 2004 19:42:02 -0000 1.467 +++ i386/i386/pmap.c 3 Jun 2004 18:15:36 -0000 @@ -185,7 +185,7 @@ LIST_HEAD(pmaplist, pmap); static struct pmaplist allpmaps; static struct mtx allpmaps_lock; -#ifdef SMP +#if defined(SMP) && defined(LAZYPMAP) static struct mtx lazypmap_lock; #endif @@ -335,7 +335,7 @@ kernel_pmap->pm_active = -1; /* don't allow deactivation */ TAILQ_INIT(&kernel_pmap->pm_pvlist); LIST_INIT(&allpmaps); -#ifdef SMP +#if defined(SMP) && defined(LAZYPMAP) mtx_init(&lazypmap_lock, "lazypmap", NULL, MTX_SPIN); #endif mtx_init(&allpmaps_lock, "allpmaps", NULL, MTX_SPIN); @@ -1247,6 +1247,7 @@ * Pmap allocation/deallocation routines. ***************************************************/ +#ifdef LAZYPMAP #ifdef SMP /* * Deal with a SMP shootdown of other users of the pmap that we are @@ -1335,6 +1336,7 @@ } } #endif /* SMP */ +#endif /* LAZYPMAP */ /* * Release any resources held by the given physical map. @@ -1351,7 +1353,9 @@ ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); +#ifdef LAZYPMAP pmap_lazyfix(pmap); +#endif mtx_lock_spin(&allpmaps_lock); LIST_REMOVE(pmap, pm_list); mtx_unlock_spin(&allpmaps_lock); Index: i386/i386/swtch.s =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/swtch.s,v retrieving revision 1.145 diff -u -r1.145 swtch.s --- i386/i386/swtch.s 7 Apr 2004 20:46:04 -0000 1.145 +++ i386/i386/swtch.s 3 Jun 2004 18:15:36 -0000 @@ -33,6 +33,7 @@ */ #include "opt_npx.h" +#include "opt_pmap.h" #include @@ -162,12 +163,14 @@ /* switch address space */ movl PCB_CR3(%edx),%eax +#ifdef LAZY_PMAP #ifdef PAE cmpl %eax,IdlePDPT /* Kernel address space? */ #else cmpl %eax,IdlePTD /* Kernel address space? */ #endif je sw1 +#endif movl %cr3,%ebx /* The same address space? */ cmpl %ebx,%eax je sw1 Index: i386/include/apicvar.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/apicvar.h,v retrieving revision 1.7 diff -u -r1.7 apicvar.h --- i386/include/apicvar.h 10 May 2004 18:49:58 -0000 1.7 +++ i386/include/apicvar.h 3 Jun 2004 18:15:36 -0000 @@ -91,7 +91,9 @@ #define IPI_INVLTLB (APIC_IPI_INTS + 1) /* TLB Shootdown IPIs */ #define IPI_INVLPG (APIC_IPI_INTS + 2) #define IPI_INVLRNG (APIC_IPI_INTS + 3) +#ifdef LAZYPMAP #define IPI_LAZYPMAP (APIC_IPI_INTS + 4) /* Lazy pmap release. */ +#endif #define IPI_HARDCLOCK (APIC_IPI_INTS + 8) /* Inter-CPU clock handling. */ #define IPI_STATCLOCK (APIC_IPI_INTS + 9) #define IPI_RENDEZVOUS (APIC_IPI_INTS + 10) /* Inter-CPU rendezvous. */ Index: i386/include/smp.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/smp.h,v retrieving revision 1.78 diff -u -r1.78 smp.h --- i386/include/smp.h 11 Dec 2003 03:48:31 -0000 1.78 +++ i386/include/smp.h 3 Jun 2004 18:15:36 -0000 @@ -59,8 +59,11 @@ IDTVEC(statclock), /* Forward statclock() */ IDTVEC(cpuast), /* Additional software trap on other cpu */ IDTVEC(cpustop), /* CPU stops & waits to be restarted */ - IDTVEC(rendezvous), /* handle CPU rendezvous */ + IDTVEC(rendezvous); /* handle CPU rendezvous */ +#ifdef LAZYPMAP +inthand_t IDTVEC(lazypmap); /* handle lazy pmap release */ +#endif /* functions in mp_machdep.c */ void cpu_add(u_int apic_id, char boot_cpu); Index: kern/subr_witness.c =================================================================== RCS file: /home/ncvs/src/sys/kern/subr_witness.c,v retrieving revision 1.172 diff -u -r1.172 subr_witness.c --- kern/subr_witness.c 2 Jun 2004 23:28:06 -0000 1.172 +++ kern/subr_witness.c 3 Jun 2004 18:15:36 -0000 @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD: src/sys/kern/subr_witness.c,v 1.172 2004/06/02 23:28:06 rwatson Exp $"); #include "opt_ddb.h" +#include "opt_pmap.h" #include "opt_witness.h" #include @@ -337,6 +338,8 @@ { "smp rendezvous", &lock_class_mtx_spin }, #if defined(__i386__) || defined(__amd64__) { "tlb", &lock_class_mtx_spin }, +#endif +#if defined(__i386__) && defined(LAZY_PMAP) { "lazypmap", &lock_class_mtx_spin }, #endif #ifdef __sparc64__