MP Implmentation 3/4: MAJOR progress on SMP, full userland MP is now working!
authorMatthew Dillon <dillon@dragonflybsd.org>
Thu, 10 Jul 2003 04:47:55 +0000 (04:47 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Thu, 10 Jul 2003 04:47:55 +0000 (04:47 +0000)
commita2a5ad0d5ad9635a3131e958583a2735063e926c
treeb0061a70df78fa3434c623a0d20515c05a8ba853
parentf5865223311d1fa02f0659bf197707ae1684a501
MP Implmentation 3/4: MAJOR progress on SMP, full userland MP is now working!
A number of issues relating to MP lock operation have been fixed, primarily
that we have to read %cr2 before get_mplock() since get_mplock() may switch
away.  Idlethreads can now safely HLT without any performance detriment.
The userland scheduler has been almost completely rewritten and is now
using an extremely flexible abstraction with a lot of room to grow.  pgeflag
has been removed from mapdev (without per-page invalidation it isn't safe
to use PG_G even on UP).  Necessary locked bus cycles have been added for
the pmap->pm_active field in swtch.s.  CR3 has been unoptimized for the
moment (see comment in swtch.s).  Since the switch code runs without the
MP lock we have to adjust pm_active PRIOR to loading %cr3.
Additional sanity checks have been added to the code (see PARANOID_INVLTLB
and ONLY_ONE_USER_CPU in the code), plus many more in kern_switch.c.
A passive release mechanism has been implemented to optimize P_CURPROC/lwkt
priority shifting when going from user->kernel and kernel->user.
Note: preemptive interrupts don't care due to the way preemption works so
no additional complexity there.  non-locking atomic functions to protect
only against local interrupts have been added.  astpending now uses
non-locking atomic functions to set and clear bits.  private_tss has been
moved to a per-cpu variable.   The LWKT thread module has been considerably
enhanced and cleaned up, including some fixes to handle MPLOCKED vs td_mpcount
races (so eventually we can do MP locking without a pushfl/cli/popfl combo).
stopevent() needs critical section protection, maybe.
46 files changed:
sys/cpu/i386/include/atomic.h
sys/cpu/i386/include/cpu.h
sys/ddb/db_ps.c
sys/i386/i386/genassym.c
sys/i386/i386/globals.s
sys/i386/i386/machdep.c
sys/i386/i386/mp_machdep.c
sys/i386/i386/mplock.s
sys/i386/i386/pmap.c
sys/i386/i386/swtch.s
sys/i386/i386/trap.c
sys/i386/i386/vm_machdep.c
sys/i386/include/atomic.h
sys/i386/include/cpu.h
sys/i386/include/globaldata.h
sys/i386/include/thread.h
sys/i386/isa/ipl.s
sys/i386/isa/npx.c
sys/kern/init_main.c
sys/kern/kern_clock.c
sys/kern/kern_exit.c
sys/kern/kern_fork.c
sys/kern/kern_malloc.c
sys/kern/kern_switch.c
sys/kern/kern_synch.c
sys/kern/lwkt_thread.c
sys/kern/sys_process.c
sys/kern/uipc_mbuf.c
sys/platform/pc32/i386/genassym.c
sys/platform/pc32/i386/globals.s
sys/platform/pc32/i386/machdep.c
sys/platform/pc32/i386/mp_machdep.c
sys/platform/pc32/i386/mplock.s
sys/platform/pc32/i386/pmap.c
sys/platform/pc32/i386/swtch.s
sys/platform/pc32/i386/trap.c
sys/platform/pc32/i386/vm_machdep.c
sys/platform/pc32/include/globaldata.h
sys/platform/pc32/include/thread.h
sys/platform/pc32/isa/ipl.s
sys/platform/pc32/isa/npx.c
sys/platform/vkernel/i386/genassym.c
sys/sys/globaldata.h
sys/sys/proc.h
sys/sys/thread.h
sys/vm/vm_glue.c