freebsd-nq/sys/kern
David Xu 0dbb100b9b Move UPCALL related data structure out of kse, introduce a new
data structure called kse_upcall to manage UPCALL. All KSE binding
and loaning code are gone.

A thread owns an upcall can collect all completed syscall contexts in
its ksegrp, turn itself into UPCALL mode, and takes those contexts back
to userland. Any thread without upcall structure has to export their
contexts and exit at user boundary.

Any thread running in user mode owns an upcall structure, when it enters
kernel, if the kse mailbox's current thread pointer is not NULL, then
when the thread is blocked in kernel, a new UPCALL thread is created and
the upcall structure is transfered to the new UPCALL thread. if the kse
mailbox's current thread pointer is NULL, then when a thread is blocked
in kernel, no UPCALL thread will be created.

Each upcall always has an owner thread. Userland can remove an upcall by
calling kse_exit, when all upcalls in ksegrp are removed, the group is
atomatically shutdown. An upcall owner thread also exits when process is
in exiting state. when an owner thread exits, the upcall it owns is also
removed.

KSE is a pure scheduler entity. it represents a virtual cpu. when a thread
is running, it always has a KSE associated with it. scheduler is free to
assign a KSE to thread according thread priority, if thread priority is changed,
KSE can be moved from one thread to another.

When a ksegrp is created, there is always N KSEs created in the group. the
N is the number of physical cpu in the current system. This makes it is
possible that even an userland UTS is single CPU safe, threads in kernel still
can execute on different cpu in parallel. Userland calls kse_create to add more
upcall structures into ksegrp to increase concurrent in userland itself, kernel
is not restricted by number of upcalls userland provides.

The code hasn't been tested under SMP by author due to lack of hardware.

Reviewed by: julian
2003-01-26 11:41:35 +00:00
..
bus_if.m Add two interfaces to allow for busses to report the pnpinfo for 2002-10-07 05:06:38 +00:00
clock_if.m
device_if.m
genassym.sh
imgact_aout.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
imgact_elf32.c Improve the way that an elf image activator for an alternate word size is 2003-01-04 22:07:48 +00:00
imgact_elf64.c Improve the way that an elf image activator for an alternate word size is 2003-01-04 22:07:48 +00:00
imgact_elf.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
imgact_gzip.c Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup, 2003-01-01 18:49:04 +00:00
imgact_shell.c Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup, 2003-01-01 18:49:04 +00:00
inflate.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
init_main.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
init_sysent.c Some KSE syscalls are MPSAFE. 2003-01-08 04:57:53 +00:00
kern_acct.c unwrap lines made short enough by SCARGS removal 2002-12-14 08:18:06 +00:00
kern_acl.c Bow to the whining masses and change a union back into void *. Retain 2003-01-13 00:33:17 +00:00
kern_alq.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_clock.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
kern_condvar.c - Call sched_sleep() instead of rolling our own in cv_waitq_add(). 2003-01-26 04:00:39 +00:00
kern_conf.c disk_dev_synth() is a NO_GEOM hack. 2003-01-20 11:29:07 +00:00
kern_context.c Add getcontext, setcontext, and swapcontext as system calls. 2002-11-16 06:35:53 +00:00
kern_descrip.c Add missing SMP file locks around read-modify-write operations on 2003-01-21 20:20:48 +00:00
kern_environment.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_event.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_exec.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
kern_exit.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
kern_fork.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
kern_idle.c - Create a new scheduler api that is defined in sys/sched.h 2002-10-12 05:32:24 +00:00
kern_intr.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_jail.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_kse.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
kern_kthread.c Some kernel threads try to do significant work, and the default KSTACK_PAGES 2002-10-02 07:44:29 +00:00
kern_ktr.c - Export the alq daemon thread pointer. 2002-09-26 07:38:56 +00:00
kern_ktrace.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_linker.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_lock.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
kern_lockf.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_mac.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_malloc.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_mib.c - Provide backwards compatibility for kern.fallback_elf_brand. 2003-01-05 03:48:14 +00:00
kern_module.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_mtxpool.c
kern_mutex.c There's absolutely no need for a struct-within-a-struct, so move the 2003-01-21 20:33:27 +00:00
kern_ntptime.c Explicitly have the timecounter init happen after the cpu_initclocks is 2003-01-06 01:01:08 +00:00
kern_physio.c Close the remaining user address mapping races for physical 2003-01-20 17:46:48 +00:00
kern_poll.c
kern_proc.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_prot.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_resource.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
kern_sema.c
kern_shutdown.c Introduce the 2003-01-04 20:54:58 +00:00
kern_sig.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
kern_subr.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_switch.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
kern_sx.c
kern_synch.c Add code to ddb to allow backtracing an arbitrary thread. 2002-12-28 01:23:07 +00:00
kern_syscalls.c
kern_sysctl.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
kern_tc.c Add sysctl kern.timecounter.nsetclock which indicates the number of 2003-01-25 07:51:09 +00:00
kern_thread.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
kern_time.c Remove unnecessary locking of Giant around nanotime() in clock_gettime(). 2003-01-19 11:28:22 +00:00
kern_timeout.c
kern_uuid.c SMP locking for ifnet list. 2002-12-22 05:35:03 +00:00
kern_xxx.c
ksched.c headers should not really include "opt_foo.h" (in this case opt_posix.h). 2002-11-15 22:55:06 +00:00
link_elf_obj.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
link_elf.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
linker_if.m
Make.tags.inc
Makefile
makesyscalls.sh The syscall names are string constants, so make them consts. 2002-10-29 15:47:06 +00:00
md4c.c
md5c.c We have memset() and memcpy() in the kernel now, so we don't need to 2002-10-20 22:33:42 +00:00
p1003_1b.c Use copyout to access user memory. 2003-01-07 20:10:04 +00:00
posix4_mib.c Rework the sysconf(3) interaction with aio: 2002-11-17 04:15:34 +00:00
sched_4bsd.c - Unbreak world. I did not notice that libkvm was still used in some places 2003-01-13 03:42:41 +00:00
sched_ule.c - Add the ule scheduler. This is intended to be a general purpose process 2003-01-26 05:23:15 +00:00
subr_acl_posix1e.c Bow to the whining masses and change a union back into void *. Retain 2003-01-13 00:33:17 +00:00
subr_autoconf.c
subr_blist.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
subr_bus.c Fix comment about what we do when there are no listeners. 2003-01-19 00:34:17 +00:00
subr_clist.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
subr_clock.c
subr_devstat.c Use strlcpy() instead of strncpy() to copy NUL terminated strings 2002-10-17 20:03:38 +00:00
subr_disk.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
subr_disklabel.c #ifdef NO_GEOM all of this file. 2003-01-21 10:40:46 +00:00
subr_diskmbr.c #ifdef NO_GEOM these files entirely. When NO_GEOM is removed as an 2003-01-19 11:51:35 +00:00
subr_diskslice.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
subr_eventhandler.c
subr_hints.c
subr_kobj.c
subr_log.c Make the msg_size, msg_bufx and msg_bufr memebers of struct msgbuf 2002-11-14 16:11:12 +00:00
subr_mbuf.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
subr_mchain.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
subr_module.c
subr_param.c
subr_pcpu.c
subr_power.c
subr_prf.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
subr_prof.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
subr_rman.c Correct an off-by-one in the boundary check. Otherwise, resource 2003-01-21 17:02:21 +00:00
subr_rtc.c
subr_sbuf.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
subr_scanf.c Fix mis-indentation. 2002-10-02 09:09:25 +00:00
subr_smp.c Add a tunable kern.smp.disabled for disabling explicitly smp on an smp 2002-12-28 23:21:13 +00:00
subr_taskqueue.c
subr_trap.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
subr_turnstile.c There's absolutely no need for a struct-within-a-struct, so move the 2003-01-21 20:33:27 +00:00
subr_witness.c Move UPCALL related data structure out of kse, introduce a new 2003-01-26 11:41:35 +00:00
subr_xxx.c
sys_generic.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
sys_pipe.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
sys_process.c Add a missing PROC_UNLOCK in ptrace() for the PT_IO case. 2002-10-16 16:28:33 +00:00
sys_socket.c Bow to the whining masses and change a union back into void *. Retain 2003-01-13 00:33:17 +00:00
syscalls.c Some KSE syscalls are MPSAFE. 2003-01-08 04:57:53 +00:00
syscalls.master Bring shm functions closer the the opengroup standards. 2003-01-25 21:33:05 +00:00
sysv_ipc.c It is possible for an active aio to prevent shared memory from being 2003-01-13 23:04:32 +00:00
sysv_msg.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
sysv_sem.c Bring semop() closer the the opengroup standards. 2003-01-25 21:27:37 +00:00
sysv_shm.c Bring shm functions closer the the opengroup standards. 2003-01-25 21:33:05 +00:00
tty_compat.c
tty_conf.c
tty_cons.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
tty_pty.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
tty_subr.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
tty_tty.c Originally when DEVFS was added, a global variable "devfs_present" 2003-01-19 11:03:07 +00:00
tty.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
uipc_accf.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
uipc_cow.c Change iov_base's type from char *' to the standard void *'. All 2002-10-11 14:58:34 +00:00
uipc_domain.c
uipc_jumbo.c
uipc_mbuf2.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
uipc_mbuf.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
uipc_proto.c
uipc_sem.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
uipc_sockbuf.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
uipc_socket2.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
uipc_socket.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
uipc_syscalls.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
uipc_usrreq.c Remove extraneous FILEDESC_LOCKs around atomic reads. 2003-01-24 22:49:52 +00:00
vfs_acl.c Bow to the whining masses and change a union back into void *. Retain 2003-01-13 00:33:17 +00:00
vfs_aio.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_bio.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_cache.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_cluster.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_default.c Temporarily introduce a new VOP_SPECSTRATEGY operation while I try 2003-01-04 22:10:36 +00:00
vfs_export.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_extattr.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_init.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_lookup.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_mount.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_subr.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_syscalls.c Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. 2003-01-21 08:56:16 +00:00
vfs_vnops.c Bow to the whining masses and change a union back into void *. Retain 2003-01-13 00:33:17 +00:00
vnode_if.src Temporarily introduce a new VOP_SPECSTRATEGY operation while I try 2003-01-04 22:10:36 +00:00