summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Add EVFILT_VNODE open, read and close notifications.kib2016-05-032-0/+43
| | | | | | | While there, order EVFILT_VNODE notes descriptions alphabetically. Based on submission, and tested by: Vladimir Kondratyev <wulf@cicgroup.ru> MFC after: 2 weeks
* kern: Add phashinit_flags(), which allows malloc(M_NOWAIT)sephe2016-05-031-4/+25
| | | | | | | | | | It will be used for the upcoming LRO hash table initialization. And probably will be useful in other cases, when M_WAITOK can't be used. Reviewed by: jhb, kib Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6138
* Revert bus_get_cpus() for now.jhb2016-05-032-72/+0
| | | | | I really thought I had run this through the tinderbox before committing, but many places need <sys/types.h> -> <sys/param.h> for <sys/bus.h> now.
* Add a new bus method to fetch device-specific CPU sets.jhb2016-05-022-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bus_get_cpus() returns a specified set of CPUs for a device. It accepts an enum for the second parameter that indicates the type of cpuset to request. Currently two valus are supported: - LOCAL_CPUS (on x86 this returns all the CPUs in the package closest to the device when DEVICE_NUMA is enabled) - INTR_CPUS (like LOCAL_CPUS but only returns 1 SMT thread for each core) For systems that do not support NUMA (or if it is not enabled in the kernel config), LOCAL_CPUS fails with EINVAL. INTR_CPUS is mapped to 'all_cpus' by default. The idea is that INTR_CPUS should always return a valid set. Device drivers which want to use per-CPU interrupts should start using INTR_CPUS instead of simply assigning interrupts to all available CPUs. In the future we may wish to add tunables to control the policy of INTR_CPUS (e.g. should it be local-only or global, should it ignore SMT threads or not). The x86 nexus driver exposes the internal set of interrupt CPUs from the the x86 interrupt code via INTR_CPUS. The ACPI bus driver and PCI bridge drivers use _PXM to return a suitable LOCAL_CPUS set when _PXM exists and DEVICE_NUMA is enabled. They also and the global INTR_CPUS set from the nexus driver with the per-domain set from _PXM to generate a local INTR_CPUS set for child devices. Reviewed by: wblock (manpage) Differential Revision: https://reviews.freebsd.org/D5519
* Issue NOTE_EXTEND when a directory entry is added to or removed fromkib2016-05-021-0/+1
| | | | | | | | the monitored directory as the result of rename(2) operation. The renames staying in the directory are not reported. Submitted by: Vladimir Kondratyev <wulf@cicgroup.ru> MFC after: 2 weeks
* Fix reporting of NOTE_LINK when directory link count changes due tokib2016-05-021-2/+18
| | | | | | | | | rename removing or adding subdirectory entry. Discussed with and tested by: Vladimir Kondratyev <wulf@cicgroup.ru> NetBSD PR: 48958 (http://gnats.netbsd.org/48958) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* sys/kern: spelling fixes in comments.pfg2016-04-2944-74/+74
| | | | No functional change.
* sys/kern: spelling fixes.pfg2016-04-292-14/+14
| | | | | | Mostly on comments but affects some debug messages. MFC after: 2 weeks
* Automate the subr_unit test.asomers2016-04-291-22/+67
| | | | | | | | | | | | | | | | | | | Build and install the subr_unit test program originally written by phk, and run it with the other ATF tests. tests/sys/kern/Makefile * Build and install the subr_unit test as a plain test sys/kern/subr_unit.c * Reduce the default number of repetitions from 100 to 1, and add a command-line parser to override it. * Don't be so noisy by default * Fix an include problem for the test build Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6038
* Expose soaio_enqueue().jhb2016-04-291-1/+1
| | | | | | | This can be used by protocol-specific AIO handlers to queue work to the socket AIO daemon pool. Sponsored by: Chelsio Communications
* Introduce a new protocol hook pru_aio_queue.jhb2016-04-293-0/+13
| | | | | | | This allows a protocol to claim individual AIO requests instead of using the default socket AIO handling. Sponsored by: Chelsio Communications
* bufs: make B_DIRTY and B_PERSISTENT flags availablepfg2016-04-291-2/+1
| | | | | | | It appears these flags were related to ext2fs but are completely unused nowadays. Retire them. Suggested by: mckusick
* INTRNG: Define 'INTR_IRQ_INVALID' constant and use it consistentlymmel2016-04-281-8/+6
| | | | as error indicator.
* GPIO: Add support for gpio pin interrupts.mmel2016-04-281-0/+21
| | | | | | | | | Add new function gpio_alloc_intr_resource(), which allows an allocation of interrupt resource associated to given gpio pin. It also allows to specify interrupt configuration. Note: This functionality is dependent on INTRNG, and must be implemented in each GPIO controller.
* Add a bus_null_rescan() method that always fails with an error.jhb2016-04-271-0/+13
| | | | | Use this in place of kobj_error_method to disable BUS_RESCAN() on PCI drivers that do not use the "standard" scanning algorithm.
* Add 'devctl delete' that calls device_delete_child().jhb2016-04-271-0/+19
| | | | | | | | | | | | | 'devctl delete' can be used to delete a device that is no longer present. As an anti-foot-shooting measure, 'delete' will not delete a device unless it's parent bus says it is no longer present. This can be overridden by passing the force ('-f') flag. Note that this command should be used with care. If a device is deleted that is actually present it can't be resurrected unless the parent bus device's driver supports rescans. Differential Revision: https://reviews.freebsd.org/D6019
* Add a new rescan method to the bus interface.jhb2016-04-272-0/+21
| | | | | | | | The BUS_RESCAN() method rescans a single bus device checking for devices that have been added or removed from the bus. A new 'rescan' command is added to devctl(8) to trigger a rescan. Differential Revision: https://reviews.freebsd.org/D6016
* Delay revmoing the last jail reference in prison_proc_free, and insteadjamie2016-04-271-10/+34
| | | | | | | | | | put it off into the pr_task. This is similar to prison_free, and in fact uses the same task even though they do something slightly different. This resolves a LOR between the process lock and allprison_lock, which came about in r298565. PR: 48471
* posix4_mib: Don't overrun facility_initialized arraycem2016-04-271-3/+3
| | | | | | | | | | The facility_initialized and facility arrays are the same size and were intended to be indexed the same. I believe this mismatch was just a typo/braino in r208731. Reported by: Coverity CID: 1017430 Sponsored by: EMC / Isilon Storage Division
* subr_mbpool: Don't free bogus pointer in error pathscem2016-04-261-4/+1
| | | | | | | | | | | An mbpool is allocated with a contiguous array of mbpages. Freeing an individual mbpage has never been valid. Don't do it. This bug has been present since this code was introduced in r117624 (2003). Reported by: Coverity CID: 1009687 Sponsored by: EMC / Isilon Storage Division
* Use crcopysafe in jail_attach.jamie2016-04-261-7/+5
|
* osd(9): Change array pointer to array pointer type from void*cem2016-04-264-7/+7
| | | | | | | | | | | | | This is a minor follow-up to r297422, prompted by a Coverity warning. (It's not a real defect, just a code smell.) OSD slot array reservations are an array of pointers (void **) but were cast to void* and back unnecessarily. Keep the correct type from reservation to use. osd.9 is updated to match, along with a few trivial igor fixes. Reported by: Coverity CID: 1353811 Sponsored by: EMC / Isilon Storage Division
* Redo the changes to the SYSV IPC sysctl functions from r298585, so theyjamie2016-04-263-83/+50
| | | | | | don't (mis)use sbufs. PR: 48471
* sys: extend use of the howmany() macro when available.pfg2016-04-269-13/+12
| | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
* Add support for RISC-V.br2016-04-261-3/+3
|
* Move arm's devmap to some generic place, so it can be usedbr2016-04-261-0/+322
| | | | | | | | | by other architectures. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D6091 Sponsored by: DARPA, AFRL Sponsored by: HEIF5
* Fix the logic in r298585: shm_prison_cansee returns an errno, so isjamie2016-04-251-1/+1
| | | | | | the opposite of a boolean. PR: 48471
* Encapsulate SYSV IPC objects in jails. Define per-module parametersjamie2016-04-253-113/+1014
| | | | | | | | | | | | | | | | | | | | sysvmsg, sysvsem, and sysvshm, with the following bahavior: inherit: allow full access to the IPC primitives. This is the same as the current setup with allow.sysvipc is on. Jails and the base system can see (and moduly) each other's objects, which is generally considered a bad thing (though may be useful in some circumstances). disable: all no access, same as the current setup with allow.sysvipc off. new: A jail may see use the IPC objects that it has created. It also gets its own IPC key namespace, so different jails may have their own objects using the same key value. The parent jail (or base system) can see the jail's IPC objects, but not its keys. PR: 48471 Submitted by: based on work by kikuchan98@gmail.com MFC after: 5 days
* Use the new PR_METHOD_REMOVE to clean up jail handling in POSIXjamie2016-04-251-72/+12
| | | | message queues.
* Pass the current/new jail to PR_METHOD_CHECK, which pushes the calljamie2016-04-251-47/+58
| | | | | | | | | | | | | | until after the jail is found or created. This requires unlocking the jail for the call and re-locking it afterward, but that works because nothing in the jail has been changed yet, and other processes won't change the important fields as long as allprison_lock remains held. Keep better track of name vs namelc in kern_jail_set. Name should always be the hierarchical name (relative to the caller), and namelc the last component. PR: 48471 MFC after: 5 days
* Add a new jail OSD method, PR_METHOD_REMOVE. It's called when a jail isjamie2016-04-251-8/+41
| | | | | | | | | removed from the user perspective, i.e. when the last pr_uref goes away, even though the jail mail still exist in the dying state. It will also be called if either PR_METHOD_CREATE or PR_METHOD_SET fail. PR: 48471 MFC after: 5 days
* Remove the PR_REMOVE flag, which was meant as a temporary marker forjamie2016-04-251-3/+1
| | | | | | a jail that might be seen mid-removal. It hasn't been doing the right thing since at least the ability to resurrect dying jails, and such resurrection also makes it unnecessary.
* sys: use our roundup2/rounddown2() macros when param.h is available.pfg2016-04-216-7/+7
| | | | | | | | | | rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted.
* Get rid of rctl_lock; use racct_lock where appropriate. The fast pathstrasz2016-04-212-95/+89
| | | | | | | | | | already required both of them, so having a separate rctl_lock didn't buy us anything. Reviewed by: mjg@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5914
* Remove slightly used const values that can be replaced with nitems().pfg2016-04-211-2/+1
| | | | Suggested by: jhb
* Arm and arm64 both have fueword() implemented for some time. Correctkib2016-04-201-2/+2
| | | | | | the comment. Sponsored by: The FreeBSD Foundation
* Indentation issues.pfg2016-04-202-4/+2
| | | | | | Contract some lines leftover from r298310. Mea culpa.
* kern_rctl: Fix resource leak in error pathcem2016-04-201-0/+1
| | | | | | | | | Ordinarily, rctl_write_outbuf frees 'sb'. However, if we are in low memory conditions we skip past the rctl_write_outbuf. In that case, free 'sb'. Reported by: Coverity CID: 1338539 Sponsored by: EMC / Isilon Storage Division
* kernel: use our nitems() macro when it is available through param.h.pfg2016-04-199-34/+21
| | | | | | No functional change, only trivial cases are done in this sweep, Discussed in: freebsd-current
* Fix debugging printf.trasz2016-04-191-2/+3
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* Fix umtx lock/trylock for compat32.kib2016-04-191-2/+2
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days
* Use a loop instead of a goto in sysctl_kern_proc_kstack().markj2016-04-171-6/+3
| | | | MFC after: 3 days
* The struct thread td_estcpu member is only used by the 4BSD scheduler.kib2016-04-174-51/+52
| | | | | | | | | | | | | | | | | | Move it to the struct td_sched for 4BSD, removing always present field, otherwise unused for ULE. New scheduler method sched_estcpu() returns the estimation for kinfo_proc consumption. As before, it always returns 0 for ULE. Remove sched_tick() scheduler method, unused both by 4BSD and ULE. Update locking comment for the 4BSD struct td_sched, copying it from the same comment for ULE. Spell MAXPRI as PRI_MAX_TIMESHARE in the 4BSD comment. Based on some notes from, and reviewed by: bde Sponsored by: The FreeBSD Foundation
* Add 4Kn kernel dump supportcem2016-04-152-19/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | (And 4Kn minidump support, but only for amd64.) Make sure all I/O to the dump device is of the native sector size. To that end, we keep a native sector sized buffer associated with dump devices (di->blockbuf) and use it to pad smaller objects as needed (e.g. kerneldumpheader). Add dump_write_pad() as a convenience API to dump smaller objects with zero padding. (Rather than pull in NPM leftpad, we wrote our own.) Savecore(1) has been updated to deal with these dumps. The format for 512-byte sector dumps should remain backwards compatible. Minidumps for other architectures are left as an exercise for the reader. PR: 194279 Submitted by: ambrisko@ Reviewed by: cem (earlier version), rpokala Tested by: rpokala (4Kn/512 except 512 fulldump), cem (512 fulldump) Relnotes: yes Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D5848
* kern: for pointers replace 0 with NULL.pfg2016-04-1513-20/+20
| | | | | | These are mostly cosmetical, no functional change. Found with devel/coccinelle.
* Allocate RACCT/RCTL zones without UMA_ZONE_NOFREE; no idea why it was theretrasz2016-04-152-3/+3
| | | | | | | in the first place. MFC after: 1 month Sponsored by: The FreeBSD Foundation
* Sort variable declarations.trasz2016-04-152-42/+35
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* Create wrappers for uint64_t and int64_t for the tunables. While notimp2016-04-151-0/+46
| | | | strictly necessary, it is more convenient.
* Clean up some style(9) violations.jamie2016-04-143-13/+13
|
* Separate POSIX mqueue objects in jails; actually, separate them by thejamie2016-04-131-6/+119
| | | | | | | jail's root, so jails that don't have their own filesystem directory also won't have their own mqueue namespace. PR: 208082
OpenPOWER on IntegriCloud