summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Reserve system call numbers for the MAC framework. This will preventrwatson2002-03-051-1/+6
| | | | | | | | | people working on the MAC tree from getting toasted whenever system call numbers are allocated in the main tree (for example, for KSE :-). Calls allocated: __mac_{get,set}_proc, __mac_{get,set}_{fd,file}(). Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Document all functions, global and static variables, and sysctls.eivind2002-03-059-128/+338
| | | | | | | | Includes some minor whitespace changes, and re-ordering to be able to document properly (e.g, grouping of variables and the SYSCTL macro calls for them, where the documentation has been added.) Reviewed by: phk (but all errors are mine)
* Fix a warning.robert2002-03-051-2/+0
|
* Add a new variable mp_maxid. This is used so that per cpu datastructures mayjeff2002-03-051-2/+14
| | | | | | | | | | | | | be allocated as arrays indexed by the cpu id. Previously the only reliable way to know the max cpu id was through MAXCPU. mp_ncpus isn't useful here because cpu ids may be sparsely mapped, although x86 and alpha do not do this. Also, call cpu_mp_probe much earlier so the max cpu id is known before the VM starts up. This is intended to help support per cpu queues for the new allocator, but may be useful elsewhere. Reviewed by: jake Approved by: jake
* Track the number of wired pages to avoid unwiring unwired pages.tanimura2002-03-051-0/+1
| | | | Reviewed by: alfred
* Add generalized power profile code.iwasaki2002-03-041-0/+31
| | | | | | | | | | | | | This makes other power-management system (APM for now) to be able to generate power profile change events (ie. AC-line status changes), and other kernel components, not only the ACPI components, can be notified the events. - move subroutines in acpi_powerprofile.c (removed) to kern/subr_power.c - call power_profile_set_state() also from APM driver when AC-line status changes - add call-back function for Crusoe LongRun controlling on power profile changes for a example
* Fix bug in mb_alloc that made systems configured withbmilekic2002-03-031-3/+1
| | | | | | | | | | PAGE_SIZE / MCLBYTES == 1 crash. Fix them by changing the appropriate "allocate new page and bucket" code in mb_alloc to use the macro for properly grabbing an allocated object from a bucket, the one that checks whether the bucket is empty. This should allow ken to continue testing zero-copy stuff on -CURRENT. Noticed and provided debug info: ken
* Check the version of ex_anon (a `struct xucred') before using it todd2002-03-031-0/+10
| | | | | | fill out netc_anon (a `struct ucred'), and add an XXX around the entire operation since it isn't clear whether it's doing the right thing with things like cr_uidinfo and cr_prison.
* Fix lock leakage and late unlock.tanimura2002-03-022-3/+4
| | | | Submitted by: bde
* In sosend(), enforce the socket buffer limits regardless of whetheriedowse2002-02-281-1/+1
| | | | | | the data was supplied as a uio or an mbuf. Previously the limit was ignored for mbuf data, and NFS could run the kernel out of mbufs when an ipfw rule blocked retransmissions.
* Remove now unused struct proc *p.imp2002-02-271-1/+0
| | | | Approved by: jhb
* - Change namei() to use td_ucred instead of p_ucred.jhb2002-02-273-7/+7
| | | | | - Change the hack in access() that uses a temporary credential to set td_ucred to the temp cred instead of p_ucred.
* - Change unp_listen() to accept a thread rather than a proc as its secondjhb2002-02-271-5/+5
| | | | | argument. - Use td_ucred in unp_listen() instead of p_ucred.
* Fix Giant leakage in several error cases in __semctl().jhb2002-02-271-4/+4
|
* Add a comment about an unlocked access to p_ucred that will go away injhb2002-02-271-0/+1
| | | | the near future.
* kill __P.alfred2002-02-271-22/+22
|
* add assertions in the places where giant is required to catch whenalfred2002-02-271-0/+12
| | | | | | | | | | | the pipe is locked and shouldn't be. initialize pipe->pipe_mtxp to NULL when creating pipes in order not to trip the above assertions. swap pipe lock with giant around calls to pipe_destroy_write_buffer() pipe_destroy_write_buffer issue noticed by: jhb
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-2728-232/+218
| | | | reference.
* Temporarily lock Giant while we update td_ucred. The proc lock doesn'tjhb2002-02-271-6/+6
| | | | | | | | | | fully protect p_ucred yet so Giant is needed until all the p_ucred locking is done. This is the original reason td_ucred was not used immediately after its addition. Unfortunately, not using td_ucred is not enough to avoid problems. Since p_ucred could be stale, we could actually be dereferencing a stale pointer to dink with the refcount, so we really need Giant to avoid foot-shooting. This allows td_ucred to be safely used as well.
* Fix a NULL deref panic in pipe_write, we can't blindly lockalfred2002-02-271-12/+12
| | | | | pipe->pipe_peer->pipe_mtxp because it may be NULL, so lock the passed in pipe's mutex instead.
* Make getcredhostname() take a buffer and the buffer's sizerobert2002-02-271-3/+12
| | | | | | | | as arguments. The correct hostname is copied into the buffer while having the prison's lock acquired in a jailed process' case. Reviewed by: jhb, rwatson
* Add a function which returns the correct hostname for a givenrobert2002-02-271-0/+11
| | | | | | credential. Reviewed by: phk
* MPsafe fixes:alfred2002-02-271-4/+23
| | | | | use SYSINIT to initialize pipe_zone. use PIPE_LOCK to protect kevent ops.
* Return ESRCH if the target process is not inferior to the curproc.tanimura2002-02-271-0/+2
| | | | Spotted by: HIROSHI OOTA <oota@LSi.nec.co.jp>
* Don't hardcode /sys when making tags, instead use ${.CURDIR}/.. thisalfred2002-02-271-1/+1
| | | | | | | fixes a problem where one tries to make tags when the source isn't in /sys. Submitted by: Jihui Yang <yangjihui@yahoo.com>
* Back out all the pmap related stuff I've touched over the last few days.peter2002-02-274-9/+6
| | | | | | There is some unresolved badness that has been eluding me, particularly affecting uniprocessor kernels. Turning off PG_G helped (which is a bad sign) but didn't solve it entirely. Userland programs still crashed.
* First rev at making pipe(2) pipe's MPsafe.alfred2002-02-271-22/+68
| | | | | | | | | | | Both ends of the pipe share a pool_mutex, this makes allocation and deadlock avoidance easy. Remove some un-needed FILE_LOCK ops while I'm here. There are some issues wrt to select and the f{s,g}etown code that we'll have to deal with, I think we may also need to move the calls to vfs_timestamp outside of the sections covered by PIPE_LOCK.
* Introduce a version field to `struct xucred' in place of one of thedd2002-02-272-10/+18
| | | | | | | | | | | | spares (the size of the field was changed from u_short to u_int to reflect what it really ends up being). Accordingly, change users of xucred to set and check this field as appropriate. In the kernel, this is being done inside the new cru2x() routine which takes a `struct ucred' and fills out a `struct xucred' according to the former. This also has the pleasant sideaffect of removing some duplicate code. Reviewed by: rwatson
* Jake further reduced IPI shootdowns on sparc64 in loops by using rangedpeter2002-02-273-6/+6
| | | | | | | | shootdowns in a couple of key places. Do the same for i386. This also hides some physical addresses from higher levels and has it use the generic vm_page_t's instead. This will help for PAE down the road. Obtained from: jake (MI code, suggestions for MD part)
* revert last commit temporarily due to whining on the lists.dillon2002-02-262-15/+1
|
* STAGE-1 of 3 commit - allow (but do not require) interrupts to remaindillon2002-02-262-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | enabled in critical sections and streamline critical_enter() and critical_exit(). This commit allows an architecture to leave interrupts enabled inside critical sections if it so wishes. Architectures that do not wish to do this are not effected by this change. This commit implements the feature for the I386 architecture and provides a sysctl, debug.critical_mode, which defaults to 1 (use the feature). For now you can turn the sysctl on and off at any time in order to test the architectural changes or track down bugs. This commit is just the first stage. Some areas of the code, specifically the MACHINE_CRITICAL_ENTER #ifdef'd code, is strictly temporary and will be cleaned up in the STAGE-2 commit when the critical_*() functions are moved entirely into MD files. The following changes have been made: * critical_enter() and critical_exit() for I386 now simply increment and decrement curthread->td_critnest. They no longer disable hard interrupts. When critical_exit() decrements the counter to 0 it effectively calls a routine to deal with whatever interrupts were deferred during the time the code was operating in a critical section. Other architectures are unaffected. * fork_exit() has been conditionalized to remove MD assumptions for the new code. Old code will still use the old MD assumptions in regards to hard interrupt disablement. In STAGE-2 this will be turned into a subroutine call into MD code rather then hardcoded in MI code. The new code places the burden of entering the critical section in the trampoline code where it belongs. * I386: interrupts are now enabled while we are in a critical section. The interrupt vector code has been adjusted to deal with the fact. If it detects that we are in a critical section it currently defers the interrupt by adding the appropriate bit to an interrupt mask. * In order to accomplish the deferral, icu_lock is required. This is i386-specific. Thus icu_lock can only be obtained by mainline i386 code while interrupts are hard disabled. This change has been made. * Because interrupts may or may not be hard disabled during a context switch, cpu_switch() can no longer simply assume that PSL_I will be in a consistent state. Therefore, it now saves and restores eflags. * FAST INTERRUPT PROVISION. Fast interrupts are currently deferred. The intention is to eventually allow them to operate either while we are in a critical section or, if we are able to restrict the use of sched_lock, while we are not holding the sched_lock. * ICU and APIC vector assembly for I386 cleaned up. The ICU code has been cleaned up to match the APIC code in regards to format and macro availability. Additionally, the code has been adjusted to deal with deferred interrupts. * Deferred interrupts use a per-cpu boolean int_pending, and masks ipending, spending, and fpending. Being per-cpu variables it is not currently necessary to lock; bus cycles modifying them. Note that the same mechanism will enable preemption to be incorporated as a true software interrupt without having to further hack up the critical nesting code. * Note: the old critical_enter() code in kern/kern_switch.c is currently #ifdef to be compatible with both the old and new methodology. In STAGE-2 it will be moved entirely to MD code. Performance issues: One of the purposes of this commit is to enhance critical section performance, specifically to greatly reduce bus overhead to allow the critical section code to be used to protect per-cpu caches. These caches, such as Jeff's slab allocator work, can potentially operate very quickly making the effective savings of the new critical section code's performance very significant. The second purpose of this commit is to allow architectures to enable certain interrupts while in a critical section. Specifically, the intention is to eventually allow certain FAST interrupts to operate rather then defer. The third purpose of this commit is to begin to clean up the critical_enter()/critical_exit()/cpu_critical_enter()/ cpu_critical_exit() API which currently has serious cross pollution in MI code (in fork_exit() and ast() for example). The fourth purpose of this commit is to provide a framework that allows kernel-preempting software interrupts to be implemented cleanly. This is currently used for two forward interrupts in I386. Other architectures will have the choice of using this infrastructure or building the functionality directly into critical_enter()/ critical_exit(). Finally, this commit is designed to greatly improve the flexibility of various architectures to manage critical section handling, software interrupts, preemption, and other highly integrated architecture-specific details.
* Fixed 3 regressions in rev.1.99 (clobbering of the English fix in rev.1.98,bde2002-02-261-3/+4
| | | | and 2 unformattings).
* Hide "bla bla exists, skipping it" behind bootverbose.sos2002-02-261-4/+4
|
* Cast the variable, not the constant to 64 bits.phk2002-02-261-1/+1
|
* Fix warning in !SMP case.phk2002-02-261-0/+2
| | | | Submitted by: Maxime Henrion <mux@mu.org>
* Remove unused variable.phk2002-02-261-1/+0
|
* Fix warning. s/microuptime()/binuptime()/ for switchtime initial value.peter2002-02-261-1/+1
|
* Fix a warning. Do not assume pointer == long.peter2002-02-261-2/+2
|
* Work-in-progress commit syncing up pmap cleanups that I have been workingpeter2002-02-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | on for a while: - fine grained TLB shootdown for SMP on i386 - ranged TLB shootdowns.. eg: specify a range of pages to shoot down with a single IPI, since the IPI is very expensive. Adjust some callers that used to trigger this inside tight loops to do a ranged shootdown at the end instead. - PG_G support for SMP on i386 (options ENABLE_PG_G) - defer PG_G activation till after we decide what we are going to do with PSE and the 4MB pages at the start of the kernel. This should solve some rumored strangeness about stale PG_G entries getting stuck underneath the 4MB pages. - add some instrumentation for the fine TLB shootdown - convert some asm instruction wrappers from functions to inlines. gcc seems to do a fair bit better with this. - [temporarily!] pessimize the tlb shootdown IPI handlers. I will fix this again shortly. This has been working fairly well for me for a while, but I have tweaked it again prior to commit since my last major testing round. The only outstanding problem that I know of is PG_G related, which is why there is an option for it (not on by default for SMP). I have seen a world speedups by a few percent (as much as 4 or 5% in one case) but I have *not* accurately measured this - I am a bit sceptical of these numbers.
* Sockets passed into uipc_abort() have been allocated by sonewconn()iedowse2002-02-251-10/+2
| | | | | | | | | | | | | | | | | but never accept'ed, so they must be destroyed. Originally, unp_drop() detected this situation by checking if so->so_head is non-NULL. However, since revision 1.54 of uipc_socket.c (Feb 1999), so->so_head is set to NULL before calling soabort(), so any unix-domain sockets waiting to be accept'ed are leaked if the server socket is closed. Resolve this by moving the socket destruction code into uipc_abort() itself, and making it unconditional (the other caller of unp_drop() never needs the socket to be destroyed). Use unp_detach() to avoid the original code duplication when destroying the socket. PR: kern/17895 Reviewed by: dwmalone (an earlier version of the patch) MFC after: 1 week
* Add a generation number to timecounters and spin if it changes underphk2002-02-241-37/+62
| | | | | | | | | | | | our feet when we look inside timecounter structures. Make the "sync_other" code more robust by never overwriting the tc_next field. Add counters for the bin[up]time functions. Call tc_windup() in tc_init() and switch_timecounter() to make sure we all the fields set right.
* Fix a typo (?) in previous commit told ttyprintf() to print the integerphk2002-02-241-1/+1
| | | | | part of the user-time as a 64bit quantity. This resulted in weird output from SIGINFO.
* Lock struct pgrp, session and sigio.tanimura2002-02-2318-263/+833
| | | | | | | | | | | | | | | | | | | | | | | | | New locks are: - pgrpsess_lock which locks the whole pgrps and sessions, - pg_mtx which protects the pgrp members, and - s_mtx which protects the session members. Please refer to sys/proc.h for the coverage of these locks. Changes on the pgrp/session interface: - pgfind() needs the pgrpsess_lock held. - The caller of enterpgrp() is responsible to allocate a new pgrp and session. - Call enterthispgrp() in order to enter an existing pgrp. - pgsignal() requires a pgrp lock held. Reviewed by: jhb, alfred Tested on: cvsup.jp.FreeBSD.org (which is a quad-CPU machine running -current)
* Make this compile.jake2002-02-231-1/+1
| | | | Pointy hat to: julian
* Add some DIAGNOSTIC code.julian2002-02-222-12/+39
| | | | | | | | | | | | While in userland, keep the thread's ucred reference in a shadow field so that the usual place to store it is NULL. If DIAGNOSTIC is not set, the thread ucred is kept valid until the next kernel entry, at which time it is checked against the process cred and possibly corrected. Produces a BIG speedup in kernels with INVARIANTS set. (A previous commit corrected it for the non INVARIANTS case already) Reviewed by: dillon@freebsd.org
* - Whitespace fixes leftover from previous commit.arr2002-02-221-21/+21
| | | | Submitted by: bde
* - Whitespace fixup left over from previous commit.arr2002-02-221-10/+9
| | | | | | - Remove bogus cast. Submitted by: bde
* Convert p->p_runtime and PCPU(switchtime) to bintime format.phk2002-02-226-35/+23
|
* Use better scaling factor for NTPs correction.phk2002-02-221-1/+7
| | | | Explain the magic.
* GC: BIO_ORDERED, various infrastructure dealing with BIO_ORDERED.phk2002-02-223-6/+2
|
OpenPOWER on IntegriCloud