Date: Tue, 5 Apr 2005 18:33:49 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 74533 for review Message-ID: <200504051833.j35IXn8M063515@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=74533 Change 74533 by jhb@jhb_slimer on 2005/04/05 18:33:47 IFC @74532. Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/critical.c#6 delete .. //depot/projects/smpng/sys/alpha/alpha/machdep.c#80 integrate .. //depot/projects/smpng/sys/alpha/alpha/mp_machdep.c#33 integrate .. //depot/projects/smpng/sys/alpha/alpha/vm_machdep.c#39 integrate .. //depot/projects/smpng/sys/alpha/include/critical.h#7 delete .. //depot/projects/smpng/sys/alpha/include/proc.h#9 integrate .. //depot/projects/smpng/sys/alpha/osf1/imgact_osf1.c#14 integrate .. //depot/projects/smpng/sys/alpha/osf1/osf1_misc.c#37 integrate .. //depot/projects/smpng/sys/amd64/amd64/critical.c#7 delete .. //depot/projects/smpng/sys/amd64/amd64/machdep.c#38 integrate .. //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c#18 integrate .. //depot/projects/smpng/sys/amd64/amd64/vm_machdep.c#25 integrate .. //depot/projects/smpng/sys/amd64/include/critical.h#8 delete .. //depot/projects/smpng/sys/amd64/include/floatingpoint.h#2 integrate .. //depot/projects/smpng/sys/amd64/include/proc.h#5 integrate .. //depot/projects/smpng/sys/amd64/linux32/linux32_machdep.c#7 integrate .. //depot/projects/smpng/sys/arm/arm/critical.c#3 delete .. //depot/projects/smpng/sys/arm/arm/machdep.c#12 integrate .. //depot/projects/smpng/sys/arm/arm/vm_machdep.c#10 integrate .. //depot/projects/smpng/sys/arm/include/critical.h#3 delete .. //depot/projects/smpng/sys/arm/include/proc.h#5 integrate .. //depot/projects/smpng/sys/boot/pc98/boot2/Makefile#14 integrate .. //depot/projects/smpng/sys/compat/linux/linux_misc.c#55 integrate .. //depot/projects/smpng/sys/compat/svr4/imgact_svr4.c#13 integrate .. //depot/projects/smpng/sys/conf/Makefile.alpha#23 integrate .. //depot/projects/smpng/sys/conf/Makefile.amd64#9 integrate .. //depot/projects/smpng/sys/conf/Makefile.arm#7 integrate .. //depot/projects/smpng/sys/conf/Makefile.i386#21 integrate .. //depot/projects/smpng/sys/conf/Makefile.ia64#28 integrate .. //depot/projects/smpng/sys/conf/Makefile.pc98#20 integrate .. //depot/projects/smpng/sys/conf/Makefile.powerpc#28 integrate .. //depot/projects/smpng/sys/conf/Makefile.sparc64#24 integrate .. //depot/projects/smpng/sys/conf/NOTES#96 integrate .. //depot/projects/smpng/sys/conf/files.alpha#34 integrate .. //depot/projects/smpng/sys/conf/files.amd64#30 integrate .. //depot/projects/smpng/sys/conf/files.arm#4 integrate .. //depot/projects/smpng/sys/conf/files.i386#80 integrate .. //depot/projects/smpng/sys/conf/files.ia64#47 integrate .. //depot/projects/smpng/sys/conf/files.pc98#72 integrate .. //depot/projects/smpng/sys/conf/files.powerpc#22 integrate .. //depot/projects/smpng/sys/conf/files.sparc64#49 integrate .. //depot/projects/smpng/sys/conf/kern.post.mk#44 integrate .. //depot/projects/smpng/sys/conf/kmod.mk#45 integrate .. //depot/projects/smpng/sys/conf/options#97 integrate .. //depot/projects/smpng/sys/dev/acpi_support/acpi_fujitsu.c#2 integrate .. //depot/projects/smpng/sys/dev/acpica/acpi_cpu.c#32 integrate .. //depot/projects/smpng/sys/dev/acpica/acpi_if.m#6 integrate .. //depot/projects/smpng/sys/dev/acpica/acpivar.h#55 integrate .. //depot/projects/smpng/sys/dev/asr/asr.c#28 integrate .. //depot/projects/smpng/sys/dev/ata/ata-chipset.c#50 integrate .. //depot/projects/smpng/sys/dev/ata/ata-lowlevel.c#26 integrate .. //depot/projects/smpng/sys/dev/ata/ata-pci.c#53 integrate .. //depot/projects/smpng/sys/dev/ata/ata-pci.h#28 integrate .. //depot/projects/smpng/sys/dev/ata/atapi-cam.c#22 integrate .. //depot/projects/smpng/sys/dev/ath/ath_rate/amrr/amrr.c#5 integrate .. //depot/projects/smpng/sys/dev/ath/ath_rate/onoe/onoe.c#5 integrate .. //depot/projects/smpng/sys/dev/ath/ath_rate/sample/sample.c#3 integrate .. //depot/projects/smpng/sys/dev/ath/if_ath.c#25 integrate .. //depot/projects/smpng/sys/dev/ath/if_athrate.h#4 integrate .. //depot/projects/smpng/sys/dev/ath/if_athvar.h#14 integrate .. //depot/projects/smpng/sys/dev/drm/drm_bufs.h#11 integrate .. //depot/projects/smpng/sys/dev/em/if_em.c#46 integrate .. //depot/projects/smpng/sys/dev/hme/if_hme_sbus.c#12 integrate .. //depot/projects/smpng/sys/dev/ieee488/upd7210.c#4 integrate .. //depot/projects/smpng/sys/dev/ixgb/if_ixgb.c#7 integrate .. //depot/projects/smpng/sys/dev/ixgb/if_ixgb.h#4 integrate .. //depot/projects/smpng/sys/dev/pci/pcireg.h#8 integrate .. //depot/projects/smpng/sys/dev/sio/sio_pci.c#16 integrate .. //depot/projects/smpng/sys/dev/syscons/apm/apm_saver.c#6 integrate .. //depot/projects/smpng/sys/fs/unionfs/union_vnops.c#27 integrate .. //depot/projects/smpng/sys/geom/concat/g_concat.c#12 integrate .. //depot/projects/smpng/sys/i386/cpufreq/est.c#3 integrate .. //depot/projects/smpng/sys/i386/i386/critical.c#11 delete .. //depot/projects/smpng/sys/i386/i386/machdep.c#91 integrate .. //depot/projects/smpng/sys/i386/i386/mp_machdep.c#80 integrate .. //depot/projects/smpng/sys/i386/i386/vm_machdep.c#64 integrate .. //depot/projects/smpng/sys/i386/ibcs2/imgact_coff.c#19 integrate .. //depot/projects/smpng/sys/i386/include/apm_bios.h#4 integrate .. //depot/projects/smpng/sys/i386/include/bus.h#4 integrate .. //depot/projects/smpng/sys/i386/include/bus_at386.h#14 delete .. //depot/projects/smpng/sys/i386/include/bus_pc98.h#11 delete .. //depot/projects/smpng/sys/i386/include/critical.h#10 delete .. //depot/projects/smpng/sys/i386/include/floatingpoint.h#4 integrate .. //depot/projects/smpng/sys/i386/include/legacyvar.h#4 integrate .. //depot/projects/smpng/sys/i386/include/md_var.h#27 integrate .. //depot/projects/smpng/sys/i386/include/pci_cfgreg.h#9 integrate .. //depot/projects/smpng/sys/i386/include/proc.h#15 integrate .. //depot/projects/smpng/sys/i386/linux/imgact_linux.c#17 integrate .. //depot/projects/smpng/sys/ia64/ia64/critical.c#5 delete .. //depot/projects/smpng/sys/ia64/ia64/machdep.c#93 integrate .. //depot/projects/smpng/sys/ia64/ia64/mp_machdep.c#28 integrate .. //depot/projects/smpng/sys/ia64/ia64/vm_machdep.c#46 integrate .. //depot/projects/smpng/sys/ia64/include/critical.h#7 delete .. //depot/projects/smpng/sys/ia64/include/proc.h#10 integrate .. //depot/projects/smpng/sys/kern/imgact_elf.c#42 integrate .. //depot/projects/smpng/sys/kern/imgact_gzip.c#12 integrate .. //depot/projects/smpng/sys/kern/kern_fork.c#93 integrate .. //depot/projects/smpng/sys/kern/kern_idle.c#25 integrate .. //depot/projects/smpng/sys/kern/kern_jail.c#38 integrate .. //depot/projects/smpng/sys/kern/kern_lock.c#40 integrate .. //depot/projects/smpng/sys/kern/kern_mutex.c#97 integrate .. //depot/projects/smpng/sys/kern/kern_proc.c#74 integrate .. //depot/projects/smpng/sys/kern/kern_switch.c#56 integrate .. //depot/projects/smpng/sys/kern/subr_bus.c#50 integrate .. //depot/projects/smpng/sys/kern/vfs_default.c#39 integrate .. //depot/projects/smpng/sys/kern/vfs_lookup.c#27 integrate .. //depot/projects/smpng/sys/kern/vfs_subr.c#100 integrate .. //depot/projects/smpng/sys/kern/vfs_vnops.c#61 integrate .. //depot/projects/smpng/sys/libkern/strspn.c#2 integrate .. //depot/projects/smpng/sys/modules/ata/Makefile#2 integrate .. //depot/projects/smpng/sys/modules/ata/atapicam/Makefile#1 branch .. //depot/projects/smpng/sys/modules/cpufreq/Makefile#4 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_crypto.h#4 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_freebsd.h#4 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_input.c#17 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_node.h#11 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_proto.h#7 integrate .. //depot/projects/smpng/sys/netgraph/ng_iface.c#21 integrate .. //depot/projects/smpng/sys/netgraph/ng_source.c#13 integrate .. //depot/projects/smpng/sys/netgraph/ng_source.h#6 integrate .. //depot/projects/smpng/sys/pc98/conf/GENERIC#54 integrate .. //depot/projects/smpng/sys/pc98/conf/NOTES#35 integrate .. //depot/projects/smpng/sys/pc98/i386/machdep.c#80 integrate .. //depot/projects/smpng/sys/pc98/include/_inttypes.h#1 branch .. //depot/projects/smpng/sys/pc98/include/_limits.h#1 branch .. //depot/projects/smpng/sys/pc98/include/_stdint.h#1 branch .. //depot/projects/smpng/sys/pc98/include/_types.h#1 branch .. //depot/projects/smpng/sys/pc98/include/apm_bios.h#1 branch .. //depot/projects/smpng/sys/pc98/include/apm_segments.h#1 branch .. //depot/projects/smpng/sys/pc98/include/asm.h#1 branch .. //depot/projects/smpng/sys/pc98/include/asmacros.h#1 branch .. //depot/projects/smpng/sys/pc98/include/atomic.h#1 branch .. //depot/projects/smpng/sys/pc98/include/bootinfo.h#1 branch .. //depot/projects/smpng/sys/pc98/include/bus.h#1 branch .. //depot/projects/smpng/sys/pc98/include/bus_dma.h#1 branch .. //depot/projects/smpng/sys/pc98/include/bus_memio.h#1 branch .. //depot/projects/smpng/sys/pc98/include/bus_pio.h#1 branch .. //depot/projects/smpng/sys/pc98/include/clock.h#1 branch .. //depot/projects/smpng/sys/pc98/include/cpu.h#1 branch .. //depot/projects/smpng/sys/pc98/include/cpufunc.h#1 branch .. //depot/projects/smpng/sys/pc98/include/cputypes.h#1 branch .. //depot/projects/smpng/sys/pc98/include/cserial.h#1 branch .. //depot/projects/smpng/sys/pc98/include/db_machdep.h#1 branch .. //depot/projects/smpng/sys/pc98/include/elf.h#1 branch .. //depot/projects/smpng/sys/pc98/include/endian.h#1 branch .. //depot/projects/smpng/sys/pc98/include/exec.h#1 branch .. //depot/projects/smpng/sys/pc98/include/float.h#1 branch .. //depot/projects/smpng/sys/pc98/include/floatingpoint.h#1 branch .. //depot/projects/smpng/sys/pc98/include/frame.h#1 branch .. //depot/projects/smpng/sys/pc98/include/gdb_machdep.h#1 branch .. //depot/projects/smpng/sys/pc98/include/i4b_cause.h#1 branch .. //depot/projects/smpng/sys/pc98/include/i4b_debug.h#1 branch .. //depot/projects/smpng/sys/pc98/include/i4b_ioctl.h#1 branch .. //depot/projects/smpng/sys/pc98/include/i4b_rbch_ioctl.h#1 branch .. //depot/projects/smpng/sys/pc98/include/i4b_tel_ioctl.h#1 branch .. //depot/projects/smpng/sys/pc98/include/i4b_trace.h#1 branch .. //depot/projects/smpng/sys/pc98/include/ieeefp.h#1 branch .. //depot/projects/smpng/sys/pc98/include/in_cksum.h#1 branch .. //depot/projects/smpng/sys/pc98/include/intr_machdep.h#1 branch .. //depot/projects/smpng/sys/pc98/include/iodev.h#1 branch .. //depot/projects/smpng/sys/pc98/include/kdb.h#1 branch .. //depot/projects/smpng/sys/pc98/include/legacyvar.h#1 branch .. //depot/projects/smpng/sys/pc98/include/limits.h#1 branch .. //depot/projects/smpng/sys/pc98/include/md_var.h#1 branch .. //depot/projects/smpng/sys/pc98/include/memdev.h#1 branch .. //depot/projects/smpng/sys/pc98/include/metadata.h#1 branch .. //depot/projects/smpng/sys/pc98/include/mp_watchdog.h#1 branch .. //depot/projects/smpng/sys/pc98/include/mptable.h#1 branch .. //depot/projects/smpng/sys/pc98/include/mutex.h#1 branch .. //depot/projects/smpng/sys/pc98/include/npx.h#1 branch .. //depot/projects/smpng/sys/pc98/include/param.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pc/bios.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pc/display.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pc/vesa.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pcaudio.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pcb.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pcb_ext.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pci_cfgreg.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pcpu.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pecoff_machdep.h#1 branch .. //depot/projects/smpng/sys/pc98/include/perfmon.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pmap.h#1 branch .. //depot/projects/smpng/sys/pc98/include/privatespace.h#1 branch .. //depot/projects/smpng/sys/pc98/include/proc.h#1 branch .. //depot/projects/smpng/sys/pc98/include/profile.h#1 branch .. //depot/projects/smpng/sys/pc98/include/psl.h#1 branch .. //depot/projects/smpng/sys/pc98/include/ptrace.h#1 branch .. //depot/projects/smpng/sys/pc98/include/pvct_ioctl.h#1 branch .. //depot/projects/smpng/sys/pc98/include/reg.h#1 branch .. //depot/projects/smpng/sys/pc98/include/reloc.h#1 branch .. //depot/projects/smpng/sys/pc98/include/resource.h#1 branch .. //depot/projects/smpng/sys/pc98/include/runq.h#1 branch .. //depot/projects/smpng/sys/pc98/include/segments.h#1 branch .. //depot/projects/smpng/sys/pc98/include/setjmp.h#1 branch .. //depot/projects/smpng/sys/pc98/include/sf_buf.h#1 branch .. //depot/projects/smpng/sys/pc98/include/sigframe.h#1 branch .. //depot/projects/smpng/sys/pc98/include/signal.h#1 branch .. //depot/projects/smpng/sys/pc98/include/smapi.h#1 branch .. //depot/projects/smpng/sys/pc98/include/smp.h#1 branch .. //depot/projects/smpng/sys/pc98/include/speaker.h#1 branch .. //depot/projects/smpng/sys/pc98/include/specialreg.h#1 branch .. //depot/projects/smpng/sys/pc98/include/stdarg.h#1 branch .. //depot/projects/smpng/sys/pc98/include/sysarch.h#1 branch .. //depot/projects/smpng/sys/pc98/include/trap.h#1 branch .. //depot/projects/smpng/sys/pc98/include/tss.h#1 branch .. //depot/projects/smpng/sys/pc98/include/ucontext.h#1 branch .. //depot/projects/smpng/sys/pc98/include/varargs.h#1 branch .. //depot/projects/smpng/sys/pc98/include/vm86.h#1 branch .. //depot/projects/smpng/sys/pc98/include/vmparam.h#1 branch .. //depot/projects/smpng/sys/pc98/linux/linux.h#1 branch .. //depot/projects/smpng/sys/pc98/linux/linux_ipc64.h#1 branch .. //depot/projects/smpng/sys/pc98/linux/linux_proto.h#1 branch .. //depot/projects/smpng/sys/pci/agp_amd64.c#4 integrate .. //depot/projects/smpng/sys/pci/agp_nvidia.c#5 integrate .. //depot/projects/smpng/sys/powerpc/include/critical.h#9 delete .. //depot/projects/smpng/sys/powerpc/include/proc.h#6 integrate .. //depot/projects/smpng/sys/powerpc/powerpc/critical.c#6 delete .. //depot/projects/smpng/sys/powerpc/powerpc/machdep.c#61 integrate .. //depot/projects/smpng/sys/powerpc/powerpc/vm_machdep.c#42 integrate .. //depot/projects/smpng/sys/sparc64/include/critical.h#7 delete .. //depot/projects/smpng/sys/sparc64/include/proc.h#12 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#74 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/mp_machdep.c#24 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/vm_machdep.c#48 integrate .. //depot/projects/smpng/sys/sys/bus.h#22 integrate .. //depot/projects/smpng/sys/sys/errno.h#11 integrate .. //depot/projects/smpng/sys/sys/lock.h#30 integrate .. //depot/projects/smpng/sys/sys/mman.h#10 integrate .. //depot/projects/smpng/sys/sys/mutex.h#54 integrate .. //depot/projects/smpng/sys/sys/shm.h#8 integrate .. //depot/projects/smpng/sys/sys/time.h#18 integrate .. //depot/projects/smpng/sys/ufs/ffs/ffs_extern.h#19 integrate .. //depot/projects/smpng/sys/ufs/ffs/ffs_inode.c#24 integrate .. //depot/projects/smpng/sys/ufs/ffs/ffs_snapshot.c#49 integrate .. //depot/projects/smpng/sys/ufs/ffs/ffs_softdep.c#44 integrate .. //depot/projects/smpng/sys/ufs/ffs/ffs_vfsops.c#71 integrate .. //depot/projects/smpng/sys/vm/vm.h#9 integrate .. //depot/projects/smpng/sys/vm/vm_extern.h#27 integrate .. //depot/projects/smpng/sys/vm/vm_meter.c#25 integrate .. //depot/projects/smpng/sys/vm/vm_mmap.c#53 integrate .. //depot/projects/smpng/sys/vm/vm_object.h#29 integrate .. //depot/projects/smpng/sys/vm/vnode_pager.c#52 integrate Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/machdep.c#80 (text+ko) ==== @@ -88,7 +88,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.234 2005/04/01 10:59:13 des Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.235 2005/04/04 21:53:51 jhb Exp $"); #include "opt_compat.h" #include "opt_ddb.h" @@ -2397,3 +2397,27 @@ pcpu->pc_idlepcb.apcb_ptbr = thread0.td_pcb->pcb_hw.apcb_ptbr; pcpu->pc_current_asngen = 1; } + +void +spinlock_enter(void) +{ + struct thread *td; + + td = curthread; + if (td->td_md.md_spinlock_count == 0) + td->td_md.md_saved_ipl = intr_disable(); + td->td_md.md_spinlock_count++; + critical_enter(); +} + +void +spinlock_exit(void) +{ + struct thread *td; + + td = curthread; + critical_exit(); + td->td_md.md_spinlock_count--; + if (td->td_md.md_spinlock_count == 0) + intr_restore(td->td_md.md_saved_ipl); +} ==== //depot/projects/smpng/sys/alpha/alpha/mp_machdep.c#33 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.55 2004/11/27 06:51:32 das Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.56 2005/04/04 21:53:51 jhb Exp $"); #include "opt_kstack_pages.h" @@ -144,6 +144,10 @@ /* Clear userland thread pointer. */ alpha_pal_wrunique(0); + /* Initialize curthread. */ + KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); + PCPU_SET(curthread, PCPU_GET(idlethread)); + /* * Point interrupt/exception vectors to our own. */ @@ -205,11 +209,24 @@ while (smp_started == 0) ; /* nothing */ + /* ok, now grab sched_lock and enter the scheduler */ + mtx_lock_spin(&sched_lock); + + /* + * Correct spinlock nesting. The idle thread context that we are + * borrowing was created so that it would start out with a single + * spin lock (sched_lock) held in fork_trampoline(). Since we've + * explicitly acquired locks in this function, the nesting count + * is now 2 rather than 1. Since we are nested, calling + * spinlock_exit() will simply adjust the counts without allowing + * spin lock using code to interrupt us. + */ + spinlock_exit(); + KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); + binuptime(PCPU_PTR(switchtime)); PCPU_SET(switchticks, ticks); - /* ok, now grab sched_lock and enter the scheduler */ - mtx_lock_spin(&sched_lock); cpu_throw(NULL, choosethread()); /* doesn't return */ panic("scheduler returned us to %s", __func__); ==== //depot/projects/smpng/sys/alpha/alpha/vm_machdep.c#39 (text+ko) ==== @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/vm_machdep.c,v 1.107 2005/01/14 20:13:04 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/vm_machdep.c,v 1.108 2005/04/04 21:53:51 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -202,6 +202,10 @@ */ td2->td_md.md_kernnest = 1; #endif + + /* Setup to release sched_lock in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_ipl = ALPHA_PSL_IPL_0; } /* @@ -319,6 +323,10 @@ */ td->td_md.md_kernnest = 1; #endif + + /* Setup to release sched_lock in fork_exit(). */ + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_ipl = ALPHA_PSL_IPL_0; } void ==== //depot/projects/smpng/sys/alpha/include/proc.h#9 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/alpha/include/proc.h,v 1.17 2005/01/05 20:05:50 imp Exp $ */ +/* $FreeBSD: src/sys/alpha/include/proc.h,v 1.18 2005/04/04 21:53:51 jhb Exp $ */ /* From: NetBSD: proc.h,v 1.3 1997/04/06 08:47:36 cgd Exp */ /*- @@ -52,7 +52,8 @@ u_int64_t md_hae; /* user HAE register value */ void *osf_sigtramp; /* user-level signal trampoline */ u_int md_kernnest; /* nesting level in the kernel */ - register_t md_savecrit; /* save PSL for critical section */ + register_t md_saved_ipl; /* save IPL for critical section */ + u_int md_spinlock_count; }; #define MDP_UAC_NOPRINT 0x0010 /* Don't print unaligned traps */ ==== //depot/projects/smpng/sys/alpha/osf1/imgact_osf1.c#14 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/osf1/imgact_osf1.c,v 1.22 2005/01/29 23:11:57 sobomax Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/osf1/imgact_osf1.c,v 1.23 2005/04/01 20:00:10 jhb Exp $"); #include <sys/types.h> #include <sys/malloc.h> @@ -189,14 +189,14 @@ /* set up text segment */ if ((error = vm_mmap(&vmspace->vm_map, &taddr, tsize, VM_PROT_READ|VM_PROT_EXECUTE, VM_PROT_ALL, MAP_FIXED|MAP_COPY, - (caddr_t)imgp->vp, ECOFF_TXTOFF(execp)))) { + OBJT_VNODE, imgp->vp, ECOFF_TXTOFF(execp)))) { DPRINTF(("%s(%d): error = %d\n", __FILE__, __LINE__, error)); goto bail; } /* .. data .. */ if ((error = vm_mmap(&vmspace->vm_map, &daddr, dsize, VM_PROT_READ|VM_PROT_EXECUTE|VM_PROT_WRITE, VM_PROT_ALL, - MAP_FIXED|MAP_COPY, (caddr_t)imgp->vp, ECOFF_DATOFF(execp)))) { + MAP_FIXED|MAP_COPY, OBJT_VNODE, imgp->vp, ECOFF_DATOFF(execp)))) { DPRINTF(("%s(%d): error = %d\n", __FILE__, __LINE__, error)); goto bail; } ==== //depot/projects/smpng/sys/alpha/osf1/osf1_misc.c#37 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/osf1/osf1_misc.c,v 1.54 2005/03/31 22:56:14 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/osf1/osf1_misc.c,v 1.55 2005/04/01 20:00:10 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1458,7 +1458,8 @@ if (uap->mask & OSF1_USW_NULLP) { rv = vm_mmap(&(p->p_vmspace->vm_map), &zero, PAGE_SIZE, VM_PROT_READ, VM_PROT_ALL, - MAP_PRIVATE | MAP_FIXED | MAP_ANON, NULL, 0); + MAP_PRIVATE | MAP_FIXED | MAP_ANON, OBJT_DEFAULT, + NULL, 0); if (!rv) return(KERN_SUCCESS); else { ==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#38 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.632 2005/03/05 18:57:30 des Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.633 2005/04/04 21:53:52 jhb Exp $"); #include "opt_atalk.h" #include "opt_atpic.h" @@ -1302,6 +1302,30 @@ pcpu->pc_acpi_id = 0xffffffff; } +void +spinlock_enter(void) +{ + struct thread *td; + + td = curthread; + if (td->td_md.md_spinlock_count == 0) + td->td_md.md_saved_flags = intr_disable(); + td->td_md.md_spinlock_count++; + critical_enter(); +} + +void +spinlock_exit(void) +{ + struct thread *td; + + td = curthread; + critical_exit(); + td->td_md.md_spinlock_count--; + if (td->td_md.md_spinlock_count == 0) + intr_restore(td->td_md.md_saved_flags); +} + /* * Construct a PCB from a trapframe. This is called from kdb_trap() where * we want to start a backtrace from the function that caused us to enter ==== //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c#18 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.250 2005/02/28 23:37:35 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.251 2005/04/04 21:53:52 jhb Exp $"); #include "opt_cpu.h" #include "opt_kstack_pages.h" @@ -452,6 +452,10 @@ panic("cpuid mismatch! boom!!"); } + /* Initialize curthread. */ + KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); + PCPU_SET(curthread, PCPU_GET(idlethread)); + mtx_lock_spin(&ap_boot_mtx); /* Init local apic for irq's */ @@ -490,6 +494,18 @@ /* ok, now grab sched_lock and enter the scheduler */ mtx_lock_spin(&sched_lock); + /* + * Correct spinlock nesting. The idle thread context that we are + * borrowing was created so that it would start out with a single + * spin lock (sched_lock) held in fork_trampoline(). Since we've + * explicitly acquired locks in this function, the nesting count + * is now 2 rather than 1. Since we are nested, calling + * spinlock_exit() will simply adjust the counts without allowing + * spin lock using code to interrupt us. + */ + spinlock_exit(); + KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); + binuptime(PCPU_PTR(switchtime)); PCPU_SET(switchticks, ticks); ==== //depot/projects/smpng/sys/amd64/amd64/vm_machdep.c#25 (text+ko) ==== @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.244 2005/01/21 05:57:45 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.245 2005/04/04 21:53:52 jhb Exp $"); #include "opt_isa.h" #include "opt_cpu.h" @@ -163,6 +163,10 @@ * pcb2->pcb_[fg]sbase: cloned above */ + /* Setup to release sched_lock in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; + /* * Now, cpu_switch() can schedule the new process. * pcb_rsp is loaded pointing to the cpu_switch() stack frame @@ -294,6 +298,10 @@ * pcb2->pcb_onfault: cloned above (always NULL here?). * pcb2->pcb_[fg]sbase: cloned above */ + + /* Setup to release sched_lock in fork_exit(). */ + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; } /* ==== //depot/projects/smpng/sys/amd64/include/floatingpoint.h#2 (text+ko) ==== @@ -31,12 +31,13 @@ * SUCH DAMAGE. * * from: @(#) floatingpoint.h 1.0 (Berkeley) 9/23/93 - * $FreeBSD: src/sys/amd64/include/floatingpoint.h,v 1.13 2003/01/19 06:01:33 marcel Exp $ + * $FreeBSD: src/sys/amd64/include/floatingpoint.h,v 1.14 2005/04/02 17:31:42 netchild Exp $ */ #ifndef _FLOATINGPOINT_H_ #define _FLOATINGPOINT_H_ +#include <sys/cdefs.h> #include <machine/ieeefp.h> #endif /* !_FLOATINGPOINT_H_ */ ==== //depot/projects/smpng/sys/amd64/include/proc.h#5 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 - * $FreeBSD: src/sys/amd64/include/proc.h,v 1.23 2005/01/05 20:17:20 imp Exp $ + * $FreeBSD: src/sys/amd64/include/proc.h,v 1.24 2005/04/04 21:53:52 jhb Exp $ */ #ifndef _MACHINE_PROC_H_ @@ -37,7 +37,8 @@ * Machine-dependent part of the proc structure for AMD64. */ struct mdthread { - register_t md_savecrit; + int md_spinlock_count; /* (k) */ + register_t md_saved_flags; /* (k) */ }; struct mdproc { ==== //depot/projects/smpng/sys/amd64/linux32/linux32_machdep.c#7 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_machdep.c,v 1.8 2005/03/31 22:57:21 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_machdep.c,v 1.9 2005/04/05 15:28:06 jhb Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -590,7 +590,7 @@ printf(ARGS(mmap, "%p, %d, %d, 0x%08x, %d, %d"), (void *)(intptr_t)linux_args.addr, linux_args.len, linux_args.prot, linux_args.flags, linux_args.fd, - linux_args.pos); + linux_args.pgoff); #endif if ((linux_args.pgoff % PAGE_SIZE) != 0) return (EINVAL); ==== //depot/projects/smpng/sys/arm/arm/machdep.c#12 (text+ko) ==== @@ -44,7 +44,7 @@ #include "opt_compat.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/machdep.c,v 1.15 2005/03/01 20:12:52 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/machdep.c,v 1.16 2005/04/04 21:53:52 jhb Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -390,6 +390,30 @@ { } +void +spinlock_enter(void) +{ + struct thread *td; + + td = curthread; + if (td->td_md.md_spinlock_count == 0) + td->td_md.md_saved_cspr = disable_interrupts(I32_bit | F32_bit); + td->td_md.md_spinlock_count++; + critical_enter(); +} + +void +spinlock_exit(void) +{ + struct thread *td; + + td = curthread; + critical_exit(); + td->td_md.md_spinlock_count--; + if (td->td_md.md_spinlock_count == 0) + restore_interrupts(td->td_md.md_saved_cspr); +} + /* * Clear registers on exec */ ==== //depot/projects/smpng/sys/arm/arm/vm_machdep.c#10 (text+ko) ==== @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/vm_machdep.c,v 1.10 2005/01/05 21:58:47 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/vm_machdep.c,v 1.11 2005/04/04 21:53:52 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -129,6 +129,10 @@ tf->tf_r0 = 0; tf->tf_r1 = 0; pcb2->un_32.pcb32_sp = (u_int)sf; + + /* Setup to release sched_lock in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_cspr = 0; } void @@ -263,6 +267,10 @@ td->td_pcb->un_32.pcb32_sp = (u_int)sf; td->td_pcb->un_32.pcb32_und_sp = td->td_kstack + td->td_kstack_pages * PAGE_SIZE + USPACE_UNDEF_STACK_TOP; + + /* Setup to release sched_lock in fork_exit(). */ + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_cspr = 0; } /* ==== //depot/projects/smpng/sys/arm/include/proc.h#5 (text+ko) ==== @@ -32,7 +32,7 @@ * * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 * from: FreeBSD: src/sys/i386/include/proc.h,v 1.11 2001/06/29 - * $FreeBSD: src/sys/arm/include/proc.h,v 1.4 2005/02/26 00:02:14 cognet Exp $ + * $FreeBSD: src/sys/arm/include/proc.h,v 1.5 2005/04/04 21:53:52 jhb Exp $ */ #ifndef _MACHINE_PROC_H_ @@ -46,7 +46,8 @@ }; struct mdthread { - register_t md_savecrit; + int md_spinlock_count; /* (k) */ + register_t md_saved_cspr; /* (k) */ int md_ptrace_instr; int md_ptrace_addr; void *md_tp; ==== //depot/projects/smpng/sys/boot/pc98/boot2/Makefile#14 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/boot/pc98/boot2/Makefile,v 1.21 2004/12/21 09:59:44 ru Exp $ +# $FreeBSD: src/sys/boot/pc98/boot2/Makefile,v 1.22 2005/04/03 04:58:15 imp Exp $ # PROG= boot @@ -92,15 +92,23 @@ boot1 boot2 ${DESTDIR}${BINDIR} # If it's not there, don't consider it a target -.if exists(${.CURDIR}/../../../i386/include) +.if exists(${.CURDIR}/../../../pc98/include) beforedepend ${OBJS}: machine machine: - ln -sf ${.CURDIR}/../../../i386/include machine + ln -sf ${.CURDIR}/../../../pc98/include machine + +.endif + +.if exists(${.CURDIR}/../../../i386/include) +beforedepend ${OBJS}: i386 + +i386: + ln -sf ${.CURDIR}/../../../i386/include i386 .endif -CLEANFILES+= machine +CLEANFILES+= machine i386 .include "${.CURDIR}/../../../conf/kern.mk" .include <bsd.prog.mk> ==== //depot/projects/smpng/sys/compat/linux/linux_misc.c#55 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.166 2005/03/07 00:18:06 sobomax Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.167 2005/04/01 20:00:10 jhb Exp $"); #include "opt_mac.h" @@ -333,7 +333,7 @@ /* Pull in executable header into kernel_map */ error = vm_mmap(kernel_map, (vm_offset_t *)&a_out, PAGE_SIZE, - VM_PROT_READ, VM_PROT_READ, 0, (caddr_t)vp, 0); + VM_PROT_READ, VM_PROT_READ, 0, OBJT_VNODE, vp, 0); /* * Lock no longer needed */ @@ -422,7 +422,7 @@ /* map file into kernel_map */ error = vm_mmap(kernel_map, &buffer, round_page(a_out->a_text + a_out->a_data + file_offset), - VM_PROT_READ, VM_PROT_READ, 0, (caddr_t)vp, + VM_PROT_READ, VM_PROT_READ, 0, OBJT_VNODE, vp, trunc_page(file_offset)); if (error) goto cleanup; @@ -453,7 +453,7 @@ */ error = vm_mmap(&td->td_proc->p_vmspace->vm_map, &vmaddr, a_out->a_text + a_out->a_data, VM_PROT_ALL, VM_PROT_ALL, - MAP_PRIVATE | MAP_FIXED, (caddr_t)vp, file_offset); + MAP_PRIVATE | MAP_FIXED, OBJT_VNODE, vp, file_offset); if (error) goto cleanup; } ==== //depot/projects/smpng/sys/compat/svr4/imgact_svr4.c#13 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/svr4/imgact_svr4.c,v 1.24 2005/01/29 23:11:58 sobomax Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/svr4/imgact_svr4.c,v 1.25 2005/04/01 20:00:10 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -145,7 +145,7 @@ error = vm_mmap(kernel_map, &buffer, round_page(a_out->a_text + a_out->a_data + file_offset), VM_PROT_READ, VM_PROT_READ, 0, - (caddr_t) imgp->vp, trunc_page(file_offset)); + OBJT_VNODE, imgp->vp, trunc_page(file_offset)); if (error) goto fail; @@ -182,7 +182,7 @@ VM_PROT_READ | VM_PROT_EXECUTE, VM_PROT_ALL, MAP_PRIVATE | MAP_FIXED, - (caddr_t)imgp->vp, file_offset); + OBJT_VNODE, imgp->vp, file_offset); if (error) goto fail; ==== //depot/projects/smpng/sys/conf/Makefile.alpha#23 (text+ko) ==== @@ -1,7 +1,7 @@ # Makefile.alpha -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.alpha 7.1 5/10/91 -# $FreeBSD: src/sys/conf/Makefile.alpha,v 1.132 2005/02/10 21:15:31 jmg Exp $ +# $FreeBSD: src/sys/conf/Makefile.alpha,v 1.133 2005/04/01 22:56:10 imp Exp $ # # Makefile for FreeBSD # @@ -17,7 +17,7 @@ # # Which version of config(8) is required. -%VERSREQ= 600001 +%VERSREQ= 600002 .if !defined(S) .if exists(./@/.) ==== //depot/projects/smpng/sys/conf/Makefile.amd64#9 (text+ko) ==== @@ -2,7 +2,7 @@ # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 # from FreeBSD: src/sys/conf/Makefile.i386,v 1.255 2002/02/20 23:35:49 -# $FreeBSD: src/sys/conf/Makefile.amd64,v 1.13 2005/02/10 21:15:31 jmg Exp $ +# $FreeBSD: src/sys/conf/Makefile.amd64,v 1.14 2005/04/01 22:56:10 imp Exp $ # # Makefile for FreeBSD # @@ -18,7 +18,7 @@ # # Which version of config(8) is required. -%VERSREQ= 600001 +%VERSREQ= 600002 STD8X16FONT?= iso ==== //depot/projects/smpng/sys/conf/Makefile.arm#7 (text+ko) ==== @@ -1,7 +1,7 @@ # Makefile.arm -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $FreeBSD: src/sys/conf/Makefile.arm,v 1.6 2005/02/10 21:15:31 jmg Exp $ +# $FreeBSD: src/sys/conf/Makefile.arm,v 1.7 2005/04/01 22:56:10 imp Exp $ # # Makefile for FreeBSD # @@ -17,7 +17,7 @@ # # Which version of config(8) is required. -%VERSREQ= 600001 +%VERSREQ= 600002 # Temporary stuff while we're still embryonic NO_MODULES= ==== //depot/projects/smpng/sys/conf/Makefile.i386#21 (text+ko) ==== @@ -1,7 +1,7 @@ # Makefile.i386 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $FreeBSD: src/sys/conf/Makefile.i386,v 1.262 2005/02/10 21:15:31 jmg Exp $ +# $FreeBSD: src/sys/conf/Makefile.i386,v 1.263 2005/04/01 22:56:10 imp Exp $ # # Makefile for FreeBSD # @@ -17,7 +17,7 @@ # # Which version of config(8) is required. -%VERSREQ= 600001 +%VERSREQ= 600002 STD8X16FONT?= iso ==== //depot/projects/smpng/sys/conf/Makefile.ia64#28 (text+ko) ==== @@ -1,7 +1,7 @@ # Makefile.ia64 -- with config changes. # Copyright 1990 W. Jolitz # from: src/sys/conf/Makefile.alpha,v 1.76 -# $FreeBSD: src/sys/conf/Makefile.ia64,v 1.59 2005/02/10 21:15:31 jmg Exp $ +# $FreeBSD: src/sys/conf/Makefile.ia64,v 1.60 2005/04/01 22:56:10 imp Exp $ # # Makefile for FreeBSD # @@ -19,7 +19,7 @@ GCC3= you bet # Which version of config(8) is required. -%VERSREQ= 600001 +%VERSREQ= 600002 STD8X16FONT?= iso ==== //depot/projects/smpng/sys/conf/Makefile.pc98#20 (text+ko) ==== @@ -3,7 +3,7 @@ # Makefile.i386 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $FreeBSD: src/sys/conf/Makefile.pc98,v 1.163 2005/02/10 21:15:31 jmg Exp $ +# $FreeBSD: src/sys/conf/Makefile.pc98,v 1.165 2005/04/03 04:33:42 imp Exp $ # # Makefile for FreeBSD # @@ -19,7 +19,7 @@ # # Which version of config(8) is required. -%VERSREQ= 600001 +%VERSREQ= 600002 .if !defined(S) .if exists(./@/.) @@ -30,7 +30,6 @@ .endif .include "$S/conf/kern.pre.mk" -EXTRA_KERNELDEP=rm -f ./machine ; ln -s $S/$M/include ./machine MKMODULESENV+= MACHINE=pc98 %BEFORE_DEPEND ==== //depot/projects/smpng/sys/conf/Makefile.powerpc#28 (text+ko) ==== @@ -1,7 +1,7 @@ # Makefile.powerpc -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $FreeBSD: src/sys/conf/Makefile.powerpc,v 1.274 2005/02/10 21:15:31 jmg Exp $ +# $FreeBSD: src/sys/conf/Makefile.powerpc,v 1.275 2005/04/01 22:56:10 imp Exp $ # # Makefile for FreeBSD # @@ -17,7 +17,7 @@ # # Which version of config(8) is required. -%VERSREQ= 600001 +%VERSREQ= 600002 STD8X16FONT?= iso ==== //depot/projects/smpng/sys/conf/Makefile.sparc64#24 (text+ko) ==== @@ -1,7 +1,7 @@ # Makefile.sparc64 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $FreeBSD: src/sys/conf/Makefile.sparc64,v 1.30 2005/02/10 21:15:31 jmg Exp $ +# $FreeBSD: src/sys/conf/Makefile.sparc64,v 1.31 2005/04/01 22:56:10 imp Exp $ # # Makefile for FreeBSD # @@ -17,7 +17,7 @@ # # Which version of config(8) is required. -%VERSREQ= 600001 >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504051833.j35IXn8M063515>