summaryrefslogtreecommitdiffstats
path: root/sys/kern/init_main.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Initialize the routing table before domains.mpi2015-10-071-2/+5
| | | | | | | | | | | | | | | | | | | | | | | The routing table is not an optional component of the network stack and initializing it inside the "routing domain" requires some ugly introspection in the domain interface. This put the rtable* layer at the same level of the if* level. These two subsystem are organized around the two global data structure used in the network stack: - the global &ifnet list, to be used in process context only, and - the routing table which can be read in interrupt context. This change makes the rtable_* layer domain-aware and extends the "struct domain" such that INET, INET6 and MPLS can specify the length of the binary key used in lookups. This allows us to keep, or move towards, AF-free route and rtable layers. While here stop the madness and pass the size of the maximum key length in *byte* to rn_inithead0(). ok claudio@, mikeb@
* Use a global table for domains instead of building a list at run time.mpi2015-08-301-2/+1
| | | | | | | As a side effect there's no need to run if_attachdomain() after the list of domains has been built. ok claudio@, reyk@
* Disable pool_gc on m88k if MULTIPROCESSOR; we don't have enough volunteersmiod2015-07-091-1/+3
| | | | | for human sacrifices to get this fixed in a reasonably near future, and the tree must build.
* introduce srp, which according to the manpage i wrote is short fordlg2015-07-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "shared reference pointers". srp allows concurrent access to a data structure by multiple cpus while avoiding interlocking cpu opcodes. it manages its own reference counts and the garbage collection of those data structure to avoid use after frees. internally srp is a twisted version of hazard pointers, which are a relative of RCU. jmatthew wrote the bulk of a hazard pointer implementation and changed bpf to use it to allow mpsafe access to bpfilters. however, at s2k15 we were trying to apply it to other data structures but the memory overhead of every hazard pointer would have blown out significantly in several uses cases. a bulk of our time at s2k15 was spent reworking hazard pointers into srp. this diff adds the srp api and adds the necessary metadata to struct cpuinfo on our MP architectures. srp on uniprocessor platforms has alternate code that is optimised because it knows there'll be no concurrent access to data by multiple cpus. srp is made available to the system via param.h, so it should be available everywhere in the kernel. the docs likely need improvement cos im too close to the implementation. ok mpi@
* reenable the pool gc task.dlg2015-06-241-3/+1
| | | | | | | | the problems it tickled by working outside the biglock on archs with mutex and clock interaction have been fixed, as evidenced by the softnet taskq. ok deraadt@
* Reenable the page zeroing thread on MP m88k kernels.miod2015-05-181-3/+2
|
* emul_native is only used for kernel threads which can't dump core, soguenther2015-05-051-4/+3
| | | | | | | | | | | delete coredump_trad(), uvm_coredump(), cpu_coredump(), struct md_coredump, and various #includes that are superfluous. This leaves compat_linux processes without a coredump callback. If that ability is desired, someone should update it to use coredump_elf32() and verify the results... ok kettenis@
* reenable page zeroing thread on SMP mips kernels.miod2015-05-011-2/+2
|
* disable the pool gc. there are reports of strange lockups on various mpdlg2015-04-121-1/+3
| | | | archs and this is the only interesting diff in the window.
* introduce a garbage collector for (very) idle pool pages.dlg2015-04-071-1/+7
| | | | | | | | | | | now that idle pool pages are timestamped we can tell how long theyve been idle. this adds a task that runs every second that iterates over all the pools looking for pages that have been idle for 8 seconds so it can free them. this idea probably came from a conversation with tedu@ months ago. ok tedu@ kettenis@
* Factor out the common bits of process_new() and main()'s code forguenther2015-02-101-14/+7
| | | | | | | setting up process0, 'cause I'm sick of forgetting to update main() when touching process_new() ok blambert@ miod@
* Stop using USRSTACK as the edge of the stack, but rather use the vmspacemiod2015-02-091-2/+3
| | | | | | | | vm_minsaddr or vm_maxsaddr, depending upon the direction the stack goes in. This should have no effect on the existing behaviourrr. ok kettenis@ deraadt@
* unneccessary cmask variable; ok guentherderaadt2015-01-191-2/+1
|
* Many architectures call initmsgbuf() really really early, before uvm iskettenis2015-01-131-1/+4
| | | | | | | | | initialized. Calling malloc(9) at that point is not a good idea. So initialize consbuf later. Fixes dmesg -s on sparc64 (and probably a few other architectures). ok miod@, deraadt@
* copyright_year=$(date +%Y)jsing2014-12-311-2/+2
|
* The greatest happiness is to scatter inferiour APIs, to drive themkrw2014-12-281-5/+2
| | | | | | | | | | before you, to see their files reduced to ashes, to see those who love them shrouded in tears, and to gather into your API all their invocations. In other words, workq is no more. There is only taskq. ok kettenis@ dlg@ (creator of taskq) jmc@
* Prefer MADV_* over POSIX_MADV_* in kernel for consistency: the latterguenther2014-12-171-2/+2
| | | | | | doesn't have all the values and therefore can't be used everywhere. ok deraadt@ kettenis@
* primary change: move uvm_vnode out of vnode, keeping only a pointer.tedu2014-12-161-1/+3
| | | | | | objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
* Use MAP_INHERIT_* for the 'inh' argument to the UMV_MAPFLAG() macro,guenther2014-12-151-2/+2
| | | | | | eliminating the must-be-kept-in-sync UVM_INH_* macros ok deraadt@ tedu@
* convert bcopy to memcpy. ok millerttedu2014-12-101-2/+2
|
* Disable the page zeroing thread on MULTIPROCESSOR mips64 kernels as well.miod2014-11-181-2/+3
| | | | | | | | Regression spotted by tobiasu@. XXX I wonder if the page zeroing thread shouldn't perform explicit XXX pmap_update(pmap_kernel()) calls after each page zeroing... but that XXX might not be enough.
* Replace a plethora of historical protection options with justderaadt2014-11-161-3/+3
| | | | | | | PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
* Do not launch the page zeroing thread on MULTIPROCESSOR m88k systems. Thismiod2014-10-251-2/+2
| | | | causes a deadlock between reaper and zerothread I am currently investigating.
* redo the performance throttling in the kernel.tedu2014-10-171-1/+10
| | | | | | introduce a new sysctl, hw.perfpolicy, that governs the policy. when set to anything other than manual, hw.setperf then becomes read only. phessler was heading in this direction, but this is slightly different. :)
* disable pagezero thread on hppa, until failure gets diagnosed, ok miod kettenisderaadt2014-10-131-1/+3
|
* back out; does not even compilederaadt2014-10-111-10/+1
|
* resurrect a many year old diff. move CPU throttling into the kernel,tedu2014-10-111-1/+10
| | | | | | enabled by setting hw.setperf=-1. some other bugs preventing this from going in before have been fixed. my thanks to phessler for keeping the diff alive in the mean time. tested by several to not regress.
* Introduce a thread for zeroing pages without holding the kernel lock. Thiskettenis2014-10-031-1/+5
| | | | | | | | | | | | way we can do some useful kernel lock in parallel with other things and create a reservoir of zeroed pages ready for use elsewhere. This should reduce latency. The thread runs at the absolutel lowest priority such that we don't keep other kernel threads or userland from doing useful work. Can be easily disabled by disabling the kthread_create(9) call in main(). Which perhaps we should do for non-MP kernels. ok deraadt@, tedu@
* No need for raw_cb.hmpi2014-08-141-2/+1
|
* It's init as a process that's special, not init's original thread.guenther2014-07-111-10/+15
| | | | | | Remember initprocess instead of initproc. ok matthew@ blambert@
* decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt2014-07-081-4/+1
| | | | | don't need to be married. ok guenther miod beck jsing kettenis
* Fix a few format string bugs with -DDEBUGsf2014-06-151-3/+3
|
* Move from struct proc to process the reference-count-holding pointersguenther2014-05-151-3/+3
| | | | | | | | | | to the process's vmspace and filedescs. struct proc continues to keep copies of the pointers, copying them on fork, clearing them on exit, and (for vmspace) refreshing on exec. Also, make uvm_swapout_threads() thread aware, eliminating p_swtime in kernel. particular testing by ajacoutot@ and sebastia@
* Add PS_SYSTEM, the process-level mirror of the thread-level P_SYSTEM,guenther2014-05-041-1/+2
| | | | | | | and FORK_SYSTEM as a flag to set them. This eliminates needing to peek into other processes threads in various places. Inspired by NetBSD ok miod@ matthew@
* Have each thread keeps its own (counted!) reference to the process's ucredsguenther2014-04-181-1/+4
| | | | | | | | | to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds. Inspired by FreeBSD and NetBSD "right time" deraadt@
* Grab the kernel lock before autoconf. This way device drivers can drop it inkettenis2014-03-311-4/+4
| | | | | | | any context if they feel like it. ok deraadt@, guenther@ (who both suggested we could probably grab it even earlier)
* Eliminates struct pcred by moving the real and saved ugids intoguenther2014-03-301-5/+3
| | | | | | | | | struct ucred; struct process then directly links to the ucred Based on a discussion at c2k10 or so before noting that FreeBSD and NetBSD did this too. ok matthew@
* It's been a quarter century: we can assume volatile is present with that name.guenther2014-03-291-2/+2
| | | | ok dlg@ mpi@ deraadt@
* Reduce uvm include madness. Use <uvm/uvm_extern.h> instead ofmpi2014-03-281-2/+2
| | | | | | <uvm/uvm.h> if possible and remove double inclusions. ok beck@, mlarkin@, deraadt@
* Move p_emul and p_sigcode from proc to process.guenther2014-03-261-2/+2
| | | | | | | | | Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself. ok deraadt@ millert@
* Move p_sigacts from struct proc to struct process.guenther2014-03-221-4/+4
| | | | testing help mpi@
* Eliminate the exit sig handling, which was only invokable via theguenther2014-02-121-2/+2
| | | | | | | | Linux-compat clone() syscall when *not* using CLONE_THREAD. pirofti@ confirms Opera runs in compat without this, so out it goes; one less hair to choke on in kern_exit.c ok tedu@ pirofti@
* Threads can't be zombies, only processes, so change zombproc to zombprocess,guenther2014-01-201-5/+8
| | | | | | | | make it a list of processes, and change P_NOZOMBIE and P_STOPPED from thread flags to process flags. Add allprocess list for the code that just wants to see processes. ok tedu@
* Refactor rnd startup so arc4random/arc4random_buf can create a chacha statederaadt2014-01-191-3/+1
| | | | | | | on first call, very early on, from boot-supplied entropy, then feed from that. Later when we have more subsystems ready, the main() can properly initialize the entropy-driven model. Lots of discussion with mikeb. ok kettenis markus mikeb
* insane typoderaadt2014-01-191-2/+2
|
* oops, forgotten partderaadt2014-01-191-2/+2
| | | | | | Initialize ci_randseed better using arc4random() + a trick. Remove the libkern srandom() API since it is not suitable for this use. ok kettenis miod
* With the earlier initialization of the random subsystem, random_hostseed()deraadt2014-01-191-3/+1
| | | | | | is no longer providing significant value. The random subsystem is in pretty good state, and moments later userland will feed the dmesg. ok jsing
* We can call random_start() immediately after cpu_startup, that is thederaadt2014-01-191-3/+3
| | | | | point at which everything it does is safe, including msg buffer access. ok kettenis jsing
* copyright++fgsch2014-01-011-2/+2
|
* oops, the fallback stack protector code must handle 64-bit guardsderaadt2013-12-281-2/+2
| | | | spotted by kettenis