Add the NO_KMEM_MAP kernel configuration option. This is a temporary option
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 25 Aug 2003 19:50:33 +0000 (19:50 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 25 Aug 2003 19:50:33 +0000 (19:50 +0000)
that will allow developers to test kmem_map removal and also the upcoming
(not this commit) slab allocator.  Currently this option removes kmem_map
and causes the malloc and zalloc subsystems to use kernel_map exclusively.

Change gd_intr_nesting_level.  This variable is now only bumped while we
are in a FAST interrupt or processing an IPIQ message.  This variable is
not bumped while we are in a normal interrupt or software interrupt thread.

Add warning printf()s if malloc() and related functions detect attempts to
use them from within a FAST interrupt or IPIQ.

Remove references to the no-longer-used zalloci() and zfreei() functions.

37 files changed:
sys/conf/options
sys/contrib/ipfilter/netinet/ip_compat.h
sys/cpu/i386/include/cpu.h
sys/i386/apic/apic_vector.s
sys/i386/i386/exception.s
sys/i386/i386/machdep.c
sys/i386/i386/trap.c
sys/i386/i386/vm86bios.s
sys/i386/icu/icu_vector.s
sys/i386/include/cpu.h
sys/i386/include/vmparam.h
sys/i386/isa/apic_vector.s
sys/i386/isa/icu_vector.s
sys/i386/isa/ipl.s
sys/kern/kern_intr.c
sys/kern/kern_lock.c
sys/kern/kern_malloc.c
sys/kern/lwkt_thread.c
sys/kern/uipc_mbuf.c
sys/platform/pc32/apic/apic_vector.s
sys/platform/pc32/i386/exception.s
sys/platform/pc32/i386/machdep.c
sys/platform/pc32/i386/trap.c
sys/platform/pc32/i386/vm86bios.s
sys/platform/pc32/icu/icu_vector.s
sys/platform/pc32/include/vmparam.h
sys/platform/pc32/isa/apic_vector.s
sys/platform/pc32/isa/icu_vector.s
sys/platform/pc32/isa/ipl.s
sys/sys/malloc.h
sys/sys/thread.h
sys/vm/vm_kern.c
sys/vm/vm_kern.h
sys/vm/vm_map.c
sys/vm/vm_mmap.c
sys/vm/vm_object.c
sys/vm/vm_zone.c

index 8d276bc..1a4da2f 100644 (file)
@@ -1,5 +1,5 @@
 # $FreeBSD: src/sys/conf/options,v 1.191.2.53 2003/06/04 17:56:58 sam Exp $
-# $DragonFly: src/sys/conf/options,v 1.3 2003/08/24 23:07:07 hsu Exp $
+# $DragonFly: src/sys/conf/options,v 1.4 2003/08/25 19:50:22 dillon Exp $
 #
 #        On the handling of kernel options
 #
@@ -396,6 +396,7 @@ SIMPLELOCK_DEBUG    opt_global.h
 VFS_BIO_DEBUG          opt_global.h
 
 # These are VM related options
+NO_KMEM_MAP            opt_global.h
 VM_KMEM_SIZE           opt_vm.h
 VM_KMEM_SIZE_SCALE     opt_vm.h
 VM_KMEM_SIZE_MAX       opt_vm.h
index c95e8f6..2f943a1 100644 (file)
@@ -6,7 +6,7 @@
  * @(#)ip_compat.h     1.8 1/14/96
  * $Id: ip_compat.h,v 2.26.2.46 2002/06/27 14:39:40 darrenr Exp $
  * $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_compat.h,v 1.13.2.5 2003/03/01 03:55:54 darrenr Exp $
- * $DragonFly: src/sys/contrib/ipfilter/netinet/ip_compat.h,v 1.4 2003/08/01 17:46:14 dillon Exp $
+ * $DragonFly: src/sys/contrib/ipfilter/netinet/ip_compat.h,v 1.5 2003/08/25 19:50:25 dillon Exp $
  */
 
 #ifndef        __IP_COMPAT_H__
@@ -593,7 +593,6 @@ extern      void    m_copyback __P((struct mbuf *, int, int, caddr_t));
 #    include <uvm/uvm_extern.h>
 #   else
 #    include <vm/vm_extern.h>
-extern vm_map_t        kmem_map;
 #   endif
 #   include <sys/proc.h>
 #  else /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */
index d428fcc..c167662 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
  * $FreeBSD: src/sys/i386/include/cpu.h,v 1.43.2.2 2001/06/15 09:37:57 scottl Exp $
- * $DragonFly: src/sys/cpu/i386/include/cpu.h,v 1.9 2003/08/07 21:17:22 dillon Exp $
+ * $DragonFly: src/sys/cpu/i386/include/cpu.h,v 1.10 2003/08/25 19:50:29 dillon Exp $
  */
 
 #ifndef _MACHINE_CPU_H_
@@ -61,7 +61,7 @@
 #define        CLKF_USERMODE(framep) \
        ((ISPL((framep)->cf_cs) == SEL_UPL) || (framep->cf_eflags & PSL_VM))
 
-#define CLKF_INTR(framep)      (mycpu->gd_intr_nesting_level >= 2)
+#define CLKF_INTR(framep)      (mycpu->gd_intr_nesting_level > 1 || (curthread->td_flags & TDF_INTTHREAD))
 #define        CLKF_PC(framep)         ((framep)->cf_eip)
 
 /*
index 3de9dcb..8504156 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $
- * $DragonFly: src/sys/i386/apic/Attic/apic_vector.s,v 1.12 2003/07/12 17:54:35 dillon Exp $
+ * $DragonFly: src/sys/i386/apic/Attic/apic_vector.s,v 1.13 2003/08/25 19:50:32 dillon Exp $
  */
 
 
@@ -151,7 +151,6 @@ IDTVEC(vec_name) ;                                                  \
        FAKE_MCOUNT(13*4(%esp)) ;                                       \
        MASK_LEVEL_IRQ(irq_num) ;                                       \
        EOI_IRQ(irq_num) ;                                              \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;                                     \
        pushl   %eax ;                                                  \
@@ -171,6 +170,7 @@ IDTVEC(vec_name) ;                                                  \
        testl   %eax,%eax ;                                             \
        jz      6f ;                                                    \
        /* clear pending bit, run handler */                            \
+       incl    PCPU(intr_nesting_level) ;                              \
        addl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
        andl    $~IRQ_LBIT(irq_num),PCPU(fpending) ;                    \
        pushl   intr_unit + (irq_num) * 4 ;                             \
@@ -180,6 +180,7 @@ IDTVEC(vec_name) ;                                                  \
        incl    PCPU(cnt)+V_INTR ;      /* book-keeping make per cpu YYY */ \
        movl    intr_countp + (irq_num) * 4, %eax ;                     \
        incl    (%eax) ;                                                \
+       decl    PCPU(intr_nesting_level) ;                              \
        call    rel_mplock ;                                            \
        UNMASK_IRQ(irq_num) ;                                           \
 5: ;                                                                   \
@@ -247,7 +248,7 @@ IDTVEC(vec_name) ;                                                  \
  *
  *     Note that calls to sched_ithd() are made with interrupts enabled
  *     and outside a critical section.  YYY sched_ithd may preempt us
- *     synchronously (fix interrupt stacking)
+ *     synchronously (fix interrupt stacking).
  *
  *     YYY can cache gd base pointer instead of using hidden %fs
  *     prefixes.
@@ -262,7 +263,6 @@ IDTVEC(vec_name) ;                                                  \
 ;                                                                      \
        MASK_LEVEL_IRQ(irq_num) ;                                       \
        EOI_IRQ(irq_num) ;                                              \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;                                     \
        pushl   %eax ;          /* cpl do restore */                    \
@@ -482,11 +482,12 @@ Xipiq:
        movl    PCPU(curthread),%ebx
        cmpl    $TDPRI_CRIT,TD_PRI(%ebx)
        jge     1f
+       incl    PCPU(intr_nesting_level)
        addl    $TDPRI_CRIT,TD_PRI(%ebx)
        call    lwkt_process_ipiq
        subl    $TDPRI_CRIT,TD_PRI(%ebx)
+       decl    PCPU(intr_nesting_level)
        pushl   TD_CPL(%ebx)
-       incl    PCPU(intr_nesting_level)
        MEXITCOUNT
        jmp     doreti
 1:
index a321cfb..ecc852a 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/i386/exception.s,v 1.65.2.3 2001/08/15 01:23:49 peter Exp $
- * $DragonFly: src/sys/i386/i386/Attic/exception.s,v 1.18 2003/08/07 21:17:22 dillon Exp $
+ * $DragonFly: src/sys/i386/i386/Attic/exception.s,v 1.19 2003/08/25 19:50:28 dillon Exp $
  */
 
 #include "use_npx.h"
@@ -175,7 +175,6 @@ IDTVEC(fpu)
        call    npx_intr                /* note: call might mess w/ argument */
 
        movl    %ebx, (%esp)            /* save cpl for doreti */
-       incl    PCPU(intr_nesting_level)
        MEXITCOUNT
        jmp     doreti
 #else  /* NNPX > 0 */
@@ -224,7 +223,6 @@ calltrap:
         * to interrupt frame.
         */
        pushl   %ebx                    /* cpl to restore */
-       incl    PCPU(intr_nesting_level)
        MEXITCOUNT
        jmp     doreti
 
@@ -267,7 +265,6 @@ IDTVEC(syscall)
        cmpl    $0,PCPU(reqflags)
        je      doreti_syscall_ret
        pushl   $0                      /* cpl to restore */
-       movl    $1,PCPU(intr_nesting_level)
        jmp     doreti
 
 /*
@@ -301,7 +298,6 @@ IDTVEC(int0x80_syscall)
        cmpl    $0,PCPU(reqflags)
        je      doreti_syscall_ret
        pushl   $0                      /* cpl to restore */
-       movl    $1,PCPU(intr_nesting_level)
        jmp     doreti
 
 /*
@@ -334,7 +330,6 @@ IDTVEC(int0x81_syscall)
        cmpl    $0,PCPU(reqflags)
        je      doreti_syscall_ret
        pushl   $0                      /* cpl to restore */
-       movl    $1,PCPU(intr_nesting_level)
        jmp     doreti
 
 /*
@@ -384,7 +379,6 @@ pmsg4:  .asciz      "fork_trampoline mpcount %d after calling %p"
         * Return via doreti to handle ASTs.
         */
        pushl   $0                      /* cpl to restore */
-       movl    $1,PCPU(intr_nesting_level)
        MEXITCOUNT
        jmp     doreti
 
index 3f2e156..aefb5b7 100644 (file)
@@ -36,7 +36,7 @@
  *
  *     from: @(#)machdep.c     7.4 (Berkeley) 6/3/91
  * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.385.2.30 2003/05/31 08:48:05 alc Exp $
- * $DragonFly: src/sys/i386/i386/Attic/machdep.c,v 1.33 2003/08/20 04:44:55 dillon Exp $
+ * $DragonFly: src/sys/i386/i386/Attic/machdep.c,v 1.34 2003/08/25 19:50:28 dillon Exp $
  */
 
 #include "use_apm.h"
@@ -413,8 +413,13 @@ again:
                mb_map_size = roundup2(mb_map_size, max(MCLBYTES, PAGE_SIZE));
                mclrefcnt = malloc(mb_map_size / MCLBYTES, M_MBUF, M_NOWAIT);
                bzero(mclrefcnt, mb_map_size / MCLBYTES);
-               mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr,
-                       mb_map_size);
+#if defined(NO_KMEM_MAP)
+               mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl,
+                           &maxaddr, mb_map_size);
+#else
+               mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl,
+                           &maxaddr, mb_map_size);
+#endif
                mb_map->system_map = 1;
        }
 
index ee961e4..73ddc8f 100644 (file)
@@ -36,7 +36,7 @@
  *
  *     from: @(#)trap.c        7.4 (Berkeley) 5/13/91
  * $FreeBSD: src/sys/i386/i386/trap.c,v 1.147.2.11 2003/02/27 19:09:59 luoqi Exp $
- * $DragonFly: src/sys/i386/i386/Attic/trap.c,v 1.32 2003/08/12 02:36:15 dillon Exp $
+ * $DragonFly: src/sys/i386/i386/Attic/trap.c,v 1.33 2003/08/25 19:50:28 dillon Exp $
  */
 
 /*
@@ -595,7 +595,6 @@ kernel_trap:
                        goto out2;                                      \
                }                                                       \
        } while (0)
-
                        if (mycpu->gd_intr_nesting_level == 0) {
                                /*
                                 * Invalid %fs's and %gs's can be created using
index daa42ac..6cd9537 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/i386/vm86bios.s,v 1.15.2.1 2000/05/16 06:58:07 dillon Exp $
- * $DragonFly: src/sys/i386/i386/Attic/vm86bios.s,v 1.10 2003/07/08 06:27:26 dillon Exp $
+ * $DragonFly: src/sys/i386/i386/Attic/vm86bios.s,v 1.11 2003/08/25 19:50:28 dillon Exp $
  */
 
 #include <machine/asmacros.h>          /* miscellaneous asm macros */
@@ -138,7 +138,6 @@ ENTRY(vm86_bioscall)
         */
        movl    PCPU(curthread),%eax
        pushl   TD_CPL(%eax)
-       incl    PCPU(intr_nesting_level)/* dummy to match doreti */
        MEXITCOUNT
        jmp     doreti
 
index d121616..dcf406b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/icu_vector.s,v 1.14.2.2 2000/07/18 21:12:42 dfr Exp $
- * $DragonFly: src/sys/i386/icu/Attic/icu_vector.s,v 1.13 2003/07/12 17:54:35 dillon Exp $
+ * $DragonFly: src/sys/i386/icu/Attic/icu_vector.s,v 1.14 2003/08/25 19:50:32 dillon Exp $
  */
 
 /*
@@ -119,7 +119,6 @@ IDTVEC(vec_name) ;                                                  \
        FAKE_MCOUNT(13*4(%esp)) ;                                       \
        MASK_IRQ(icu, irq_num) ;                                        \
        enable_icus ;                                                   \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;     /* save the cpl for doreti */   \
        pushl   %eax ;                                                  \
@@ -134,12 +133,14 @@ IDTVEC(vec_name) ;                                                        \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* clear pending bit, run handler */                            \
+       incl    PCPU(intr_nesting_level) ;                              \
        addl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
        andl    $~IRQ_LBIT(irq_num),PCPU(fpending) ;                    \
        pushl   intr_unit + (irq_num) * 4 ;                             \
        call    *intr_handler + (irq_num) * 4 ;                         \
        addl    $4,%esp ;                                               \
        subl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
+       decl    PCPU(intr_nesting_level) ;                              \
        incl    PCPU(cnt)+V_INTR ; /* book-keeping YYY make per-cpu */  \
        movl    intr_countp + (irq_num) * 4,%eax ;                      \
        incl    (%eax) ;                                                \
@@ -196,6 +197,9 @@ IDTVEC(vec_name) ;                                                  \
  *
  *     YYY sched_ithd may preempt us synchronously (fix interrupt stacking)
  *
+ *     Note that intr_nesting_level is not bumped during sched_ithd because
+ *     blocking allocations are allowed in the preemption case.
+ *
  *     YYY can cache gd base pointer instead of using hidden %fs
  *     prefixes.
  */
@@ -209,7 +213,6 @@ IDTVEC(vec_name) ;                                                  \
        maybe_extra_ipending ;                                          \
        MASK_IRQ(icu, irq_num) ;                                        \
        enable_icus ;                                                   \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx), %eax ;                                    \
        pushl   %eax ;          /* push CPL for doreti */               \
index 911db59..4b65c39 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
  * $FreeBSD: src/sys/i386/include/cpu.h,v 1.43.2.2 2001/06/15 09:37:57 scottl Exp $
- * $DragonFly: src/sys/i386/include/Attic/cpu.h,v 1.9 2003/08/07 21:17:22 dillon Exp $
+ * $DragonFly: src/sys/i386/include/Attic/cpu.h,v 1.10 2003/08/25 19:50:29 dillon Exp $
  */
 
 #ifndef _MACHINE_CPU_H_
@@ -61,7 +61,7 @@
 #define        CLKF_USERMODE(framep) \
        ((ISPL((framep)->cf_cs) == SEL_UPL) || (framep->cf_eflags & PSL_VM))
 
-#define CLKF_INTR(framep)      (mycpu->gd_intr_nesting_level >= 2)
+#define CLKF_INTR(framep)      (mycpu->gd_intr_nesting_level > 1 || (curthread->td_flags & TDF_INTTHREAD))
 #define        CLKF_PC(framep)         ((framep)->cf_eip)
 
 /*
index 61053be..435560f 100644 (file)
@@ -37,7 +37,7 @@
  *
  *     from: @(#)vmparam.h     5.9 (Berkeley) 5/12/91
  * $FreeBSD: src/sys/i386/include/vmparam.h,v 1.32.2.1 2000/04/02 08:47:01 peter Exp $
- * $DragonFly: src/sys/i386/include/Attic/vmparam.h,v 1.2 2003/06/17 04:28:36 dillon Exp $
+ * $DragonFly: src/sys/i386/include/Attic/vmparam.h,v 1.3 2003/08/25 19:50:29 dillon Exp $
  */
 
 
 #define VM_MAX_ADDRESS         VADDR(PTDPTDI, PTDPTDI)
 #define VM_MIN_ADDRESS         ((vm_offset_t)0)
 
+#if !defined(NO_KMEM_MAP)
 /* virtual sizes (bytes) for various kernel submaps */
 #ifndef VM_KMEM_SIZE
 #define VM_KMEM_SIZE           (12 * 1024 * 1024)
 #define        VM_KMEM_SIZE_MAX        (200 * 1024 * 1024)
 #endif
 
+#endif
+
 /* initial pagein size of beginning of executable file */
 #ifndef VM_INITIAL_PAGEIN
 #define        VM_INITIAL_PAGEIN       16
index 562ce79..7e511bb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $
- * $DragonFly: src/sys/i386/isa/Attic/apic_vector.s,v 1.12 2003/07/12 17:54:35 dillon Exp $
+ * $DragonFly: src/sys/i386/isa/Attic/apic_vector.s,v 1.13 2003/08/25 19:50:32 dillon Exp $
  */
 
 
@@ -151,7 +151,6 @@ IDTVEC(vec_name) ;                                                  \
        FAKE_MCOUNT(13*4(%esp)) ;                                       \
        MASK_LEVEL_IRQ(irq_num) ;                                       \
        EOI_IRQ(irq_num) ;                                              \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;                                     \
        pushl   %eax ;                                                  \
@@ -171,6 +170,7 @@ IDTVEC(vec_name) ;                                                  \
        testl   %eax,%eax ;                                             \
        jz      6f ;                                                    \
        /* clear pending bit, run handler */                            \
+       incl    PCPU(intr_nesting_level) ;                              \
        addl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
        andl    $~IRQ_LBIT(irq_num),PCPU(fpending) ;                    \
        pushl   intr_unit + (irq_num) * 4 ;                             \
@@ -180,6 +180,7 @@ IDTVEC(vec_name) ;                                                  \
        incl    PCPU(cnt)+V_INTR ;      /* book-keeping make per cpu YYY */ \
        movl    intr_countp + (irq_num) * 4, %eax ;                     \
        incl    (%eax) ;                                                \
+       decl    PCPU(intr_nesting_level) ;                              \
        call    rel_mplock ;                                            \
        UNMASK_IRQ(irq_num) ;                                           \
 5: ;                                                                   \
@@ -247,7 +248,7 @@ IDTVEC(vec_name) ;                                                  \
  *
  *     Note that calls to sched_ithd() are made with interrupts enabled
  *     and outside a critical section.  YYY sched_ithd may preempt us
- *     synchronously (fix interrupt stacking)
+ *     synchronously (fix interrupt stacking).
  *
  *     YYY can cache gd base pointer instead of using hidden %fs
  *     prefixes.
@@ -262,7 +263,6 @@ IDTVEC(vec_name) ;                                                  \
 ;                                                                      \
        MASK_LEVEL_IRQ(irq_num) ;                                       \
        EOI_IRQ(irq_num) ;                                              \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;                                     \
        pushl   %eax ;          /* cpl do restore */                    \
@@ -482,11 +482,12 @@ Xipiq:
        movl    PCPU(curthread),%ebx
        cmpl    $TDPRI_CRIT,TD_PRI(%ebx)
        jge     1f
+       incl    PCPU(intr_nesting_level)
        addl    $TDPRI_CRIT,TD_PRI(%ebx)
        call    lwkt_process_ipiq
        subl    $TDPRI_CRIT,TD_PRI(%ebx)
+       decl    PCPU(intr_nesting_level)
        pushl   TD_CPL(%ebx)
-       incl    PCPU(intr_nesting_level)
        MEXITCOUNT
        jmp     doreti
 1:
index a991b1b..ca2a3b3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/icu_vector.s,v 1.14.2.2 2000/07/18 21:12:42 dfr Exp $
- * $DragonFly: src/sys/i386/isa/Attic/icu_vector.s,v 1.13 2003/07/12 17:54:35 dillon Exp $
+ * $DragonFly: src/sys/i386/isa/Attic/icu_vector.s,v 1.14 2003/08/25 19:50:32 dillon Exp $
  */
 
 /*
@@ -119,7 +119,6 @@ IDTVEC(vec_name) ;                                                  \
        FAKE_MCOUNT(13*4(%esp)) ;                                       \
        MASK_IRQ(icu, irq_num) ;                                        \
        enable_icus ;                                                   \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;     /* save the cpl for doreti */   \
        pushl   %eax ;                                                  \
@@ -134,12 +133,14 @@ IDTVEC(vec_name) ;                                                        \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* clear pending bit, run handler */                            \
+       incl    PCPU(intr_nesting_level) ;                              \
        addl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
        andl    $~IRQ_LBIT(irq_num),PCPU(fpending) ;                    \
        pushl   intr_unit + (irq_num) * 4 ;                             \
        call    *intr_handler + (irq_num) * 4 ;                         \
        addl    $4,%esp ;                                               \
        subl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
+       decl    PCPU(intr_nesting_level) ;                              \
        incl    PCPU(cnt)+V_INTR ; /* book-keeping YYY make per-cpu */  \
        movl    intr_countp + (irq_num) * 4,%eax ;                      \
        incl    (%eax) ;                                                \
@@ -196,6 +197,9 @@ IDTVEC(vec_name) ;                                                  \
  *
  *     YYY sched_ithd may preempt us synchronously (fix interrupt stacking)
  *
+ *     Note that intr_nesting_level is not bumped during sched_ithd because
+ *     blocking allocations are allowed in the preemption case.
+ *
  *     YYY can cache gd base pointer instead of using hidden %fs
  *     prefixes.
  */
@@ -209,7 +213,6 @@ IDTVEC(vec_name) ;                                                  \
        maybe_extra_ipending ;                                          \
        MASK_IRQ(icu, irq_num) ;                                        \
        enable_icus ;                                                   \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx), %eax ;                                    \
        pushl   %eax ;          /* push CPL for doreti */               \
index 88b5dba..581d58e 100644 (file)
@@ -37,7 +37,7 @@
  *     @(#)ipl.s
  *
  * $FreeBSD: src/sys/i386/isa/ipl.s,v 1.32.2.3 2002/05/16 16:03:56 bde Exp $
- * $DragonFly: src/sys/i386/isa/Attic/ipl.s,v 1.11 2003/07/20 07:14:27 dillon Exp $
+ * $DragonFly: src/sys/i386/isa/Attic/ipl.s,v 1.12 2003/08/25 19:50:32 dillon Exp $
  */
 
 
@@ -129,7 +129,6 @@ doreti_next:
        jnz     5f
        andl    $~RQF_INTPEND,PCPU(reqflags)
 5:
-       decl    PCPU(intr_nesting_level)
        MEXITCOUNT
        .globl  doreti_popl_fs
        .globl  doreti_popl_es
@@ -182,8 +181,11 @@ doreti_fast:
        popl    %ecx
        testl   %eax,%eax
        jz      1f
+       /* MP lock successful */
 #endif
-       call    *fastunpend(,%ecx,4)    /* MP lock successful */
+       incl    PCPU(intr_nesting_level)
+       call    *fastunpend(,%ecx,4)
+       decl    PCPU(intr_nesting_level)
 #ifdef SMP
        call    rel_mplock
 #endif
@@ -231,11 +233,9 @@ doreti_ast:
        sti
        movl    %eax,%esi               /* save cpl (can't use stack) */
        movl    $T_ASTFLT,TF_TRAPNO(%esp)
-       decl    PCPU(intr_nesting_level) /* syscall-like, not interrupt-like */
        subl    $TDPRI_CRIT,TD_PRI(%ebx)
 1:     call    trap
        addl    $TDPRI_CRIT,TD_PRI(%ebx)
-       incl    PCPU(intr_nesting_level)
        movl    %esi,%eax               /* restore cpl for loop */
        jmp     doreti_next
 
@@ -244,8 +244,10 @@ doreti_ast:
         * IPIQ message pending.  We clear RQF_IPIQ automatically.
         */
 doreti_ipiq:
+       incl    PCPU(intr_nesting_level)
        andl    $~RQF_IPIQ,PCPU(reqflags)
        call    lwkt_process_ipiq
+       decl    PCPU(intr_nesting_level)
        movl    TD_CPL(%ebx),%eax       /* retrieve cpl again for loop */
        jmp     doreti_next
 
index e045c6e..46e630c 100644 (file)
@@ -24,7 +24,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/kern/kern_intr.c,v 1.24.2.1 2001/10/14 20:05:50 luigi Exp $
- * $DragonFly: src/sys/kern/kern_intr.c,v 1.10 2003/07/25 05:26:50 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_intr.c,v 1.11 2003/08/25 19:50:32 dillon Exp $
  *
  */
 
@@ -95,7 +95,7 @@ register_int(int intr, inthand2_t *handler, void *arg, const char *name)
      */
     if ((td = ithreads[intr]) == NULL) {
        lwkt_create((void *)ithread_handler, (void *)intr, &ithreads[intr],
-           &ithread_ary[intr], TDF_STOPREQ, "ithread %d", intr);
+           &ithread_ary[intr], TDF_STOPREQ|TDF_INTTHREAD, "ithread %d", intr);
        td = ithreads[intr];
        if (intr >= NHWI && intr < NHWI + NSWI)
            lwkt_setpri(td, TDPRI_SOFT_NORM + TDPRI_CRIT * 2);
index 7682a95..3530744 100644 (file)
@@ -39,7 +39,7 @@
  *
  *     @(#)kern_lock.c 8.18 (Berkeley) 5/21/95
  * $FreeBSD: src/sys/kern/kern_lock.c,v 1.31.2.3 2001/12/25 01:44:44 dillon Exp $
- * $DragonFly: src/sys/kern/kern_lock.c,v 1.5 2003/07/21 07:57:47 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_lock.c,v 1.6 2003/08/25 19:50:32 dillon Exp $
  */
 
 #include "opt_lint.h"
@@ -159,6 +159,16 @@ debuglockmgr(struct lock *lkp, u_int flags, struct lwkt_token *interlkp,
 
        error = 0;
 
+       /*if ((flags & LK_NOWAIT) == 0 && (flags & LK_TYPE_MASK) != LK_RELEASE)*/ {
+#ifndef DEBUG_LOCKS
+       if (mycpu->gd_intr_nesting_level)
+               printf("lockmgr %s from %p: called from FASTint\n", lkp->lk_wmesg, ((int **)&lkp)[-1]);
+#else
+       if (mycpu->gd_intr_nesting_level)
+               printf("lockmgr %s from %s:%d: called from FASTint\n", lkp->lk_wmesg, file, line);
+#endif
+       }
+
        lwkt_gettoken(&lkp->lk_interlock);
        if (flags & LK_INTERLOCK)
                lwkt_reltoken(interlkp);
index 46579fa..38eb68b 100644 (file)
@@ -32,7 +32,7 @@
  *
  *     @(#)kern_malloc.c       8.3 (Berkeley) 1/4/94
  * $FreeBSD: src/sys/kern/kern_malloc.c,v 1.64.2.5 2002/03/16 02:19:51 archie Exp $
- * $DragonFly: src/sys/kern/Attic/kern_malloc.c,v 1.9 2003/07/29 21:51:07 drhodus Exp $
+ * $DragonFly: src/sys/kern/Attic/kern_malloc.c,v 1.10 2003/08/25 19:50:32 dillon Exp $
  */
 
 #include "opt_vm.h"
@@ -83,10 +83,17 @@ static MALLOC_DEFINE(M_FREE, "free", "should be on free list");
 static struct malloc_type *kmemstatistics;
 static struct kmembuckets bucket[MINBUCKET + 16];
 static struct kmemusage *kmemusage;
+#if defined(NO_KMEM_MAP)
+static const char *kmembase = (char *)VM_MIN_KERNEL_ADDRESS;
+static const char *kmemlimit = (char *)VM_MAX_KERNEL_ADDRESS;
+#else
 static char *kmembase;
 static char *kmemlimit;
+#endif
 
+#if !defined(NO_KMEM_MAP)
 u_int vm_kmem_size;
+#endif
 
 #ifdef INVARIANTS
 /*
@@ -151,10 +158,13 @@ malloc(size, type, flags)
 #endif
        struct malloc_type *ksp = type;
 
-#if defined(INVARIANTS) && defined(__i386__)
-       if (flags == M_WAITOK)
+#if defined(INVARIANTS)
+       if (mycpu->gd_intr_nesting_level)
+               printf("WARNING: malloc() called from FASTint or ipiq, from %p\n", ((int **)&size)[-1]);
+       if (flags == M_WAITOK) {
                KASSERT(mycpu->gd_intr_nesting_level == 0,
                   ("malloc(M_WAITOK) in interrupt context"));
+       }
 #endif
        /*
         * Must be at splmem() prior to initializing segment to handle
@@ -190,7 +200,13 @@ malloc(size, type, flags)
                else
                        allocsize = 1 << indx;
                npg = btoc(allocsize);
-               va = (caddr_t) kmem_malloc(kmem_map, (vm_size_t)ctob(npg), flags);
+#if defined(NO_KMEM_MAP)
+               va = (caddr_t) kmem_malloc(kernel_map,
+                                   (vm_size_t)ctob(npg), flags);
+#else
+               va = (caddr_t) kmem_malloc(kmem_map,
+                                   (vm_size_t)ctob(npg), flags);
+#endif
                if (va == NULL) {
                        splx(s);
                        return ((void *) NULL);
@@ -340,7 +356,11 @@ free(addr, type)
                    (void *)addr, size, type->ks_shortdesc, alloc);
 #endif /* INVARIANTS */
        if (size > MAXALLOCSAVE) {
+#if defined(NO_KMEM_MAP)
+               kmem_free(kernel_map, (vm_offset_t)addr, ctob(kup->ku_pagecnt));
+#else
                kmem_free(kmem_map, (vm_offset_t)addr, ctob(kup->ku_pagecnt));
+#endif
                size = kup->ku_pagecnt << PAGE_SHIFT;
                ksp->ks_memuse -= size;
                kup->ku_indx = 0;
@@ -513,9 +533,10 @@ kmeminit(dummy)
         * Note that the kmem_map is also used by the zone allocator,
         * so make sure that there is enough space.
         */
-       vm_kmem_size = VM_KMEM_SIZE;
        mem_size = vmstats.v_page_count * PAGE_SIZE;
 
+#if !defined(NO_KMEM_MAP)
+       vm_kmem_size = VM_KMEM_SIZE;
 #if defined(VM_KMEM_SIZE_SCALE)
        if ((mem_size / VM_KMEM_SIZE_SCALE) > vm_kmem_size)
                vm_kmem_size = mem_size / VM_KMEM_SIZE_SCALE;
@@ -546,6 +567,11 @@ kmeminit(dummy)
        kmem_map = kmem_suballoc(kernel_map, (vm_offset_t *)&kmembase,
                (vm_offset_t *)&kmemlimit, (vm_size_t)(npg * PAGE_SIZE));
        kmem_map->system_map = 1;
+#else
+       npg = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE;
+       kmemusage = (struct kmemusage *) kmem_alloc(kernel_map,
+               (vm_size_t)(npg * sizeof(struct kmemusage)));
+#endif
        for (indx = 0; indx < MINBUCKET + 16; indx++) {
                if (1 << indx >= PAGE_SIZE)
                        bucket[indx].kb_elmpercl = 1;
@@ -560,6 +586,9 @@ malloc_init(data)
        void *data;
 {
        struct malloc_type *type = (struct malloc_type *)data;
+#if defined(NO_KMEM_MAP)
+       uintptr_t limsize;
+#endif
 
        if (type->ks_magic != M_MAGIC)
                panic("malloc type lacks magic");
@@ -571,10 +600,17 @@ malloc_init(data)
                panic("malloc_init not allowed before vm init");
 
        /*
-        * The default limits for each malloc region is 1/2 of the
-        * malloc portion of the kmem map size.
+        * The default limits for each malloc region is 1/10 of available
+        * memory or 1/10 of our KVA space, whichever is lower.
         */
+#if defined(NO_KMEM_MAP)
+       limsize = (uintptr_t)vmstats.v_page_count * PAGE_SIZE;
+       if (limsize > VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS)
+               limsize = VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS;
+       type->ks_limit = limsize / 10;
+#else
        type->ks_limit = vm_kmem_size / 2;
+#endif
        type->ks_next = kmemstatistics; 
        kmemstatistics = type;
 }
index c49e285..f040d02 100644 (file)
@@ -28,7 +28,7 @@
  *     to use a critical section to avoid problems.  Foreign thread 
  *     scheduling is queued via (async) IPIs.
  *
- * $DragonFly: src/sys/kern/lwkt_thread.c,v 1.28 2003/07/25 05:51:19 dillon Exp $
+ * $DragonFly: src/sys/kern/lwkt_thread.c,v 1.29 2003/08/25 19:50:32 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -299,7 +299,7 @@ lwkt_switch(void)
     if (mycpu->gd_intr_nesting_level && 
        td->td_preempted == NULL && panicstr == NULL
     ) {
-       panic("lwkt_switch: cannot switch from within an interrupt, yet\n");
+       panic("lwkt_switch: cannot switch from within a fast interrupt, yet\n");
     }
 
     /*
index ff1c6d3..9e568ec 100644 (file)
@@ -32,7 +32,7 @@
  *
  *     @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
  * $FreeBSD: src/sys/kern/uipc_mbuf.c,v 1.51.2.24 2003/04/15 06:59:29 silby Exp $
- * $DragonFly: src/sys/kern/uipc_mbuf.c,v 1.10 2003/07/26 19:42:11 rob Exp $
+ * $DragonFly: src/sys/kern/uipc_mbuf.c,v 1.11 2003/08/25 19:50:32 dillon Exp $
  */
 
 #include "opt_param.h"
@@ -400,10 +400,8 @@ m_clalloc_wait(void)
        caddr_t p;
        int s;
 
-#ifdef __i386__
        /* If in interrupt context, and INVARIANTS, maintain sanity and die. */
        KASSERT(mycpu->gd_intr_nesting_level == 0, ("CLALLOC: CANNOT WAIT IN INTERRUPT"));
-#endif
 
        /* Sleep until something's available or until we expire. */
        m_clalloc_wid++;
@@ -443,10 +441,8 @@ m_retry(i, t)
         * Must only do the reclaim if not in an interrupt context.
         */
        if (i == M_WAIT) {
-#ifdef __i386__
                KASSERT(mycpu->gd_intr_nesting_level == 0,
                    ("MBALLOC: CANNOT WAIT IN INTERRUPT"));
-#endif
                m_reclaim();
        }
 
@@ -493,10 +489,8 @@ m_retryhdr(i, t)
         * Must only do the reclaim if not in an interrupt context.
         */
        if (i == M_WAIT) {
-#ifdef __i386__
                KASSERT(mycpu->gd_intr_nesting_level == 0,
                    ("MBALLOC: CANNOT WAIT IN INTERRUPT"));
-#endif
                m_reclaim();
        }
 
index e7e9457..7e1c48e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $
- * $DragonFly: src/sys/platform/pc32/apic/apic_vector.s,v 1.12 2003/07/12 17:54:35 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/apic/apic_vector.s,v 1.13 2003/08/25 19:50:32 dillon Exp $
  */
 
 
@@ -151,7 +151,6 @@ IDTVEC(vec_name) ;                                                  \
        FAKE_MCOUNT(13*4(%esp)) ;                                       \
        MASK_LEVEL_IRQ(irq_num) ;                                       \
        EOI_IRQ(irq_num) ;                                              \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;                                     \
        pushl   %eax ;                                                  \
@@ -171,6 +170,7 @@ IDTVEC(vec_name) ;                                                  \
        testl   %eax,%eax ;                                             \
        jz      6f ;                                                    \
        /* clear pending bit, run handler */                            \
+       incl    PCPU(intr_nesting_level) ;                              \
        addl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
        andl    $~IRQ_LBIT(irq_num),PCPU(fpending) ;                    \
        pushl   intr_unit + (irq_num) * 4 ;                             \
@@ -180,6 +180,7 @@ IDTVEC(vec_name) ;                                                  \
        incl    PCPU(cnt)+V_INTR ;      /* book-keeping make per cpu YYY */ \
        movl    intr_countp + (irq_num) * 4, %eax ;                     \
        incl    (%eax) ;                                                \
+       decl    PCPU(intr_nesting_level) ;                              \
        call    rel_mplock ;                                            \
        UNMASK_IRQ(irq_num) ;                                           \
 5: ;                                                                   \
@@ -247,7 +248,7 @@ IDTVEC(vec_name) ;                                                  \
  *
  *     Note that calls to sched_ithd() are made with interrupts enabled
  *     and outside a critical section.  YYY sched_ithd may preempt us
- *     synchronously (fix interrupt stacking)
+ *     synchronously (fix interrupt stacking).
  *
  *     YYY can cache gd base pointer instead of using hidden %fs
  *     prefixes.
@@ -262,7 +263,6 @@ IDTVEC(vec_name) ;                                                  \
 ;                                                                      \
        MASK_LEVEL_IRQ(irq_num) ;                                       \
        EOI_IRQ(irq_num) ;                                              \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;                                     \
        pushl   %eax ;          /* cpl do restore */                    \
@@ -482,11 +482,12 @@ Xipiq:
        movl    PCPU(curthread),%ebx
        cmpl    $TDPRI_CRIT,TD_PRI(%ebx)
        jge     1f
+       incl    PCPU(intr_nesting_level)
        addl    $TDPRI_CRIT,TD_PRI(%ebx)
        call    lwkt_process_ipiq
        subl    $TDPRI_CRIT,TD_PRI(%ebx)
+       decl    PCPU(intr_nesting_level)
        pushl   TD_CPL(%ebx)
-       incl    PCPU(intr_nesting_level)
        MEXITCOUNT
        jmp     doreti
 1:
index 97e5914..437cf8e 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/i386/exception.s,v 1.65.2.3 2001/08/15 01:23:49 peter Exp $
- * $DragonFly: src/sys/platform/pc32/i386/exception.s,v 1.18 2003/08/07 21:17:22 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/exception.s,v 1.19 2003/08/25 19:50:28 dillon Exp $
  */
 
 #include "use_npx.h"
@@ -175,7 +175,6 @@ IDTVEC(fpu)
        call    npx_intr                /* note: call might mess w/ argument */
 
        movl    %ebx, (%esp)            /* save cpl for doreti */
-       incl    PCPU(intr_nesting_level)
        MEXITCOUNT
        jmp     doreti
 #else  /* NNPX > 0 */
@@ -224,7 +223,6 @@ calltrap:
         * to interrupt frame.
         */
        pushl   %ebx                    /* cpl to restore */
-       incl    PCPU(intr_nesting_level)
        MEXITCOUNT
        jmp     doreti
 
@@ -267,7 +265,6 @@ IDTVEC(syscall)
        cmpl    $0,PCPU(reqflags)
        je      doreti_syscall_ret
        pushl   $0                      /* cpl to restore */
-       movl    $1,PCPU(intr_nesting_level)
        jmp     doreti
 
 /*
@@ -301,7 +298,6 @@ IDTVEC(int0x80_syscall)
        cmpl    $0,PCPU(reqflags)
        je      doreti_syscall_ret
        pushl   $0                      /* cpl to restore */
-       movl    $1,PCPU(intr_nesting_level)
        jmp     doreti
 
 /*
@@ -334,7 +330,6 @@ IDTVEC(int0x81_syscall)
        cmpl    $0,PCPU(reqflags)
        je      doreti_syscall_ret
        pushl   $0                      /* cpl to restore */
-       movl    $1,PCPU(intr_nesting_level)
        jmp     doreti
 
 /*
@@ -384,7 +379,6 @@ pmsg4:  .asciz      "fork_trampoline mpcount %d after calling %p"
         * Return via doreti to handle ASTs.
         */
        pushl   $0                      /* cpl to restore */
-       movl    $1,PCPU(intr_nesting_level)
        MEXITCOUNT
        jmp     doreti
 
index c8c630a..ec3ec6c 100644 (file)
@@ -36,7 +36,7 @@
  *
  *     from: @(#)machdep.c     7.4 (Berkeley) 6/3/91
  * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.385.2.30 2003/05/31 08:48:05 alc Exp $
- * $DragonFly: src/sys/platform/pc32/i386/machdep.c,v 1.33 2003/08/20 04:44:55 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/machdep.c,v 1.34 2003/08/25 19:50:28 dillon Exp $
  */
 
 #include "use_apm.h"
@@ -413,8 +413,13 @@ again:
                mb_map_size = roundup2(mb_map_size, max(MCLBYTES, PAGE_SIZE));
                mclrefcnt = malloc(mb_map_size / MCLBYTES, M_MBUF, M_NOWAIT);
                bzero(mclrefcnt, mb_map_size / MCLBYTES);
-               mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr,
-                       mb_map_size);
+#if defined(NO_KMEM_MAP)
+               mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl,
+                           &maxaddr, mb_map_size);
+#else
+               mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl,
+                           &maxaddr, mb_map_size);
+#endif
                mb_map->system_map = 1;
        }
 
index c671d8c..10288d8 100644 (file)
@@ -36,7 +36,7 @@
  *
  *     from: @(#)trap.c        7.4 (Berkeley) 5/13/91
  * $FreeBSD: src/sys/i386/i386/trap.c,v 1.147.2.11 2003/02/27 19:09:59 luoqi Exp $
- * $DragonFly: src/sys/platform/pc32/i386/trap.c,v 1.32 2003/08/12 02:36:15 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/trap.c,v 1.33 2003/08/25 19:50:28 dillon Exp $
  */
 
 /*
@@ -595,7 +595,6 @@ kernel_trap:
                        goto out2;                                      \
                }                                                       \
        } while (0)
-
                        if (mycpu->gd_intr_nesting_level == 0) {
                                /*
                                 * Invalid %fs's and %gs's can be created using
index 645a7c1..6d1159f 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/i386/i386/vm86bios.s,v 1.15.2.1 2000/05/16 06:58:07 dillon Exp $
- * $DragonFly: src/sys/platform/pc32/i386/vm86bios.s,v 1.10 2003/07/08 06:27:26 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/vm86bios.s,v 1.11 2003/08/25 19:50:28 dillon Exp $
  */
 
 #include <machine/asmacros.h>          /* miscellaneous asm macros */
@@ -138,7 +138,6 @@ ENTRY(vm86_bioscall)
         */
        movl    PCPU(curthread),%eax
        pushl   TD_CPL(%eax)
-       incl    PCPU(intr_nesting_level)/* dummy to match doreti */
        MEXITCOUNT
        jmp     doreti
 
index bef74d2..9ca078a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/icu_vector.s,v 1.14.2.2 2000/07/18 21:12:42 dfr Exp $
- * $DragonFly: src/sys/platform/pc32/icu/icu_vector.s,v 1.13 2003/07/12 17:54:35 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/icu/icu_vector.s,v 1.14 2003/08/25 19:50:32 dillon Exp $
  */
 
 /*
@@ -119,7 +119,6 @@ IDTVEC(vec_name) ;                                                  \
        FAKE_MCOUNT(13*4(%esp)) ;                                       \
        MASK_IRQ(icu, irq_num) ;                                        \
        enable_icus ;                                                   \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;     /* save the cpl for doreti */   \
        pushl   %eax ;                                                  \
@@ -134,12 +133,14 @@ IDTVEC(vec_name) ;                                                        \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* clear pending bit, run handler */                            \
+       incl    PCPU(intr_nesting_level) ;                              \
        addl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
        andl    $~IRQ_LBIT(irq_num),PCPU(fpending) ;                    \
        pushl   intr_unit + (irq_num) * 4 ;                             \
        call    *intr_handler + (irq_num) * 4 ;                         \
        addl    $4,%esp ;                                               \
        subl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
+       decl    PCPU(intr_nesting_level) ;                              \
        incl    PCPU(cnt)+V_INTR ; /* book-keeping YYY make per-cpu */  \
        movl    intr_countp + (irq_num) * 4,%eax ;                      \
        incl    (%eax) ;                                                \
@@ -196,6 +197,9 @@ IDTVEC(vec_name) ;                                                  \
  *
  *     YYY sched_ithd may preempt us synchronously (fix interrupt stacking)
  *
+ *     Note that intr_nesting_level is not bumped during sched_ithd because
+ *     blocking allocations are allowed in the preemption case.
+ *
  *     YYY can cache gd base pointer instead of using hidden %fs
  *     prefixes.
  */
@@ -209,7 +213,6 @@ IDTVEC(vec_name) ;                                                  \
        maybe_extra_ipending ;                                          \
        MASK_IRQ(icu, irq_num) ;                                        \
        enable_icus ;                                                   \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx), %eax ;                                    \
        pushl   %eax ;          /* push CPL for doreti */               \
index 45a7045..940c11a 100644 (file)
@@ -37,7 +37,7 @@
  *
  *     from: @(#)vmparam.h     5.9 (Berkeley) 5/12/91
  * $FreeBSD: src/sys/i386/include/vmparam.h,v 1.32.2.1 2000/04/02 08:47:01 peter Exp $
- * $DragonFly: src/sys/platform/pc32/include/vmparam.h,v 1.2 2003/06/17 04:28:36 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/include/vmparam.h,v 1.3 2003/08/25 19:50:29 dillon Exp $
  */
 
 
 #define VM_MAX_ADDRESS         VADDR(PTDPTDI, PTDPTDI)
 #define VM_MIN_ADDRESS         ((vm_offset_t)0)
 
+#if !defined(NO_KMEM_MAP)
 /* virtual sizes (bytes) for various kernel submaps */
 #ifndef VM_KMEM_SIZE
 #define VM_KMEM_SIZE           (12 * 1024 * 1024)
 #define        VM_KMEM_SIZE_MAX        (200 * 1024 * 1024)
 #endif
 
+#endif
+
 /* initial pagein size of beginning of executable file */
 #ifndef VM_INITIAL_PAGEIN
 #define        VM_INITIAL_PAGEIN       16
index 79c041a..a3cd828 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $
- * $DragonFly: src/sys/platform/pc32/isa/Attic/apic_vector.s,v 1.12 2003/07/12 17:54:35 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/isa/Attic/apic_vector.s,v 1.13 2003/08/25 19:50:32 dillon Exp $
  */
 
 
@@ -151,7 +151,6 @@ IDTVEC(vec_name) ;                                                  \
        FAKE_MCOUNT(13*4(%esp)) ;                                       \
        MASK_LEVEL_IRQ(irq_num) ;                                       \
        EOI_IRQ(irq_num) ;                                              \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;                                     \
        pushl   %eax ;                                                  \
@@ -171,6 +170,7 @@ IDTVEC(vec_name) ;                                                  \
        testl   %eax,%eax ;                                             \
        jz      6f ;                                                    \
        /* clear pending bit, run handler */                            \
+       incl    PCPU(intr_nesting_level) ;                              \
        addl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
        andl    $~IRQ_LBIT(irq_num),PCPU(fpending) ;                    \
        pushl   intr_unit + (irq_num) * 4 ;                             \
@@ -180,6 +180,7 @@ IDTVEC(vec_name) ;                                                  \
        incl    PCPU(cnt)+V_INTR ;      /* book-keeping make per cpu YYY */ \
        movl    intr_countp + (irq_num) * 4, %eax ;                     \
        incl    (%eax) ;                                                \
+       decl    PCPU(intr_nesting_level) ;                              \
        call    rel_mplock ;                                            \
        UNMASK_IRQ(irq_num) ;                                           \
 5: ;                                                                   \
@@ -247,7 +248,7 @@ IDTVEC(vec_name) ;                                                  \
  *
  *     Note that calls to sched_ithd() are made with interrupts enabled
  *     and outside a critical section.  YYY sched_ithd may preempt us
- *     synchronously (fix interrupt stacking)
+ *     synchronously (fix interrupt stacking).
  *
  *     YYY can cache gd base pointer instead of using hidden %fs
  *     prefixes.
@@ -262,7 +263,6 @@ IDTVEC(vec_name) ;                                                  \
 ;                                                                      \
        MASK_LEVEL_IRQ(irq_num) ;                                       \
        EOI_IRQ(irq_num) ;                                              \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;                                     \
        pushl   %eax ;          /* cpl do restore */                    \
@@ -482,11 +482,12 @@ Xipiq:
        movl    PCPU(curthread),%ebx
        cmpl    $TDPRI_CRIT,TD_PRI(%ebx)
        jge     1f
+       incl    PCPU(intr_nesting_level)
        addl    $TDPRI_CRIT,TD_PRI(%ebx)
        call    lwkt_process_ipiq
        subl    $TDPRI_CRIT,TD_PRI(%ebx)
+       decl    PCPU(intr_nesting_level)
        pushl   TD_CPL(%ebx)
-       incl    PCPU(intr_nesting_level)
        MEXITCOUNT
        jmp     doreti
 1:
index 22364cc..4ccb076 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/icu_vector.s,v 1.14.2.2 2000/07/18 21:12:42 dfr Exp $
- * $DragonFly: src/sys/platform/pc32/isa/Attic/icu_vector.s,v 1.13 2003/07/12 17:54:35 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/isa/Attic/icu_vector.s,v 1.14 2003/08/25 19:50:32 dillon Exp $
  */
 
 /*
@@ -119,7 +119,6 @@ IDTVEC(vec_name) ;                                                  \
        FAKE_MCOUNT(13*4(%esp)) ;                                       \
        MASK_IRQ(icu, irq_num) ;                                        \
        enable_icus ;                                                   \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx),%eax ;     /* save the cpl for doreti */   \
        pushl   %eax ;                                                  \
@@ -134,12 +133,14 @@ IDTVEC(vec_name) ;                                                        \
        jmp     5f ;                                                    \
 2: ;                                                                   \
        /* clear pending bit, run handler */                            \
+       incl    PCPU(intr_nesting_level) ;                              \
        addl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
        andl    $~IRQ_LBIT(irq_num),PCPU(fpending) ;                    \
        pushl   intr_unit + (irq_num) * 4 ;                             \
        call    *intr_handler + (irq_num) * 4 ;                         \
        addl    $4,%esp ;                                               \
        subl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
+       decl    PCPU(intr_nesting_level) ;                              \
        incl    PCPU(cnt)+V_INTR ; /* book-keeping YYY make per-cpu */  \
        movl    intr_countp + (irq_num) * 4,%eax ;                      \
        incl    (%eax) ;                                                \
@@ -196,6 +197,9 @@ IDTVEC(vec_name) ;                                                  \
  *
  *     YYY sched_ithd may preempt us synchronously (fix interrupt stacking)
  *
+ *     Note that intr_nesting_level is not bumped during sched_ithd because
+ *     blocking allocations are allowed in the preemption case.
+ *
  *     YYY can cache gd base pointer instead of using hidden %fs
  *     prefixes.
  */
@@ -209,7 +213,6 @@ IDTVEC(vec_name) ;                                                  \
        maybe_extra_ipending ;                                          \
        MASK_IRQ(icu, irq_num) ;                                        \
        enable_icus ;                                                   \
-       incl    PCPU(intr_nesting_level) ;                              \
        movl    PCPU(curthread),%ebx ;                                  \
        movl    TD_CPL(%ebx), %eax ;                                    \
        pushl   %eax ;          /* push CPL for doreti */               \
index 0a483b3..ca802ec 100644 (file)
@@ -37,7 +37,7 @@
  *     @(#)ipl.s
  *
  * $FreeBSD: src/sys/i386/isa/ipl.s,v 1.32.2.3 2002/05/16 16:03:56 bde Exp $
- * $DragonFly: src/sys/platform/pc32/isa/ipl.s,v 1.11 2003/07/20 07:14:27 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/isa/ipl.s,v 1.12 2003/08/25 19:50:32 dillon Exp $
  */
 
 
@@ -129,7 +129,6 @@ doreti_next:
        jnz     5f
        andl    $~RQF_INTPEND,PCPU(reqflags)
 5:
-       decl    PCPU(intr_nesting_level)
        MEXITCOUNT
        .globl  doreti_popl_fs
        .globl  doreti_popl_es
@@ -182,8 +181,11 @@ doreti_fast:
        popl    %ecx
        testl   %eax,%eax
        jz      1f
+       /* MP lock successful */
 #endif
-       call    *fastunpend(,%ecx,4)    /* MP lock successful */
+       incl    PCPU(intr_nesting_level)
+       call    *fastunpend(,%ecx,4)
+       decl    PCPU(intr_nesting_level)
 #ifdef SMP
        call    rel_mplock
 #endif
@@ -231,11 +233,9 @@ doreti_ast:
        sti
        movl    %eax,%esi               /* save cpl (can't use stack) */
        movl    $T_ASTFLT,TF_TRAPNO(%esp)
-       decl    PCPU(intr_nesting_level) /* syscall-like, not interrupt-like */
        subl    $TDPRI_CRIT,TD_PRI(%ebx)
 1:     call    trap
        addl    $TDPRI_CRIT,TD_PRI(%ebx)
-       incl    PCPU(intr_nesting_level)
        movl    %esi,%eax               /* restore cpl for loop */
        jmp     doreti_next
 
@@ -244,8 +244,10 @@ doreti_ast:
         * IPIQ message pending.  We clear RQF_IPIQ automatically.
         */
 doreti_ipiq:
+       incl    PCPU(intr_nesting_level)
        andl    $~RQF_IPIQ,PCPU(reqflags)
        call    lwkt_process_ipiq
+       decl    PCPU(intr_nesting_level)
        movl    TD_CPL(%ebx),%eax       /* retrieve cpl again for loop */
        jmp     doreti_next
 
index 5e9e1c5..0fb6ddb 100644 (file)
  *
  *     @(#)malloc.h    8.5 (Berkeley) 5/3/95
  * $FreeBSD: src/sys/sys/malloc.h,v 1.48.2.2 2002/03/16 02:19:16 archie Exp $
- * $DragonFly: src/sys/sys/malloc.h,v 1.5 2003/08/20 07:31:21 rob Exp $
+ * $DragonFly: src/sys/sys/malloc.h,v 1.6 2003/08/25 19:50:33 dillon Exp $
  */
 
 #ifndef _SYS_MALLOC_H_
 #define        _SYS_MALLOC_H_
 
+#ifndef _MACHINE_VMPARAM_H_
+#include <machine/vmparam.h>   /* for VM_MIN_KERNEL_ADDRESS */
+#endif
+
 #define splmem splhigh
 
 /*
@@ -148,9 +152,13 @@ struct kmembuckets {
 /*
  * Turn virtual addresses into kmem map indices
  */
+#if defined(NO_KMEM_MAP)
+#define btokup(addr)   (&kmemusage[((caddr_t)(addr) - (caddr_t)VM_MIN_KERNEL_ADDRESS) >> PAGE_SHIFT])
+#else
 #define kmemxtob(alloc)        (kmembase + (alloc) * PAGE_SIZE)
 #define btokmemx(addr) (((caddr_t)(addr) - kmembase) / PAGE_SIZE)
 #define btokup(addr)   (&kmemusage[((caddr_t)(addr) - kmembase) >> PAGE_SHIFT])
+#endif
 
 /*
  * Deprecated macro versions of not-quite-malloc() and free().
index eaf3215..32eaafb 100644 (file)
@@ -4,7 +4,7 @@
  *     Implements the architecture independant portion of the LWKT 
  *     subsystem.
  * 
- * $DragonFly: src/sys/sys/thread.h,v 1.30 2003/08/24 22:36:43 hsu Exp $
+ * $DragonFly: src/sys/sys/thread.h,v 1.31 2003/08/25 19:50:33 dillon Exp $
  */
 
 #ifndef _SYS_THREAD_H_
@@ -183,6 +183,7 @@ struct thread {
 #define TDF_STOPREQ            0x2000  /* suspend_kproc */
 #define TDF_WAKEREQ            0x4000  /* resume_kproc */
 #define TDF_TIMEOUT            0x8000  /* tsleep timeout */
+#define TDF_INTTHREAD          0x00010000      /* interrupt thread */
 
 /*
  * Thread priorities.  Typically only one thread from any given
index b81c479..507e380 100644 (file)
@@ -62,7 +62,7 @@
  * rights to redistribute these changes.
  *
  * $FreeBSD: src/sys/vm/vm_kern.c,v 1.61.2.2 2002/03/12 18:25:26 tegge Exp $
- * $DragonFly: src/sys/vm/vm_kern.c,v 1.6 2003/08/25 17:01:13 dillon Exp $
+ * $DragonFly: src/sys/vm/vm_kern.c,v 1.7 2003/08/25 19:50:33 dillon Exp $
  */
 
 /*
@@ -85,7 +85,9 @@
 #include <vm/vm_extern.h>
 
 vm_map_t kernel_map=0;
+#if !defined(NO_KMEM_MAP)
 vm_map_t kmem_map=0;
+#endif
 vm_map_t exec_map=0;
 vm_map_t clean_map=0;
 vm_map_t buffer_map=0;
@@ -307,8 +309,13 @@ kmem_malloc(map, size, flags)
        vm_offset_t addr;
        vm_page_t m;
 
+#if defined(NO_KMEM_MAP)
+       if (map != kernel_map && map != mb_map)
+               panic("kmem_malloc: map != {kmem,mb}_map");
+#else
        if (map != kmem_map && map != mb_map)
                panic("kmem_malloc: map != {kmem,mb}_map");
+#endif
 
        size = round_page(size);
        addr = vm_map_min(map);
@@ -326,8 +333,13 @@ kmem_malloc(map, size, flags)
                        printf("Out of mbuf clusters - adjust NMBCLUSTERS or increase maxusers!\n");
                        return (0);
                }
+#if defined(NO_KMEM_MAP)
+               if ((flags & M_NOWAIT) == 0)
+                       panic("kmem_malloc(%ld): kernel_map too small: %ld total allocated",
+#else
                if ((flags & M_NOWAIT) == 0)
                        panic("kmem_malloc(%ld): kmem_map too small: %ld total allocated",
+#endif
                                (long)size, (long)map->size);
                return (0);
        }
index 92b882f..b37e604 100644 (file)
@@ -62,7 +62,7 @@
  * rights to redistribute these changes.
  *
  * $FreeBSD: src/sys/vm/vm_kern.h,v 1.22 2000/02/16 21:11:31 dillon Exp $
- * $DragonFly: src/sys/vm/vm_kern.h,v 1.2 2003/06/17 04:29:00 dillon Exp $
+ * $DragonFly: src/sys/vm/vm_kern.h,v 1.3 2003/08/25 19:50:33 dillon Exp $
  */
 
 #ifndef _VM_VM_KERN_H_
@@ -71,7 +71,9 @@
 /* Kernel memory management definitions. */
 extern vm_map_t buffer_map;
 extern vm_map_t kernel_map;
+#if !defined(NO_KMEM_MAP)
 extern vm_map_t kmem_map;
+#endif
 extern vm_map_t mb_map;
 extern int mb_map_full;
 extern vm_map_t clean_map;
index 025e83b..de0702c 100644 (file)
@@ -62,7 +62,7 @@
  * rights to redistribute these changes.
  *
  * $FreeBSD: src/sys/vm/vm_map.c,v 1.187.2.19 2003/05/27 00:47:02 alc Exp $
- * $DragonFly: src/sys/vm/vm_map.c,v 1.9 2003/08/25 17:01:13 dillon Exp $
+ * $DragonFly: src/sys/vm/vm_map.c,v 1.10 2003/08/25 19:50:33 dillon Exp $
  */
 
 /*
@@ -769,19 +769,26 @@ vm_map_find(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
            vm_prot_t max, int cow)
 {
        vm_offset_t start;
-       int result, s = 0;
+       int result;
+#if !defined(NO_KMEM_MAP)
+       int s = 0;
+#endif
 
        start = *addr;
 
+#if !defined(NO_KMEM_MAP)
        if (map == kmem_map || map == mb_map)
                s = splvm();
+#endif
 
        vm_map_lock(map);
        if (find_space) {
                if (vm_map_findspace(map, start, length, 1, addr)) {
                        vm_map_unlock(map);
+#if !defined(NO_KMEM_MAP)
                        if (map == kmem_map || map == mb_map)
                                splx(s);
+#endif
                        return (KERN_NO_SPACE);
                }
                start = *addr;
@@ -790,8 +797,10 @@ vm_map_find(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
                start, start + length, prot, max, cow);
        vm_map_unlock(map);
 
+#if !defined(NO_KMEM_MAP)
        if (map == kmem_map || map == mb_map)
                splx(s);
+#endif
 
        return (result);
 }
@@ -2229,18 +2238,25 @@ vm_map_remove(map, start, end)
        vm_offset_t start;
        vm_offset_t end;
 {
-       int result, s = 0;
+       int result;
+#if !defined(NO_KMEM_MAP)
+       int s = 0;
+#endif
 
+#if !defined(NO_KMEM_MAP)
        if (map == kmem_map || map == mb_map)
                s = splvm();
+#endif
 
        vm_map_lock(map);
        VM_MAP_RANGE_CHECK(map, start, end);
        result = vm_map_delete(map, start, end);
        vm_map_unlock(map);
 
+#if !defined(NO_KMEM_MAP)
        if (map == kmem_map || map == mb_map)
                splx(s);
+#endif
 
        return (result);
 }
index 00d2d62..402bd1f 100644 (file)
@@ -39,7 +39,7 @@
  *
  *     @(#)vm_mmap.c   8.4 (Berkeley) 1/12/94
  * $FreeBSD: src/sys/vm/vm_mmap.c,v 1.108.2.6 2002/07/02 20:06:19 dillon Exp $
- * $DragonFly: src/sys/vm/vm_mmap.c,v 1.11 2003/08/20 08:03:01 rob Exp $
+ * $DragonFly: src/sys/vm/vm_mmap.c,v 1.12 2003/08/25 19:50:33 dillon Exp $
  */
 
 /*
@@ -99,8 +99,14 @@ static void
 vmmapentry_rsrc_init(dummy)
         void *dummy;
 {
+#if defined(NO_KMEM_MAP)
+    max_proc_mmap = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) /
+                       sizeof(struct vm_map_entry);
+    max_proc_mmap /= 100;
+#else
     max_proc_mmap = vm_kmem_size / sizeof(struct vm_map_entry);
     max_proc_mmap /= 100;
+#endif
 }
 
 /* ARGSUSED */
index b4d9ea8..f4efa76 100644 (file)
@@ -62,7 +62,7 @@
  * rights to redistribute these changes.
  *
  * $FreeBSD: src/sys/vm/vm_object.c,v 1.171.2.8 2003/05/26 19:17:56 alc Exp $
- * $DragonFly: src/sys/vm/vm_object.c,v 1.7 2003/08/20 08:03:01 rob Exp $
+ * $DragonFly: src/sys/vm/vm_object.c,v 1.8 2003/08/25 19:50:33 dillon Exp $
  */
 
 /*
@@ -1785,8 +1785,10 @@ vm_object_in_map( object)
        }
        if( _vm_object_in_map( kernel_map, object, 0))
                return 1;
+#if !defined(NO_KMEM_MAP)
        if( _vm_object_in_map( kmem_map, object, 0))
                return 1;
+#endif
        if( _vm_object_in_map( pager_map, object, 0))
                return 1;
        if( _vm_object_in_map( buffer_map, object, 0))
index 7ed13ce..320db77 100644 (file)
@@ -12,7 +12,7 @@
  *     John S. Dyson.
  *
  * $FreeBSD: src/sys/vm/vm_zone.c,v 1.30.2.6 2002/10/10 19:50:16 dillon Exp $
- * $DragonFly: src/sys/vm/vm_zone.c,v 1.7 2003/07/29 21:24:33 hmp Exp $
+ * $DragonFly: src/sys/vm/vm_zone.c,v 1.8 2003/08/25 19:50:33 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -113,8 +113,7 @@ zfree(vm_zone_t z, void *item)
  * must reside in areas after the first two longwords.
  *
  * zinitna, zinit, zbootinit are the initialization routines.
- * zalloc, zfree, are the interrupt/lock unsafe allocation/free routines.
- * zalloci, zfreei, are the interrupt/lock safe allocation/free routines.
+ * zalloc, zfree, are the allocation/free routines.
  */
 
 static struct vm_zone *zlist;
@@ -280,17 +279,12 @@ zbootinit(vm_zone_t z, char *name, int size, void *item, int nitems)
 
 /*
  * void *zalloc(vm_zone_t zone) --
- *     Returns an item from a specified zone.
+ *     Returns an item from a specified zone.  May not be called from a
+ *     FAST interrupt or IPI function.
  *
  * void zfree(vm_zone_t zone, void *item) --
- *  Frees an item back to a specified zone.
- *
- * void *zalloci(vm_zone_t zone) --
- *     Returns an item from a specified zone, interrupt safe.
- *
- * void zfreei(vm_zone_t zone, void *item) --
- *  Frees an item back to a specified zone, interrupt safe.
- *
+ *     Frees an item back to a specified zone.  May not be called from a
+ *     FAST interrupt or IPI function.
  */
 
 /*
@@ -332,6 +326,7 @@ zget(vm_zone_t z)
        } else {
                nbytes = z->zalloc * PAGE_SIZE;
 
+#if !defined(NO_KMEM_MAP)
                /*
                 * Check to see if the kernel map is already locked. 
                 * We could allow for recursive locks, but that eliminates
@@ -354,7 +349,9 @@ zget(vm_zone_t z)
                        if (item != NULL)
                                zone_kmem_pages += z->zalloc;
                        splx(s);
-               } else {
+               } else
+#endif
+               {
                        item = (void *) kmem_alloc(kernel_map, nbytes);
                        lwkt_regettoken(&z->zlock);
                        if (item != NULL)