summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* This commit implements the SO_USER_COOKIE socket option, which letsluigi2010-11-121-0/+10
| | | | | | | | | | | | | | | | | | | | | | | you tag a socket with an uint32_t value. The cookie can then be used by the kernel for various purposes, e.g. setting the skipto rule or pipe number in ipfw (this is the reason SO_USER_COOKIE has been implemented; however there is nothing ipfw-specific in its implementation). The ipfw-related code that uses the optopn will be committed separately. This change adds a field to 'struct socket', but the struct is not part of any driver or userland-visible ABI so the change should be harmless. See the discussion at http://lists.freebsd.org/pipermail/freebsd-ipfw/2009-October/004001.html Idea and code from Paul Joe, small modifications and manpage changes by myself. Submitted by: Paul Joe MFC after: 1 week
* Fix style.trasz2010-11-111-2/+2
| | | | Submitted by: bde
* Remove unneeded conditional.trasz2010-11-111-12/+10
| | | | Discussed with: kib
* Fix typos.attilio2010-11-101-2/+2
| | | | | Submitted by: gianni MFC after: 3 days
* - Remove <machine/mutex.h>. Most of the headers were empty, and thejhb2010-11-091-11/+11
| | | | | | | | | | | | contents of the ones that were not empty were stale and unused. - Now that <machine/mutex.h> no longer exists, there is no need to allow it to override various helper macros in <sys/mutex.h>. - Rename various helper macros for low-level operations on mutexes to live in the _mtx_* or __mtx_* namespaces. While here, change the names to more closely match the real API functions they are backing. - Drop support for including <sys/mutex.h> in assembly source files. Suggested by: bde (1, 2)
* Fix typos.brucec2010-11-091-1/+1
| | | | | PR: bin/148894 Submitted by: olgeni
* Use macros rather than inline functions to lock and unlock mutexes, so thatjmallett2010-11-081-17/+15
| | | | | | line number information is preserved in witness. Reviewed by: jhb
* Whitespace and other aspects of style(9). No functional changes.mdf2010-11-081-946/+966
| | | | MFC after: 3 days
* Add a taskqueue_cancel(9) to cancel a pending task without waiting formdf2010-11-081-0/+18
| | | | | | | | | it to run as taskqueue_drain(9) does. Requested by: hselasky Original code: jeff Reviewed by: jhb MFC after: 2 weeks
* On APs startup skip hard-/statclock events, which time passed before CPUmav2010-11-081-16/+30
| | | | | was lauched. Few seconds event burst, accumulated during long startup, reported to cause panic in SCHED_ULE priority calculation logic.
* Add missing curly brackets. By chance, the missing brackets didn't alterjh2010-11-071-1/+2
| | | | | | the code behavior. Submitted by: Lucius Windschuh
* Remove 'softclock_ih' as it is no longer used.jhb2010-11-031-4/+1
|
* Tweak the waitchannel messages for the dead lock detection kthread. Usejhb2010-11-021-2/+2
| | | | | | | | | a shorter message (userland generally only sees the first 6 to 8 characters) when waiting for the allproc lock. Use "-" when idle to math the behavior of other kthreads. Reviewed by: attilio MFC after: 1 week
* Use integer for size of cpuset, as it won't be bigger than INT_MAX,davidxu2010-11-012-9/+4
| | | | | | This is requested by bge. Also move the sysctl into file kern_cpuset.c, because it should always be there, it is independent of thread scheduler.
* Fix callout_tickstofirst() behavior after signed integer ticks overflow.mav2010-10-311-2/+1
| | | | | | | This should fix callout precision drop to 1/4s after 25 days of uptime with HZ = 1000. Submitted by: Taku YAMAMOTO <taku@tackymt.homeip.net>
* Remove sysctl debug.ncnegfactor, it is renamed to vfs.ncnegfactor.kib2010-10-301-2/+0
| | | | MFC: do not
* Fix uninitialized variable.trasz2010-10-291-1/+1
| | | | | Found with: Coverity Prevent(tm) CID: 8632
* Add sysctl kern.sched.cpusetsize to export the size of kernel cpuset,davidxu2010-10-291-0/+11
| | | | | | also add sysconf() key _SC_CPUSET_SIZE to get sysctl value. Submitted by: gcooper
* Set bootverbose directly in mi_startup() rather than via a SYSINIT. Thisjhb2010-10-281-9/+3
| | | | | | | ensures 'bootverbose' is in a valid state for all SYSINITs. Reported by: avg MFC after: 1 week
* - Revert r214409.davidxu2010-10-271-4/+0
| | | | - Use long word to figure out sizeof kernel cpuset, hope it works.
* If input parameter cpusetsize is zero, give userland size of cpuset maskdavidxu2010-10-271-0/+4
| | | | kernel is using.
* Reduce the difference between hirunningspace and lorunningspace,ivoras2010-10-251-3/+3
| | | | it should help interactivity in edge cases.
* Use function tdfind() to find a thread.davidxu2010-10-251-11/+2
|
* Mostly revert r203420, and add similar functionality into ada(4) since thebrucec2010-10-241-1/+1
| | | | | | | | | | | | | | | | | existing code caused problems with some SCSI controllers. A new sysctl kern.cam.ada.spindown_shutdown has been added that controls whether or not to spin-down disks when shutting down. Spinning down the disks unloads/parks the heads - this is much better than removing power when the disk is still spinning because otherwise an Emergency Unload occurs which may cause damage to the actuator. PR: kern/140752 Submitted by: olli Reviewed by: arundel Discussed with: mav MFC after: 2 weeks
* Remove workaround for ZFS bug; fix was committed to the //depot/user/pjd/zfs/...trasz2010-10-231-22/+0
| | | | | | branch some time ago. MFC after: two weeks
* In thr_exit() and kthread_exit(), only remove thread fromdavidxu2010-10-232-7/+12
| | | | | | hash if it can directly exit, otherwise let exit1() do it. The change should be in r213950, but for unknown reason, it was lost.
* Call chainevh callback when we are invoked with neither MOD_LOAD nordelphij2010-10-211-1/+3
| | | | | | | | | | | MOD_UNLOAD. This makes it possible to add custom hooks for other module events. Return EOPNOTSUPP when there is no callback available. Pointed out by: jhb Reviewed by: jhb MFC after: 1 month
* - When disabling ktracing on a process, free any pending requests thatjhb2010-10-214-80/+106
| | | | | | | | | | | | | | | may be left. This fixes a memory leak that can occur when tracing is disabled on a process via disabling tracing of a specific file (or if an I/O error occurs with the tracefile) if the process's next system call is exit(). The trace disabling code clears p_traceflag, so exit1() doesn't do any KTRACE-related cleanup leading to the leak. I chose to make the free'ing of pending records synchronous rather than patching exit1(). - Move KTRACE-specific logic out of kern_(exec|exit|fork).c and into kern_ktrace.c instead. Make ktrace_mtx private to kern_ktrace.c as a result. MFC after: 1 month
* In syscall_module_handler(): all switch branches return, removedelphij2010-10-211-4/+1
| | | | | | | | | unreached code as pointed out in a Chinese forum [1]. [1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619 Pointed out by: btw616 <btw s qq com> MFC after: 1 month
* - Don't include sx.h, it is not needed.davidxu2010-10-201-12/+11
| | | | | - Check NULL pointer, move timeout calculation code outside of process lock.
* ZFS pool name is not a real device in devfs. Do not wait forae2010-10-191-1/+2
| | | | | | | device appear when mounting root from ZFS. Reviewed by: marcel Approved by: mav (mentor)
* We've already set p = td->td_proc, so use it.emaste2010-10-181-4/+4
|
* Re-implement the root mount logic using a recursive approach, whereby eachmarcel2010-10-181-326/+738
| | | | | | | | | | | | | | | | | | | | | root file system (starting with devfs and a synthesized configuration) can contain directives for mounting another file system as root. The old root file system is re-mounted under the new root file system (with /.mount or /mnt as the mount point) to allow access to the underlying file system. The configuration allows for creating vnode-backed memory disks that can subsequently be mounted as root. This allows for an efficient and low- cost way to distribute and boot FreeBSD software images that reside on some storage media. When trying a mount, the kernel will wait for the device in question to arrive. The timeout is configurable and is part of the configuration. This allows arbitrarily complex GEOM configurations to be constructed on the fly. A side-effect of this change is that all root specifications, whether compiled into the kernel or typed at the prompt can contain root mount options.
* In vfs_filteropt(), only print the errmsg when there's no errmsgmarcel2010-10-181-1/+3
| | | | mount option. Otherwise errors tend to get printed multiple times.
* Rename boot() to kern_reboot() and make it visible outside ofmarcel2010-10-181-7/+6
| | | | | kern_shutdown.c. This makes it easier for emulators and other parts of the kernel to initiate a reboot.
* Fix an XXX comment by answering 'no'. OS X does not set the day-of-weeknwhitehorn2010-10-171-4/+0
| | | | | | | | counter on SMU-based systems, which causes FreeBSD to reject the RTC time when used in a dual-boot environment. Since we don't use the day-of-week counter anyway, solve this by just not checking that it matches. MFC after: 3 weeks
* - Insert thread0 into correct thread hash link list.davidxu2010-10-172-20/+8
| | | | | | | | | | | - In thr_exit() and kthread_exit(), only remove thread from hash if it can directly exit, otherwise let exit1() do it. - In thread_suspend_check(), fix cleanup code when thread needs to exit. This change seems fixed the "Bad link elm " panic found by Peter Holm. Stress testing: pho
* Provide vfs.ncsizefactor instead of hard-coding namecache ratio.kib2010-10-161-12/+20
| | | | | | | | | Move debug.ncnegfactor to vfs.ncnegfactor [1]. Provide some descriptions for the namecache related sysctls [1]. Based on the submission by: Rogier R. Mulhuijzen <drwilco drwilco net> [1] MFC after: 2 weeks X-MFC-note: remove debug.ncnegfactor in HEAD after MFC
* In kern_sigtimedwait(), move initialization code out of process lock,davidxu2010-10-141-103/+86
| | | | | | | | | | | | | instead of using SIGISMEMBER to test every interesting signal, just unmask the signal set and let cursig() return one, get the signal after it returns, call reschedule_signal() after signals are blocked again. In kern_sigprocmask(), don't call reschedule_signal() when it is unnecessary. In reschedule_signal(), replace SIGISEMPTY() + SIGISMEMBER() with sig_ffs(), rename variable 'i' to sig.
* Use a safer mechanism for determining if a task is currently running,mdf2010-10-131-30/+45
| | | | | | | | that does not rely on the lifetime of pointers being the same. This also restores the task KBI. Suggested by: jhb MFC after: 1 month
* sigqueue_collect_set() is no longer needed because other functionsdavidxu2010-10-131-29/+7
| | | | maintain pending set correctly.
* Re-expose and briefly document taskqueue_run(9). The function is usedmdf2010-10-121-3/+1
| | | | | | in at least one 3rd party driver. Requested by: jhb
* generic_stop_cpus: prevent parallel executionavg2010-10-121-45/+17
| | | | | | | | | | | | | | | | | | | | This is based on the same approach as used in panic(). In theory parallel execution of generic_stop_cpus() could lead to two CPUs stopping each other and everyone else, and thus a total system halt. Also, in theory, we should have some smarter locking here, because two (or more CPUs) could be stopping unrelated sets of CPUs. But in practice, it seems, this function is only used to stop "all other" CPUs. Additionally, I took this opportunity to make amd64-specific suspend_cpus() function use generic_stop_cpus() instead of rolling out essentially duplicate code. This code is based on code by Sandvine Incorporated. Suggested by: mdf Reviewed by: jhb, jkim (earlier version) MFC after: 2 weeks
* Add a flag TDF_TIDHASH to prevent a thread from beingdavidxu2010-10-121-2/+12
| | | | added to or removed from thread hash table multiple times.
* The r184588 changed the layout of struct export_args, causing an ABIkib2010-10-101-0/+8
| | | | | | | | | | breakage for old mount(2) syscall, since most struct <filesystem>_args embed export_args. The mount(2) is supposed to provide ABI compatibility for pre-nmount mount(8) binaries, so restore ABI to pre-r184588. Requested and reviewed by: bde MFC after: 2 weeks
* add kmem_map_free sysctl: query largest contiguous free range in kmem_mapavg2010-10-091-0/+17
| | | | | | Suggested by: alc Reviewed by: alc MFC after: 1 week
* panic_cpu variable should be volatileavg2010-10-091-4/+3
| | | | | | | | | | This is to prevent caching of its value in a register when it is checked and modified by multiple CPUs in parallel. Also, move the variable into the scope of the only function that uses it. Reviewed by: jhb Hint from: mdf MFC after: 1 week
* Create a global thread hash table to speed up thread lookup, usedavidxu2010-10-0913-154/+198
| | | | | | | | | | rwlock to protect the table. In old code, thread lookup is done with process lock held, to find a thread, kernel has to iterate through process and thread list, this is quite inefficient. With this change, test shows in extreme case performance is dramatically improved. Earlier patch was reviewed by: jhb, julian
* Make a thread's address available via the kern proc sysctl, just like theemaste2010-10-081-0/+1
| | | | | | | | process address. Add "tdaddr" keyword to ps(1) to display this thread address. Distilled from Sandvine's patch set by Mark Johnston.
* vm.kmem_map_size: a sysctl to query current kmem_map->sizeavg2010-10-071-0/+14
| | | | | | | Based on a patch from Sandvine Incorporated via emaste. Reviewed by: emaste MFC after: 1 week
OpenPOWER on IntegriCloud