summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_kthread.c
Commit message (Collapse)AuthorAgeFilesLines
...
* fork1() already sets PS_INMEM, so don't set it again. This lets us pushjhb2003-04-171-3/+2
| | | | sched_lock down slightly so that it isn't needed in the RFSTOPPED case.
* Some kernel threads try to do significant work, and the default KSTACK_PAGESscottl2002-10-021-3/+3
| | | | | | | | | | | | | doesn't give them enough stack to do much before blowing away the pcb. This adds MI and MD code to allow the allocation of an alternate kstack who's size can be speficied when calling kthread_create. Passing the value 0 prevents the alternate kstack from being created. Note that the ia64 MD code is missing for now, and PowerPC was only partially written due to the pmap.c being incomplete there. Though this patch does not modify anything to make use of the alternate kstack, acpi and usb are good candidates. Reviewed by: jake, peter, jhb
* Back our kernel support for reliable signal queues.jmallett2002-10-011-9/+8
| | | | Requested by: rwatson, phk, and many others
* First half of implementation of ksiginfo, signal queues, and such. Thisjmallett2002-09-301-8/+9
| | | | | | | | | | | | | | | | | | | | | | gets signals operating based on a TailQ, and is good enough to run X11, GNOME, and do job control. There are some intricate parts which could be more refined to match the sigset_t versions, but those require further evaluation of directions in which our signal system can expand and contract to fit our needs. After this has been in the tree for a while, I will make in kernel API changes, most notably to trapsignal(9) and sendsig(9), to use ksiginfo more robustly, such that we can actually pass information with our (queued) signals to the userland. That will also result in using a struct ksiginfo pointer, rather than a signal number, in a lot of kern_sig.c, to refer to an individual pending signal queue member, but right now there is no defined behaviour for such. CODAFS is unfinished in this regard because the logic is unclear in some places. Sponsored by: New Gold Technology Reviewed by: bde, tjr, jake [an older version, logic similar]
* Completely redo thread states.julian2002-09-111-2/+5
| | | | Reviewed by: davidxu@freebsd.org
* Part 1 of KSE-IIIjulian2002-06-291-2/+1
| | | | | | | | | | | | | The ability to schedule multiple threads per process (one one cpu) by making ALL system calls optionally asynchronous. to come: ia64 and power-pc patches, patches for gdb, test program (in tools) Reviewed by: Almost everyone who counts (at various times, peter, jhb, matt, alfred, mini, bernd, and a cast of thousands) NOTE: this is still Beta code, and contains lots of debugging stuff. expect slight instability in signals..
* Fix a couple of style bugs introduced (or touched by) previous commit.peter2002-02-071-1/+2
|
* Pre-KSE/M3 commit.julian2002-02-071-3/+3
| | | | | | | | | | this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
* Use a different mechanism to get the vnlru process to wake up and noticepeter2001-12-191-0/+1
| | | | | | the shutdown request at reboot/halt time. Disable the printf 'vnlru process getting nowhere, pausing...' and instead export the count to the debug.vnlru_nowhere sysctl.
* Commit the better version that I had a while ago. This has only onepeter2001-11-121-2/+5
| | | | reference to curthread. (#define curproc (curthread->td_proc)).
* When curproc is used repeatedly store curproc into a localdillon2001-11-121-3/+4
| | | | variable to reduce generated code. This is a test case.
* KSE Milestone 2julian2001-09-121-4/+4
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Don't use kp->arg0 as a format string, grr.kris2001-07-191-1/+1
| | | | MFC after: 1 week
* Convert the allproc and proctree locks from lockmgr locks to sx locks.jhb2001-03-281-3/+5
|
* - Use _PHOLD and move it before a PROC_UNLOCK to reduce the number ofjhb2001-03-071-7/+18
| | | | | | | | | | mutex operations in kthread_create(). - Lock a kthread's proc before changing its parent via proc_reparent(). - Test P_KTHREAD not P_SYSTEM in kthread_suspend() and kthread_resume(). P_SYSTEM just means that the process shouldn't be swapped and is used for vinum's daemon for example. - Lock all the signal state used for suspending and resuming kthreads with the proc lock.
* Change and clean the mutex lock interface.bmilekic2001-02-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
* - Catch up to proc flag changes.jhb2001-01-241-3/+6
| | | | - Set the new P_KTHREAD flag for kthreads during kthread_create.
* Protect proc.p_pptr and proc.p_children/p_sibling with thejake2000-12-231-0/+4
| | | | | | | | proctree_lock. linprocfs not locked pending response from informal maintainer. Reviewed by: jhb, -smp@
* Stick the kthread API in a kthread_* namespace, and the specialized kprocjhb2000-12-151-5/+5
| | | | | | functions in a kproc_* namespace. Reviewed by: -arch
* Pass RFSTOPPED to fork1() in kthread_create() to avoid a race conditionjhb2000-12-061-1/+9
| | | | | | | | | | where fork1() could put the process on the run queue where it could be snatched up by another CPU before kthread_create() had set the proper fork handler. Instead, we put the new kthread on the runqueue after its fork handler has been sent. Noticed by: jake Looked over by: peter
* Reparent a kernel thread to init during kthread_exit() so that the zombiejhb2000-10-191-0/+1
| | | | can be reaped.
* Major update to the way synchronization is done in the kernel. Highlightsjasone2000-09-071-4/+13
| | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
* Clean up some low level bootstrap code:peter2000-08-111-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - stop using the evil 'struct trapframe' argument for mi_startup() (formerly main()). There are much better ways of doing it. - do not use prepare_usermode() - setregs() in execve() will do it all for us as long as the p_md.md_regs pointer is set. (which is now done in machdep.c rather than init_main.c. The Alpha port did it this way all along and is much cleaner). - collect all the magic %cr0 etc register settings into one place and have the AP's call that instead of using magic numbers (!!) that keep changing over and over again. - Make it safe to call kthread_create() earlier, including during the device probe sequence. It doesn't need the callback mechanism that NetBSD's version uses. - kthreads created this way are root-less as they exist before the root filesystem is mounted. init(1) is set up so that it aquires the root pointers prior to running. If other kthreads want filesystem acccess we can make this code more generic. - set all threads start times once we have decided what time it is. - init uses a trampoline rather than the evil prepare_usermode() hack. - kern_descrip.c has a couple of tweaks to deal with forking when there is no rootdir or cwd etc. - adjust the early SYSINIT() sequence so that a few prereqisites are in place. eg: make sure the run queue is initialized before doing forks. With this, the USB code can easily create a kthread to do the device tree discovery. (I have tested it, it works nicely). There are still some open issues before this is truely useful. - tsleep() does not like working before the clock is running. It sort-of tries to spin wait, but it can do more useful things now. - stopping a kthread in kld code at unload time is "interesting" but we have a solution for that. The Alpha code needs no changes for this. It already uses pretty much the same strategies, but a little cleaner.
* Panic if proc0 hasn't been created and we try to call kthread_create.imp2000-01-101-0/+5
| | | | | | | This prevents a more mysterious crash later. XXX The long term solution is defer creation of these things until XXX proc0 lives
* Introduce a mechanism to suspend/resume system processes. Suspend syncerluoqi2000-01-071-0/+40
| | | | and bufdaemon prior to disk sync during system shutdown.
* Add a per-signal flag to mark handlers registered with osigaction, so weluoqi1999-10-111-1/+2
| | | | | | | | | | | | | | | can provide the correct context to each signal handler. Fix broken sigsuspend(): don't use p_oldsigmask as a flag, use SAS_OLDMASK as we did before the linuxthreads support merge (submitted by bde). Move ps_sigstk from to p_sigacts to the main proc structure since signal stack should not be shared among threads. Move SAS_OLDMASK and SAS_ALTSTACK flags from sigacts::ps_flags to proc::p_flag. Move PS_NOCLDSTOP and PS_NOCLDWAIT flags from proc::p_flag to procsig::ps_flag. Reviewed by: marcel, jdp, bde
* Trim unused options (or #ifdef for undoc options).peter1999-10-111-2/+0
| | | | Submitted by: phk
* Slight reorganization of kernel thread/process creation. Instead of usingpeter1999-07-011-0/+100
SYSINIT_KT() etc (which is a static, compile-time procedure), use a NetBSD-style kthread_create() interface. kproc_start is still available as a SYSINIT() hook. This allowed simplification of chunks of the sysinit code in the process. This kthread_create() is our old kproc_start internals, with the SYSINIT_KT fork hooks grafted in and tweaked to work the same as the NetBSD one. One thing I'd like to do shortly is get rid of nfsiod as a user initiated process. It makes sense for the nfs client code to create them on the fly as needed up to a user settable limit. This means that nfsiod doesn't need to be in /sbin and is always "available". This is a fair bit easier to do outside of the SYSINIT_KT() framework.
OpenPOWER on IntegriCloud