summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Introduce and use a new VM interface for temporarily pinning pages. Thisalc2010-12-253-62/+14
| | | | | | | new interface replaces the combined use of vm_fault_quick() and pmap_extract_and_hold() throughout the kernel. In collaboration with: kib@
* Enlarge hash table for new condition variable.davidxu2010-12-231-2/+2
|
* MFp4:davidxu2010-12-221-15/+105
| | | | | | | | | | | | | | | - Add flags CVWAIT_ABSTIME and CVWAIT_CLOCKID for umtx kernel based condition variable, this should eliminate an extra system call to get current time. - Add sub-function UMTX_OP_NWAKE_PRIVATE to wake up N channels in single system call. Create userland sleep queue for condition variable, in most cases, thread will wait in the queue, the pthread_cond_signal will defer thread wakeup until the mutex is unlocked, it tries to avoid an extra system call and a extra context switch in time window of pthread_cond_signal and pthread_mutex_unlock. The changes are part of process-shared mutex project.
* Initialize fp_location for explicitly managed fail points, and pushmdf2010-12-211-2/+3
| | | | | | | | | | | | | | | the parentheses around the location for simple fail points into the location string. This makes the print on fail point set more consistent between the two versions. Also fix up fail.h a little for style(9): only use one of sys/param.h and sys/types.h, and use the existing __XSTRING() macro instead of rolling our own. Also fix up a few tabs on changed and nearby lines. Lastly, since KFAIL_POINT_{BEGIN,END} are not meant for use outside this file, just eliminate the macros entirely. MFC after: 1 week
* Move the fail_point_entry definition from fail.h to kern_fail.c, whichmdf2010-12-211-9/+37
| | | | | | | allows putting the enumeration constants of fail point types with the text string that matches them. MFC after: 1 week
* - Introduce the Hhook (Helper Hook) KPI. The KPI is closely modelled on pfil(9),lstewart2010-12-212-0/+928
| | | | | | | | | | | | | | | | | | | | | | | | | | | | and in many respects can be thought of as a more generic superset of pfil. Hhook provides a way for kernel subsystems to export hook points that Khelp modules can hook to provide enhanced or new functionality to the kernel. The KPI has been designed to ensure hook points pose no noticeable overhead when no hook functions are registered. - Introduce the Khelp (Kernel Helpers) KPI. Khelp provides a framework for managing Khelp modules, which indirectly use the Hhook KPI to register their hook functions with hook points of interest within the kernel. Khelp modules aim to provide a structured way to dynamically extend the kernel at runtime in an ABI preserving manner. Depending on the subsystem providing hook points, a Khelp module may be able to associate per-object data for maintaining relevant state between hook calls. - pjd's Object Specific Data (OSD) KPI is used to manage the per-object data allocated to Khelp modules. Create a new "OSD_KHELP" OSD type for use by the Khelp framework. - Bump __FreeBSD_version to 900028 to mark the introduction of the new KPIs. In collaboration with: David Hayes <dahayes at swin edu au> and Grenville Armitage <garmitage at swin edu au> Sponsored by: FreeBSD Foundation Reviewed by: bz, others along the way MFC after: 3 months
* Introduce vm_fault_hold() and use it to (1) eliminate a long-standing racealc2010-12-201-63/+17
| | | | | | | | | | condition in proc_rwmem() and to (2) simplify the implementation of the cxgb driver's vm_fault_hold_user_pages(). Specifically, in proc_rwmem() the requested read or write could fail because the targeted page could be reclaimed between the calls to vm_fault() and vm_page_hold(). In collaboration with: kib@ MFC after: 6 weeks
* Implement and use a single optimized function for unholding a set of pages.alc2010-12-172-18/+4
| | | | Reviewed by: kib@
* Add back a bounds check on valid idle priorities that was lost in anjhb2010-12-171-8/+6
| | | | | | | | | earlier commit. While here, move the thread lock down in rtp_to_pri(). It is not needed for all of the priority value checks and the computation of newpri. Reported by: swell.k @ gmail MFC after: 3 days
* One of the compat32 functions was copying in a raw timespec, instead ofmdf2010-12-151-2/+1
| | | | | | | | a 32-bit one. This can cause weird timeout issues, as the copying reads garbage from the user. Code by: Deepak Veliath <deepak dot veliath at isilon dot com> MFC after: 1 week
* Just pass M_ZERO to malloc(9) instead of clearing allocated memory separately.pjd2010-12-141-2/+1
|
* Adapt filesystem-independent NFSv4 ACL code (used by UFS, but not by ZFS)trasz2010-12-131-63/+258
| | | | | | | | | | | | to PSARC/2010/029. In short, the semantics is simplified - "weird stuff" no longer happens after chmod, entries don't get duplicated during inheritance, and trivial ACLs no longer contain three "DENY" entries, which is also more friendly to MS Windows. By default, UFS keeps using old semantics. To change it, set sysctl vfs.acl_nfs4_old_semantics to 0. I'll flip the switch when ZFSv28 hits the tree, to keep these two in sync - ZFS v28 uses PSARC semantics, and ZFS v15 uses the old one.
* Fix race in devfs by using LIST_FIRST() instead ofhselasky2010-12-111-2/+2
| | | | | | | | | LIST_FOREACH_SAFE() when freeing the devfs private data entries. Reviewed by: kib MFC after: 3 days Approved by: thompsa (mentor)
* Refactor fork1() to make it easier to follow. No functional changes.trasz2010-12-101-191/+220
| | | | | Reviewed by: kib (earlier version) Tested by: pho
* Don't tie ct_debug to bootverbose. Provide a sysctl to turn it on or off.bz2010-12-091-1/+3
| | | | | | Switch the default to always off. Reviewed by: kib
* MFp4:davidxu2010-12-091-3/+42
| | | | | The unit number allocator reuses ID too fast, this may hide bugs in other code, add a ring buffer to delay freeing a thread ID.
* MFp4:davidxu2010-12-096-30/+33
| | | | | | | | | It is possible a lower priority thread lending priority to higher priority thread, in old code, it is ignored, however the lending should always be recorded, add field td_lend_user_pri to fix the problem, if a thread does not have borrowed priority, its value is PRI_MAX. MFC after: 1 week
* Add a KASSERT to make it obvious when fork_norfproc() is to be called,trasz2010-12-061-1/+3
| | | | | | | | and set *procp to NULL in all cases. Previously, it was not being set in the ERESTART case. This is effectively no-op, since its value is ignored by callers in the error case. Reviewed by: kib@
* Fix style bug introduced by previous commit.trasz2010-12-061-1/+1
|
* Improve readability by factoring out the !RFPROC case. While here,trasz2010-12-061-59/+57
| | | | | | turn K&R function definitions into ANSI. No functional changes. Reviewed by: kib@
* Trim whitespaces at the end of lines. Use the commit to recordkib2010-12-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | proper log message for r216150. MFC after: 1 week If unix socket has a unix socket attached as the rights that has a unix socket attached as the rights that has a unix socket attached as the rights ... Kernel may overflow the stack on attempt to close such socket. Only close the rights file in the context of the current close if the file is not unix domain socket. Otherwise, postpone the work to taskqueue, preventing unlimited recursion. The pass of the unix domain sockets over the SCM_RIGHTS message control is not widely used, and more, the close of the socket with still attached rights is mostly an application failure. The change should not affect the performance of typical users of SCM_RIGHTS. Reviewed by: jeff, rwatson
* Reviewed by: jeff, rwatsonkib2010-12-031-5/+74
| | | | MFC after: 1 week
* Replace pointer to "struct uidinfo" with pointer to "struct ucred"trasz2010-12-021-2/+2
| | | | | | | | | in "struct vm_object". This is required to make it possible to account for per-jail swap usage. Reviewed by: kib@ Tested by: pho@ Sponsored by: FreeBSD Foundation
* removed tag is '-', not '+'.imp2010-12-021-2/+1
| | | | remove extra return.
* Remove useless NULL checks for M_WAITOK mallocs.trasz2010-12-022-19/+0
|
* Remove redundant (and bogus) insertion of pnp info when announcing newimp2010-11-301-37/+2
| | | | | | | and retiring devices. That's already inserted elsewhere. Submitted by: n_hibma MFC after: 3 days
* Fix uninitialized variable warning that shows on Tinderbox but not mymdf2010-11-291-1/+1
| | | | | | setup. (??) Submitted by: Michael Butler <imb at protected-networks dot net>
* Do not hold the sysctl lock across a call to the handler. This fixes amdf2010-11-291-27/+67
| | | | | | | | | | general LOR issue where the sysctl lock had no good place in the hierarchy. One specific instance is #284 on http://sources.zabbadoz.net/freebsd/lor.html . Reviewed by: jhb MFC after: 1 month X-MFC-note: split oid_refcnt field for oid_running to preserve KBI
* Slightly modify the logic in sysctl_find_oid to reduce the indentation.mdf2010-11-291-19/+22
| | | | | | There should be no functional change. MFC after: 3 days
* Use the SYSCTL_CHILDREN macro in kern_sysctl.c to help de-obfuscate themdf2010-11-291-7/+6
| | | | | | code. MFC after: 3 days
* Account i/o done on cdevs.kib2010-11-251-2/+5
| | | | | Reported and tested by: Adam Vande More <amvandemore gmail com> MFC after: 1 week
* Allow shared-locked vnode to be passed to vunref(9).kib2010-11-241-5/+15
| | | | | | | | | | When shared-locked vnode is supplied as an argument to vunref(9) and resulting usecount is 0, set VI_OWEINACT and do not try to upgrade vnode lock. The later could cause vnode unlock, allowing the vnode to be reclaimed meantime. Tested by: pho MFC after: 1 week
* taskqueue: drop unused tq_name fieldavg2010-11-231-3/+1
| | | | | | | | | | | | tq_name was used write-only and besides it was just a pointer, so it could point to some garbage in a temporary buffer that's gone. This change shouldn't change KPI/KBI as struct taskqueue is private to subr_taskqueue.c. If we find a need for tq_name it can be resurrected at any moment. taskqueue_create() interface is preserved for this purpose. Suggested by: jhb MFC after: 10 days
* Update MNT_ROOTFS comments after changes in the root mount logic.pluknet2010-11-231-2/+4
| | | | | | Reported by: arundel Suggested by: marcel (phrasing) Approved by: kib (mentor)
* Add parentheses for clarity. The parentheses around the two terms of the &&cperciva2010-11-231-1/+1
| | | | | | | are unnecessary but I'm leaving them in for the sake of avoiding confusion (I confuse easily). Submitted by: bde
* After some off-list discussion, revert a number of changes to thedim2010-11-224-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | DPCPU_DEFINE and VNET_DEFINE macros, as these cause problems for various people working on the affected files. A better long-term solution is still being considered. This reversal may give some modules empty set_pcpu or set_vnet sections, but these are harmless. Changes reverted: ------------------------------------------------------------------------ r215318 | dim | 2010-11-14 21:40:55 +0100 (Sun, 14 Nov 2010) | 4 lines Instead of unconditionally emitting .globl's for the __start_set_xxx and __stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu sections are actually defined. ------------------------------------------------------------------------ r215317 | dim | 2010-11-14 21:38:11 +0100 (Sun, 14 Nov 2010) | 3 lines Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughout the tree. ------------------------------------------------------------------------ r215316 | dim | 2010-11-14 21:23:02 +0100 (Sun, 14 Nov 2010) | 2 lines Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE.
* Style fix.attilio2010-11-221-3/+2
| | | | | | | | Sponsored by: Sandvine Incorporated Requested by: jhb Reviewed by: jhb MFC after: 1 week X-MFC: 215544
* Add the ability for GDB to printout the thread name along with otherattilio2010-11-222-0/+13
| | | | | | | | | | | | | | | | | | | | thread specific informations. In order to do that, and in order to avoid KBI breakage with existing infrastructure the following semantic is implemented: - For live programs, a new member to the PT_LWPINFO is added (pl_tdname) - For cores, a new ELF note is added (NT_THRMISC) that can be used for storing thread specific, miscellaneous, informations. Right now it is just popluated with a thread name. GDB, then, retrieves the correct informations from the corefile via the BFD interface, as it groks the ELF notes and create appropriate pseudo-sections. Sponsored by: Sandvine Incorporated Tested by: gianni Discussed with: dim, kan, kib MFC after: 2 weeks
* In tc_windup, handle the case where the previous call to tc_windup wascperciva2010-11-221-0/+10
| | | | | | | | | | | | | more than 1s earlier. Prior to this commit, the computation of th_scale * delta (which produces a 64-bit value equal to the time since the last tc_windup call in units of 2^(-64) seconds) would overflow and any complete seconds would be lost. We fix this by repeatedly converting tc_frequency units of timecounter to one seconds; this is not exactly correct, since it loses the NTP adjustment, but if we find ourselves going more than 1s at a time between clock interrupts, losing a few seconds worth of NTP adjustments is the least of our problems...
* By using the 32-bit Linux version of Sun's Java Development Kit 1.6netchild2010-11-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | on FreeBSD (amd64), invocations of "javac" (or "java") eventually end with the output of "Killed" and exit code 137. This is caused by: 1. After calling exec() in multithreaded linux program threads are not destroyed and continue running. They get killed after program being executed finishes. 2. linux_exit_group doesn't return correct exit code when called not from group leader. Which happens regularly using sun jvm. The submitters fix this in a similar way to how NetBSD handles this. I took the PRs away from dchagin, who seems to be out of touch of this since a while (no response from him). The patches committed here are from [2], with some little modifications from me to the style. PR: 141439 [1], 144194 [2] Submitted by: Stefan Schmidt <stefan.schmidt@stadtbuch.de>, gk Reviewed by: rdivacky (in april 2010) MFC after: 5 days
* Use atomic instruction to set _has_writer, otherwise there is a racedavidxu2010-11-221-1/+2
| | | | | | causes userland to not wake up a thread sleeping in kernel. MFC after: 3 days
* Remove prtactive variable and related printf()s in the vop_inactivekib2010-11-191-3/+0
| | | | | | | | and vop_reclaim() methods. They seems to be unused, and the reported situation is normal for the forced unmount. MFC after: 1 week X-MFC-note: keep prtactive symbol in vfs_subr.c
* Scan the list in reverse order for the shutdown handlers of loaded modules.attilio2010-11-191-2/+2
| | | | | | | | | | | | This way, when there is a dependency between two modules, the handler of the latter probed runs first. This is a similar approach as the modules are unloaded in the same linkerfile. Sponsored by: Sandvine Incorporated Submitted by: Nima Misaghian <nmisaghian at sandvine dot com> MFC after: 1 week
* Set the POSIX semaphore capability when the semaphore module is enabled.jhb2010-11-191-0/+2
| | | | | | | This is ignored in HEAD where semaphores are marked as always enabled in <unistd.h>. MFC after: 1 week
* Set various POSIX capability sysctls to the version of the API that isjhb2010-11-192-4/+5
| | | | | | | supported rather than 1. They are supposed to return a suitable value for sysconf(3). While here, make the fsync sysctl match <unistd.h>. MFC after: 1 week
* Add a resource_list_reserved() method that returns true if a resourcejhb2010-11-171-0/+24
| | | | list entry contains a reserved resource.
* No need to include sys/systm.h twice.cognet2010-11-161-1/+0
|
* Only unlock process if a thread is found.davidxu2010-11-151-4/+4
|
* Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughoutdim2010-11-144-4/+4
| | | | the tree.
* Similar to sys/net/vnet.h, define the linker set name for sys/sys/pcpu.hdim2010-11-141-4/+4
| | | | as a macro, and use it instead of literal strings.
OpenPOWER on IntegriCloud