summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* MFC r312991: put very expensive sanity checks of advisory locks under DIAGNOSTICavg2017-02-141-2/+2
| | | | Sponsored by: Panzura
* MFC r310096: reaper: Make REAPER_KILL_SUBTREE actually work.jilles2017-02-051-1/+1
|
* MFC r312647:kib2017-01-291-0/+15
| | | | | Add comments explaining unobvious td_critnest adjustments in critical_exit().
* MFC r312532: don't abort writing of a core dump after EFAULTavg2017-01-261-1/+32
| | | | | | Note that this change substantially differs from the change in head because of an unmerged earlier change that probably can not be merged for POLA reasons.
* MFC r312426: fix a thread preemption regression in schedulers introducedavg2017-01-232-4/+4
| | | | in r270423
* MFC r311963: Remove writability requirement for single-mbuf, contiguous-rpokala2017-01-191-1/+1
| | | | | | | | | | range m_pulldown() m_pulldown() only needs to determine if a mbuf is writable if it is going to copy data into the data region of an existing mbuf. It does this to create a contiguous data region in a single mbuf from multiple mbufs in the chain. If the requested memory region is already contiguous and nothing needs to change, the mbuf does not need to be writeable.
* MFC r312113:ngie2017-01-171-6/+6
| | | | Clean up trailing whitespace
* MFC r311447:kib2017-01-121-2/+2
| | | | Some style fixes for getfstat(2)-related code.
* MFC r311113:kib2017-01-091-6/+4
| | | | | There is no need to use temporary statfs buffer for fsid obliteration and prison enforcement. Do it on the caller buffer directly.
* MFC r311111:kib2017-01-091-1/+1
| | | | Style.
* MFC r311108:kib2017-01-091-65/+41
| | | | Move common code from kern_statfs() and kern_fstatfs() into a new helper.
* MFC r310615:kib2017-01-091-11/+2
| | | | Change knlist_destroy() to assertion.
* MFC r310613:kib2017-01-021-11/+7
| | | | Style.
* MFC r310554:kib2017-01-011-24/+28
| | | | Some optimizations for kqueue timers.
* MFC r310552:kib2017-01-011-5/+5
| | | | Some style.
* MFC r285706,r303562,r303563,r303584,r303643,r303652,r303655,r303707:mjg2016-12-314-64/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (by markj) Don't increment the spin count until after the first attempt to acquire a rwlock read lock. Otherwise the lockstat:::rw-spin probe will fire spuriously. == rwlock: s/READER/WRITER/ in wlock lockstat annotation == sx: increment spin_cnt before cpu_spinwait in xlock The change is a no-op only done for consistency with the rest of the file. == locks: change sleep_cnt and spin_cnt types to u_int Both variables are uint64_t, but they only count spins or sleeps. All reasonable values which we can get here comfortably hit in 32-bit range. == Implement trivial backoff for locking primitives. All current spinning loops retry an atomic op the first chance they get, which leads to performance degradation under load. One classic solution to the problem consists of delaying the test to an extent. This implementation has a trivial linear increment and a random factor for each attempt. For simplicity, this first thouch implementation only modifies spinning loops where the lock owner is running. spin mutexes and thread lock were not modified. Current parameters are autotuned on boot based on mp_cpus. Autotune factors are very conservative and are subject to change later. == locks: fix up ifdef guards introduced in r303643 Both sx and rwlocks had copy-pasted ADAPTIVE_MUTEXES instead of the correct define. == locks: fix compilation for KDTRACE_HOOKS && !ADAPTIVE_* case == locks: fix sx compilation on mips after r303643 The kernel.h header is required for the SYSINIT macro, which apparently was present on amd64 by accident.
* MFC r301157:mjg2016-12-314-9/+25
| | | | | | | | | | Microoptimize locking primitives by avoiding unnecessary atomic ops. Inline version of primitives do an atomic op and if it fails they fallback to actual primitives, which immediately retry the atomic op. The obvious optimisation is to check if the lock is free and only then proceed to do an atomic op.
* MFC r309886:kib2016-12-261-0/+5
| | | | | When a zombie gets reparented due to the parent exit, send SIGCHLD to the reaper.
* MFC r310302:kib2016-12-261-2/+6
| | | | | | Do not clear KN_INFLUX when not owning influx state. PR: 214923
* MFC r310159:kib2016-12-231-7/+5
| | | | Switch from stdatomic.h to atomic.h for kernel.
* MFC r296775 (by gibbs):kib2016-12-161-17/+42
| | | | | | Provide high precision conversion from ns,us,ms -> sbintime in kevent. Tested by: ian
* MFC r309676vangyzen2016-12-151-1/+9
| | | | | | | | | | | | | Export the whole thread name in kinfo_proc kinfo_proc::ki_tdname is three characters shorter than thread::td_name. Add a ki_moretdname field for these three extra characters. Add the new field to kinfo_proc32, as well. Update all in-tree consumers to read the new field and assemble the full name, except for lldb's HostThreadFreeBSD.cpp, which I will handle separately. Bump __FreeBSD_version. Sponsored by: Dell EMC
* MFC r309460vangyzen2016-12-151-2/+5
| | | | | | | | | | | | | | | thr_set_name(): silently truncate the given name as needed Instead of failing with ENAMETOOLONG, which is swallowed by pthread_set_name_np() anyway, truncate the given name to MAXCOMLEN+1 bytes. This is more likely what the user wants, and saves the caller from truncating it before the call (which was the only recourse). The man page changes were not merged because thr_set_name.2 does not exist on stable/10. Sponsored by: Dell EMC
* MFC r308350:markj2016-12-121-2/+2
| | | | Fix WITNESS hints for pagequeue locks.
* MFC 308564: Don't place threads on the run queue after waking up other CPUs.jhb2016-12-021-49/+13
| | | | | | | | | | | | | | The other CPU might resume and see a still-empty runq and go back to sleep before sched_add() adds the thread to the runq. This results in a lost wakeup and a potential hang if the system is otherwise completely idle. The race originated due to a micro-optimization (my fault) in 4BSD in that it avoided putting a thread on the run queue if the scheduler was going to preempt to the new thread. To avoid complexity while fixing this race, just drop this optimization. 4BSD now always sets the "owepreempt" flag when a preemption is warranted and defers the actual preemption to the thread_unlock of the caller the same as ULE.
* MFH: r306306julian2016-12-021-2/+2
| | | | | | Give the user a clue as to which process hit maxfiles. Sponsored by: Panzura
* MFC r308618:kib2016-11-271-0/+6
| | | | | Provide simple mutual exclusion between mount point update and unmount. In the update path in ffs_mount(), drop vfs_busy() reference around namei().
* MFC r308642:kib2016-11-211-6/+5
| | | | | | Initialize reserved bytes in struct mq_attr. PR: 214488
* MFC r308228:kib2016-11-091-7/+1
| | | | Remove remnants of the recursive sleep support.
* MFC r308211:kib2016-11-091-4/+4
| | | | Remove tautological casts.
* MFC r307518:hselasky2016-11-071-3/+5
| | | | | | | | | | | | | | | | | | | | | Fix device delete child function. When detaching device trees parent devices must be detached prior to detaching its children. This is because parent devices can have pointers to the child devices in their softcs which are not invalidated by device_delete_child(). This can cause use after free issues and panic(). Device drivers implementing trees, must ensure its detach function detaches or deletes all its children before returning. While at it remove now redundant device_detach() calls before device_delete_child() and device_delete_children(), mostly in the USB controller drivers. Tested by: Jan Henrik Sylvester <me@janh.de> Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D8070
* MFC r288990:avos2016-11-061-0/+5
| | | | | | | | Fix regression from r248371. We need to copy packet header to new mbuf. Unlike in the pre-r248371 code, assert that M_PKTHDR is set only on a first mbuf. PR: 195074
* MFC 297776,297777,297779: Add DDB commands to cxgbe(4).jhb2016-11-041-6/+16
| | | | | | | | | | | | | | | | | | | | | | | 297776: Add a function to lookup a device_t object by name. This just walks the global list of devices looking for one with the requested name. The one use case outside of devctl2's implementation is for DDB commands that wish to lookup devices by name. 297777: Add a 'show t4 tcb <nexus> <tid>' command to dump a TCB from DDB. This allows the contents of a TCB to be extracted from a T4/T5 card in DDB after a panic. 297779: Add a 'show t4 devlog <nexus>' DDB command. This command displays the adapter's firmware device log similar to the dev.<nexus>.misc.devlog sysctl. Sponsored by: Chelsio Communications
* MFC r307821:kib2016-10-301-1/+1
| | | | | | Use proper type for local variable. PR: 212520
* MFC 303002: Include process IDs in core dumps.jhb2016-10-281-0/+1
| | | | | | | | | When threads were added to the kernel, the pr_pid member of the NT_PRSTATUS note was repurposed to store LWP IDs instead of process IDs. However, the process ID was no longer recorded in core dumps. This change adds a pr_pid field to prpsinfo (NT_PRSINFO). Rather than bumping the prpsinfo version number, note parsers can use the note's payload size to determine if pr_pid is present.
* MFC r307522: makesyscalls.sh: remove trailing space on the "created from" lineemaste2016-10-241-2/+1
| | | | | | | | | | | | | | | | | | | In r10905 and r10906 makesyscalls was modified to avoid emitting a literal $Id$ string in the generated file, with: gsub("[$]Id: ", "", $0) gsub(" [$]", "", $0) Then r11294 added some functionality and also tried to address the $Id$ problem in a different way, by removing every $: sed -e 's/\$//g ... This rendered the gsub infeffective. The gsub was later updated to track the $Id$ -> $FreeBSD$ switch, even though it did not do anything. Revert the addition of the s/\$//g, and update the gsub to keep the resulting format the same.
* MFC r307218:kib2016-10-201-2/+2
| | | | Fix a race in vm_page_busy_sleep(9).
* MFC r306346vangyzen2016-10-191-1/+1
| | | | | | | | Make no assertions about mutex state when the scheduler is stopped. This changes the assert path to match the lock and unlock paths. Sponsored by: Dell EMC
* wait: Do not copyout uninitialized status/rusage/wrusage.jilles2016-10-111-4/+4
| | | | | | | | If wait4() or wait6() return 0 because of WNOHANG, the status, rusage and wrusage information should not be returned. PR: 212048 Reported by: Casey Lucas
* MFC r306441 and r306634:hselasky2016-10-101-1/+22
| | | | | | | | | | | | | | | | | | | | | | | While draining a timeout task prevent the taskqueue_enqueue_timeout() function from restarting the timer. Commonly taskqueue_enqueue_timeout() is called from within the task function itself without any checks for teardown. Then it can happen the timer stays active after the return of taskqueue_drain_timeout(), because the timeout and task is drained separately. This patch factors out the teardown flag into the timeout task itself, allowing existing code to stay as-is instead of applying a teardown flag to each and every of the timeout task consumers. Add assert to taskqueue_drain_timeout() which prevents parallel execution on the same timeout task. Update manual page documenting the return value of taskqueue_enqueue_timeout(). Differential Revision: https://reviews.freebsd.org/D8012 Reviewed by: kib, trasz
* While the thread is sleeping in taskqueue_drain_all() it isjulian2016-10-101-3/+20
| | | | | | | | | | posible that the queue entry it is looking at is removed from the queue, but we make no effort to account for this. when we wake up we need to check it's still there. PR: 209580 Sponsored by: Panzura inc Differential Revision: D8160
* MFC r306674:kib2016-10-071-3/+2
| | | | Style.
* MFC 302859: Include command line arguments in core dump process info.jhb2016-10-061-7/+41
| | | | | Fill in pr_psargs in the NT_PRSINFO ELF core dump note with command line arguments.
* MFC 305034: Implement 'devctl clear driver' to undo a previous 'set driver'.jhb2016-09-301-0/+20
| | | | | | | | | | | Add a new 'clear driver' command for devctl along with the accompanying ioctl and devctl_clear_driver() library routine to reset a device to use a wildcard devclass instead of a fixed devclass. This can be used to undo a previous 'set driver' command. After the device's name has been reset to permit wildcard names, it is reprobed so that it can attach to newly-available (to it) device drivers. Sponsored by: Chelsio Communications
* MFC r299064royger2016-09-301-1/+1
| | | | rtc: fix inverted resolution check
* MFC r301522 (by bz)hiren2016-09-162-0/+48
| | | | | | | | | | | | | Implement a `show panic` command to DDB which will helpfully print the panic string again if set, in case it scrolled out of the active window. This avoids having to remember the symbol name. Also add a show callout <addr> command to DDB in order to inspect some struct callout fields in case of panics in the callout code. This may help to see if there was memory corruption or to further ease debugging problems. No objection by: bz
* Regen after r305518: Allow getdtablesize in capability modeemaste2016-09-071-1/+1
|
* MFC r305140: Allow getdtablesize in capability modeemaste2016-09-071-0/+1
|
* MFC r285522:markj2016-09-022-15/+45
| | | | | | | | | Fix cleanup race between unp_dispose and unp_gc. This change modifies the original commit to avoid changing the domain_dispose KPI. Tested by: Oliver Pinter
* MFC r304812:kib2016-09-011-6/+12
| | | | | In both do_rw_wrlock() and do_rw_rdlock(), do not obliterate possible error from sleep.
OpenPOWER on IntegriCloud