summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Add init_param3() to subr_param. This function is calledsilby2003-07-112-26/+21
| | | | | | | | immediately after the kernel map has been sized, and is the optimal place for the autosizing of memory allocations which occur within the kernel map to occur. Suggested by: bde
* unifdef -DLAZY_SWITCH and start to tidy up the associated glue.peter2003-07-102-7/+1
|
* A few minor changes:silby2003-07-091-6/+7
| | | | | | | - Use atomic ops to update the bigpipe count - Make the bigpipe count sysctl readable - Remove a duplicate comparison in an if statement - Comment two SYSCTLs.
* Pull in the entire kmem_map size calculation from kern_malloc, rathersilby2003-07-081-3/+11
| | | | | | | | | | than the shortcircuited version I had been using, which only worked properly on i386 & amd64. Also, change an autoscale constant to account for the more correct kmem_map size. Problem noticed by: mux
* - When stealing a kse in kseq_move() ignore the current kseq's min nicejeff2003-07-081-7/+13
| | | | | value. We want to steal any thread, even one that is not given a slice on its current queue.
* Put some concrete limits on pipe memory consumption:silby2003-07-082-17/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Limit the total number of pipes so that we do not exhaust all vm objects in the kernel map. When this limit is reached, a ratelimited message will be printed to the console. - Put a soft limit on the amount of memory consumable by pipes. Once the limit has been reached, all new pipes will be limited to 4K in size, rather than the default of 16K. - Put a limit on the number of pages that may be used for high speed page flipping in order to reduce the amount of wired memory. Pipe writes that occur while this limit is exceeded will fall back to non-page flipping mode. The above values are auto-tuned in subr_param.c and are scaled to take into account both the size of physical memory and the size of the kernel map. These limits help to reduce the "kernel resources exhausted" panics that could be caused by opening a large number of pipes. (Pipes alone are no longer able to exhaust all resources, but other kernel memory hogs in league with pipes may still be able to do so.) PR: 53627 Ideas / comments from: hsu, tjr, dillon@apollo.backplane.com MFC after: 1 week
* - Clean up an unused variable.jeff2003-07-071-0/+2
| | | | Submitted by: Steve Kargl <skg@routmask.apl.washington.edu>
* Make the conditional, which decides what siglist to put a signal on,mtm2003-07-051-8/+5
| | | | | | more concise and improve the comment. Submitted by: bde
* I was so happy I found the semi-colon from hell that I didn'tmtm2003-07-041-1/+1
| | | | | | notice another typo in the same line. This typo makes libthr unuseable, but it's effects where counter-balanced by the extra semicolon, which made libthr remarkably useable for the past several months.
* - Parse the cpu topology map in sched_setup().jeff2003-07-041-13/+53
| | | | | | | | - Associate logical CPUs on the same physical core with the same kseq. - Adjust code that assumed there would only be one running thread in any kseq. - Wrap the HTT code with a ULE_HTT_EXPERIMENTAL ifdef. This is a start towards HyperThreading support but it isn't quite there yet.
* Use the f_vnode field to tell which file descriptors have a vnode.phk2003-07-043-19/+15
|
* It's unfair how one extraneous semi-colon can cause so much grief.mtm2003-07-041-1/+1
|
* style(9)mtm2003-07-041-8/+2
| | | | | | | o Remove double-spacing, and while I'm here add a couple of braces as well. Requested by: bde
* In setpgrp(), don't assume a pgrp won't exist if the provided pgid is the samecognet2003-07-041-12/+13
| | | | | | | as the target process' pid, it may exist if the process forked before leaving the pgrp. Thix fixes a panic that happens when calling setpgid to make a process re-enter the pgrp with the same pgid as its pid if the pgrp still exists.
* kse_thr_interrupt should target the thread, specifically.mtm2003-07-042-2/+2
| | | | Requested by: davidxu
* Signals sent specifically to a particular thread mustmtm2003-07-034-19/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | be delivered to that thread, regardless of whether it has it masked or not. Previously, if the targeted thread had the signal masked, it would be put on the processes' siglist. If another thread has the signal umasked or unmasks it before the target, then the thread it was intended for would never receive it. This patch attempts to solve the problem by requiring callers of tdsignal() to say whether the signal is for the thread or for the process. If it is for the process, then normal processing occurs and any thread that has it unmasked can receive it. But if it is destined for a specific thread, it is put on that thread's pending list regardless of whether it is currently masked or not. The new behaviour still needs more work, though. If the signal is reposted for some reason it is always posted back to the thread that handled it because the information regarding the target of the signal has been lost by then. Reviewed by: jdp, jeff, bde (style)
* - Add comments about the maintenance of the per-thread list of contestedjhb2003-07-022-8/+18
| | | | | | | | | | | | | locks held by each thread. - Fix a bug in the original BSD/OS code where a contested lock was not properly handed off from the old thread to the new thread when a contested lock with more than one blocked thread was transferred from one thread to another. - Don't use an atomic operation to write the MTX_CONTESTED value to mtx_lock in the aforementioned special case. The memory barriers and exclusion provided by sched_lock are sufficient. Spotted by: alc (2)
* Add a resource_disabled() helper function that returns true (non-zero) ifjhb2003-07-021-0/+14
| | | | | a specified resource has been disabled via a non-zero 'disabled' hint and false otherwise.
* typo fix in comment.phk2003-07-021-1/+1
|
* Allow SA process unblocks a thread blocked in condition variable.davidxu2003-07-021-2/+8
| | | | Reviewed by: deischen
* Add a new mount flag MNT_BYFSID that can be used to unmount a fileiedowse2003-07-011-23/+32
| | | | | | | | | | | | | | | | | | system by specifying the file system ID instead of a path. Use this by default in umount(8). This avoids the need to perform any vnode operations to look up the mount point, so it makes it possible to unmount a file system whose root vnode cannot be looked up (e.g. due to a dead NFS server, or a file system that has become detached from the hierarchy because an underlying file system was unmounted). It also provides an unambiguous way to specify which file system is to be unmunted. Since the ability to unmount using a path name is retained only for compatibility, that case now just uses a simple string comparison of the supplied path against f_mntonname of each mounted file system. Discussed on: freebsd-arch mdoc help from: ru
* Make swi_vm be INTR_MPSAFE. On all platforms, it is only used to activatescottl2003-07-011-1/+1
| | | | | busdma_swi(). Now that busdma_swi() uses driver-provided locking, this should be safe.
* Fix typo.davidxu2003-06-302-2/+2
|
* Don't use fuword() and suword() on struct members of type int. Thismarcel2003-06-282-8/+8
| | | | | | | | | | | | happens to work on 32-bit platforms as sizeof(long)=sizeof(int), but wrecks all kinds of havoc (garbage reads, corrupting writes and misaligned loads/stores) on 64-bit architectures. The fix for now is to use fuword32() and suword32() and change the type of the applicable int fields to int32. This is to make it explicit that we depend on these fields being 32-bit. We may want to revisit this later. Reviewed by: deischen
* - Don't migrate to stopped cpus.jeff2003-06-281-4/+4
|
* o Change kse_thr_interrupt to allow send a signal to a specified thread,davidxu2003-06-286-144/+343
| | | | | | | | | | | | | | | | | or unblock a thread in kernel, and allow UTS to specify whether syscall should be restarted. o Add ability for UTS to monitor signal comes in and removed from process, the flag PS_SIGEVENT is used to indicate the events. o Add a KMF_WAITSIGEVENT for KSE mailbox flag, UTS call kse_release with this flag set to wait for above signal event. o For SA based thread, kernel masks all signal in its signal mask, let UTS to use kse_thr_interrupt interrupt a thread, and install a signal frame in userland for the thread. o Add a tm_syncsig in thread mailbox, when a hardware trap occurs, it is used to deliver synchronous signal to userland, and upcall is schedule, so UTS can process the synchronous signal for the thread. Reviewed by: julian (mentor)
* - If smp is not started yet don't try to load balance or we'll put threadsjeff2003-06-281-0/+3
| | | | on cpus that aren't running yet.
* Fix POSIX compatible bug for sigwaitinfo and sigtimedwait.davidxu2003-06-281-4/+11
| | | | | | | POSIX says siginfo pointer parameter can be NULL and if the function success, it should return signal number but not zero. The waitset it past should be negatived before it can be used as thread signal mask.
* - Throttle the inherited sleep and run time in sched_fork_kseg(). Thisjeff2003-06-281-4/+4
| | | | | allows us to learn the behavior of a thread much more quickly after it starts up.
* - Adjust the default maximum slice value to ~140ms. This has improved thejeff2003-06-281-2/+2
| | | | | | nice distribution without significantly impacting interactive response. As a side effect it should also allow batch processes to run for a slightly longer period which will positively impact their performance.
* Tidy up leftover lazy_switch instrumentation that is no longer needed.peter2003-06-271-7/+0
| | | | This cleans up some #ifdef hell.
* Fix this to build on alpha. Build test successful.smkelly2003-06-271-1/+1
| | | | Suggested fix from: tjr
* - Add a software watchdog facility.smkelly2003-06-261-0/+82
| | | | | | | | | This commit has two pieces. One half is the watchdog kernel code which lives primarily in hardclock() in sys/kern/kern_clock.c. The other half is a userland daemon which, when run, will keep the watchdog from firing while the userland is intact and functioning. Approved by: jeff (mentor)
* Fix leap second processing by the kernel time keeping routines.imp2003-06-251-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, we would add/subtract the leap second when the system had been up for an even multiple of days, rather than at the end of the day, as a leap second is defined (at least wrt ntp). We do this by calculating the notion of UTC earlier in the loop, and passing that to get it adjusted. Any adjustments that ntp_update_second makes to this time are then transferred to boot time. We can't pass it either the boot time or the uptime because their sum is what determines when a leap second is needed. This code adds an extra assignment and two extra compare in the typical case, which is as cheap as I could made it. I have confirmed with this code the kernel time does the correct thing for both positive and negative leap seconds. Since the ntp interface doesn't allow for +2 or -2, those cases can't be tested (and the folks in the know here say there will never be a +2s or -2s leap event, but rather two +1s or -1s leap events). There will very likely be no leap seconds for a while, given how the earth is speeding up and slowing down, so there will be plenty of time for this fix to propigate. UT1-UTC is currently at "about -0.4s" and decrementing by .1s every 8 months or so. 6 * 8 is 48 months, or 4 years. -stable has different code, but a similar bug that was introduced about the time of the last leap second, which is why nobody has noticed until now. MFC After: 3 weeks Reviewed by: phk "Furthermore, leap seconds must die." -- Cato the Elder
* During a positive leap second, the tai_time offset should beimp2003-06-251-1/+1
| | | | | | | | | | | incremented at the start of the leap second, not after the leap second has been inserted. This is because at the start of the leap second, we set the time back one second. This setting back one second is the moment that the offset changes. The old code set it back after the leap second, but that's one second too late. The negative leap second case is handled correctly. Reviewed by: phk
* At this point targp will always be NULL, so remove the useless if.cognet2003-06-251-2/+0
|
* Use UTC rather than GMT to describe time scale. latter is obsolete.imp2003-06-231-2/+2
|
* Redesign the externalization APIs from the MAC Framework torwatson2003-06-231-40/+20
| | | | | | | | | | | | | | | | | | | | | | | | | the MAC policy modules to improve robustness against C string bugs and vulnerabilities. Following these revisions, all string construction of labels for export to userspace (or elsewhere) is performed using the sbuf API, which prevents the consumer from having to perform laborious and intricate pointer and buffer checks. This substantially simplifies the externalization logic, both at the MAC Framework level, and in individual policies; this becomes especially useful when policies export more complex label data, such as with compartments in Biba and MLS. Bundled in here are some other minor fixes associated with externalization: including avoiding malloc while holding the process mutex in mac_lomac, and hence avoid a failure mode when printing labels during a downgrade operation due to the removal of the M_NOWAIT case. This has been running in the MAC development tree for about three weeks without problems. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Prefer the vop_rmextattr() vnode operation for removing extendedrwatson2003-06-223-5/+12
| | | | | | | | | attributes from objects over vop_setextattr() with a NULL uio; if the file system doesn't support the vop_rmextattr() method, fall back to the vop_setextattr() method. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Expose vop_rmextattr as an explicit operation at the vnode operationrwatson2003-06-221-0/+11
| | | | | | | | interface, rather than relying on a NULL uio for the deletion operation. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Add an explicit credential argument to alq_open() to allow the caller torwatson2003-06-222-5/+7
| | | | | | | | | | | specify what credential to use when authorizing vn_open() and later write operations, rather than curthread->td_ucred. When writing KTR traces to an ALQ, specify the credential of the thread generating the sysctl request. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Add a f_vnode field to struct file.phk2003-06-229-65/+74
| | | | | | | | | | | | Several of the subtypes have an associated vnode which is used for stuff like the f*() functions. By giving the vnode a speparate field, a number of checks for the specific subtype can be replaced simply with a check for f_vnode != NULL, and we can later free f_data up to subtype specific use. At this point in time, f_data still points to the vnode, so any code I might have overlooked will still work.
* When DDB is active, always send printf() output directly to theiedowse2003-06-221-1/+5
| | | | | | console, even if there is a TIOCCONS console tty. We were already doing this after a panic, but it's also useful when entering DDB for some other reason too.
* Use a new message buffer `consmsgbuf' to forward messages to aiedowse2003-06-223-16/+86
| | | | | | | | | | | | | | | TIOCCONS console (e.g. xconsole) via a timeout routine instead of calling into the tty code directly from printf(). This fixes a number of cases where calling printf() at the wrong time (such as with locks held) would cause a panic if xconsole is running. The TIOCCONS message buffer is 8k in size by default, but this can be changed with the kern.consmsgbuf_size sysctl. By default, messages are checked for 5 times per second. The timer runs and the buffer memory remains allocated only at times when a TIOCCONS console is active. Discussed on: freebsd-arch
* Replace the code for reading and writing the kernel message bufferiedowse2003-06-223-112/+272
| | | | | | | | | | | | | | | | | with a new implementation that has a mostly reentrant "addchar" routine, supports multiple message buffers in the kernel, and hides the implementation details from callers. The new code uses a kind of sequence number to represend the current read and write positions in the buffer. This approach (suggested mainly by bde) permits the read and write pointers to be maintained separately, which reduces the number of atomic operations that are required. The "mostly reentrant" above refers to the way that while it is now always safe to have any number of concurrent writers, readers could see the message buffer after a writer has advanced the pointers but before it has witten the new character. Discussed on: freebsd-arch
* - lticks was erroneously being updated in sched_pctcpu(). This was causingjeff2003-06-211-2/+0
| | | | | us to skip the pctcpu_update() call which lead to inaccurate cpu usage statistics for processes that didn't run often.
* - Don't allow nice to have such a large effect on priority. This wasjeff2003-06-211-8/+7
| | | | | | causing poor interactive performance while unnice processes were running. The new scheme still allows nice to have an effect on priority but it is not as dramatic as the effect of the interactivity score.
* Fix a divide-by-zero on kern.log_wakeups_per_second tunable.bmilekic2003-06-201-0/+8
| | | | | Submitted by: Christian S.J. Peron <maneo@bsdpro.com> PR: kern/53557
* Add comment about **vpp being special-cased in vnode_if.awk (1.38)se2003-06-201-0/+6
|
* cpu_set_upcall_kse needs to access userspace, release schedule lockdavidxu2003-06-202-8/+20
| | | | | | | | before calling it for bound thread. To avoid this problem, change thread_schedule_upcall to not put new thread on run queue, let caller do it, so we can tweak the new thread before setting it to run. Reported by: pho
OpenPOWER on IntegriCloud