aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* top(1): cleanup memory allocation and warningsEitan Adler2018-06-025-25/+22
| | | | | | | | | | | | | | - Prefer calloc over malloc. This is more predicable and we're not in a performance sensitive context. [1] - Remove bogus comment (obsolete from prior commit). [2] - Remove void casts and type casts of NULL - Remove redundant declaration of 'quit' - Add additional const Reported by: kib [1], vangyzen [2] Notes: svn path=/head/; revision=334540
* Included VSX registers in powerpc core dumpsJustin Hibbits2018-06-024-2/+81
| | | | | | | | | | Summary: Included VSX registers in powerpc core dumps (both kernel and gcore) Submitted by: Luis Pires Differential Revision: https://reviews.freebsd.org/D15512 Notes: svn path=/head/; revision=334538
* amd64: add a mild depessimization to rep mov/stos usersMateusz Guzik2018-06-021-0/+16
| | | | | | | | | | | | | | | | | | | | Currently all the primitives are waiting for a rewrite, tidy them up in the meantime. Vast majority of cases pass sizes which are multiple of 8. Which means the following rep stosb/movb has nothing to do. Turns out testing first if there is anything to do is a big win across the board (cpus with and without ERMS, Intel and AMD) while not pessimizing the case where there is work to do. Sample results for zeroing 64 bytes (ops/second): Ryzen Threadripper 1950X 91433212 -> 147265741 Intel(R) Xeon(R) CPU X5675 @ 3.07GHz 90714044 -> 121992888 bzero and bcopy are on their way out and were not modified. Nothing in the tree uses them. Notes: svn path=/head/; revision=334537
* Added ptrace support for reading/writing powerpc VSX registersJustin Hibbits2018-06-025-46/+135
| | | | | | | | | | | | | | Summary: Added ptrace support for getting/setting the remaining part of the VSX registers (the part that's not already covered by FPR or VR registers). This is necessary to add support for VSX registers in debuggers. Submitted by: Luis Pires Differential Revision: https://reviews.freebsd.org/D15458 Notes: svn path=/head/; revision=334535
* Use __builtin for various mem* and b* (e.g. bzero) routines.Mateusz Guzik2018-06-027-21/+12
| | | | | | | | | | | | | | | | | Some of the routines were using artificially limited builtin already, drop the explicit limit. The use of builtins allows quite often allows the compiler to elide the call or most zeroing to begin with. For instance, if the target object is 32 bytes in size and gets zeroed + has 16 bytes initialized, the compiler can just add code to zero out the rest. Note not all the primites have asm variants and some of the existing ones are not optimized. Maintaines are strongly encourage to take a look (regardless of this change). Notes: svn path=/head/; revision=334534
* libkern: tidy up memsetMateusz Guzik2018-06-023-22/+3
| | | | | | | | | | | | | | 1. Remove special-casing of 0 as it just results in an extra function call. This is clearly pessimal. 2. Drop the inline stuff. For the most part it is much better served with __builtin_memset (coming later). 3. Move the declaration to systm.h to match other funcs. Archs are encouraged to implement the variant for their own platform so that this implementation can be dropped. Notes: svn path=/head/; revision=334533
* Don't overflow a buffer if we receive an INIT or INIT-ACK chunkMichael Tuexen2018-06-022-0/+4
| | | | | | | | | | | | | without a RANDOM parameter but with a CHUNKS or HMAC-ALGO parameter. Please note that sending this combination violates the specification. Thnanks to Ronald E. Crane for reporting the issue for the userland stack. MFC after: 3 days Notes: svn path=/head/; revision=334532
* top: add -p option and p command to only show a single processRoman Bogorodskiy2018-06-028-10/+121
| | | | | | | | | | | | | | Allow to show only a single process specified by PID. This could be done either by running top like 'top -p PID' or using the 'p' command inside top. Reviewed by: eadler Approved by: eadler Obtained from: OpenBSD Differential Revision: https://reviews.freebsd.org/D15501 Notes: svn path=/head/; revision=334531
* Improve defaults for per-CPU kernel console colors, especially with 2Bruce Evans2018-06-024-8/+40
| | | | | | | | | | | | | | | | | | | or 4 CPUs. Add a compile-time option SC_KERNEL_CONS_ATTRS to control the defaults. Default to color numbers in reverse order to CPU numbers (instead of in the same order with white first and wrapping to dark grey), so that the brightest bright colors are used first. Don't use dark grey at all; replace it by dark green. Syscons has too many compile-time options, but this one is needed in in case the defaults give something like white on white, or the user really hates this feature and can't wait to turn it off in rc. MFC after: next release? Notes: svn path=/head/; revision=334530
* Use per-CPU attributes earlier.Bruce Evans2018-06-021-7/+16
| | | | | | | | | | | | | | | | The per-CPU ts is not initialized early, so the global kernel ts is used early, but it ony has 1 (normal) attribute. Switch this to the per-CPU attribute. The difference is most visible with EARLY_AP_STARTUP. Change to using the curcpu macro instead of PCPU_GET(cpuid) in 2 places for the above and in 1 other place in my old code in syscons. The function-like spelling is perhaps better for indicating that curcpu is volatile (unlike curthread), but for CPU attributes volatility is a feature. Notes: svn path=/head/; revision=334529
* Oops, the last minute reduction in the clobber list for i386Bruce Evans2018-06-021-1/+1
| | | | | | | | MCOUNT_OVERHEAD() in r334522 was too agressive. Only mcount exit preserves %eax and %edx. Notes: svn path=/head/; revision=334528
* Use stpcpy instead of home grown solutionEitan Adler2018-06-023-24/+11
| | | | Notes: svn path=/head/; revision=334527
* Fix low-level locking during panics.Bruce Evans2018-06-021-2/+8
| | | | | | | | | | | | | | | | | | | | The SCHEDULER_STOPPED() hack breaks locking generally, and mtx_trylock_*() especially. When mtx_trylock_*() returns nonzero, naive code version here trusts it to have worked. But when SCHEDULER_STOPPED() is true, mtx_trylock_*() returns 1 without doing anything. Then mtx_unlock_*() crashes especially badly attempting to unlock iff the error is detected, since mutex unlocking functions don't check SCHEDULER_STOPPED(). syscons already didn't trust mtx_trylock_spin(), but it was missing the logic to turn on sp->kdb_locked when turning off sp->mtx_locked during panics. It also used panicstr instead of SCHEDULER_LOCKED because I thought that panicstr was more fragile. They only differ for a window of lines in panic(), and in broken cases where stop_cpus_hard() in panic() didn't work. Notes: svn path=/head/; revision=334526
* top(1): remove wrapper around putcharEitan Adler2018-06-022-10/+1
| | | | | | | | This appears to have been written for portability which we no longer need. Notes: svn path=/head/; revision=334525
* top(1): const poison part 2Eitan Adler2018-06-023-23/+21
| | | | | | | Further reduce the number of warnings emitted by gcc. Notes: svn path=/head/; revision=334524
* Finish COMPAT_AOUT support for amd64. It wasn't in any amd64 or MIBruce Evans2018-06-024-3/+9
| | | | | | | | | | | | | | | | | | | | file in /sys/conf, so was unavailable in configurations that don't use modules, and was not testable or notable in NOTES. Its normal configuration (not using a module) is still silently deprecated in aout(4) by not mentioning it there. Update i386 NOTES for COMPAT_AOUT. It is not i386-only, or even very MD. Sort its entry better. Finish gzip configuration (but not support) for amd64. gzip is really gzipped aout. It is currently broken even for i386 (a call to vm fails). amd64 has always attempted to configure and test it, but it depends on COMPAT_AOUT (as noted). The bug that it depends on unconfigured files was not detected since it is configured as a device. All other optional image activators are configured properly using an option. Notes: svn path=/head/; revision=334523
* Fix high resolution kernel profiling just enough to not crash at bootBruce Evans2018-06-024-12/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | time, especially for SMP. If configured, it turns itself on at boot time for calibration, so is fragile even if never otherwise used. Both types of kernel profiling were supposed to use a global spinlock in the SMP case. If hi-res profiling is configured (but not necessarily used), this was supposed to be optimized by only using it when necessary, and slightly more efficiently, in asm. But it was not done at all for mcount entry where it is necessary. This caused crashes in the SMP case when either type of profiling was enabled. For mcount exit, it only caused wrong times. The times were wrongest with an i8254 timer since using that requires exclusive access to the hardware. The i8254 timer was too slow to use here 20 years ago and is much less usable now, but it is the default for the SMP case since TSCs weren't invariant when SMP was new. Do the locking in all hi-res SMP cases for simplicity. Calibration uses special asms, and the clobber lists in these were sort of inverted. They contained the arg and return registers which are not clobbered, but on amd64 they didn't contain the residue of the call-used registers which may be clobbered (%r10 and %r11). This usually caused hangs at boot time. This usually affected even the UP case. Notes: svn path=/head/; revision=334522
* top(1): const poisonEitan Adler2018-06-022-8/+9
| | | | | | | | top(1) has a number of issues with writing to const strings. Begin helping this along by marking easy cases as const. Notes: svn path=/head/; revision=334521
* Fix recent breakages of kernel profiling, mostly on i386 (high resolutionBruce Evans2018-06-027-17/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kernel profiling remains broken). memmove() was broken using ALTENTRY(). ALTENTRY() is only different from ENTRY() in the profiling case, and its use in that case was sort of backwards. The backwardness magically turned memmove() into memcpy() instead of completely breaking it. Only the high resolution parts of profiling itself were broken. Use ordinary ENTRY() for memmove(). Turn bcopy() into a tail call to memmove() to reduce complications. This gives slightly different pessimizations and profiling lossage. The pessimizations are minimized by not using a frame pointer() for bcopy(). Calls to profiling functions from exception trampolines were not relocated. This caused crashes on the first exception. Fix this using function pointers. Addresses of exception handlers in trampolines were not relocated. This caused unknown offsets in the profiling data. Relocate by abusing setidt_disp as for pmc although this is slower than necessary and requires namespace pollution. pmc seems to be missing some relocations. Stack traces and lots of other things in debuggers need similar relocations. Most user addresses were misclassified as unknown kernel addresses and then ignored. Treat all unknown addresses as user. Now only user addresses in the kernel text range are significantly misclassified (as known kernel addresses). The ibrs functions didn't preserve enough registers. This is the only recent breakage on amd64. Although these functions are written in asm, in the profiling case they call profiling functions which are mostly for the C ABI, so they only have to save call-used registers. They also have to save arg and return registers in some cases and actually save them in all cases to reduce complications. They end up saving all registers except %ecx on i386 and %r10 and %r11 on amd64. Saving these is only needed for 1 caller on each of amd64 and i386. Save them there. This is slightly simpler. Remove saving %ecx in handle_ibrs_exit on i386. Both handle_ibrs_entry and handle_ibrs_exit use %ecx, but only the latter needed to or did save it. But saving it there doesn't work for the profiling case. amd64 has more automatic saving of the most common scratch registers %rax, %rcx and %rdx (its complications for %r10 are from unusual use of %r10 by SYSCALL). Thus profiling of handle_ibrs_exit_rs() was not broken, and I didn't simplify the saving by moving the saving of these registers from it to the caller. Notes: svn path=/head/; revision=334520
* top(1): clean up a bitEitan Adler2018-06-022-13/+10
| | | | | | | | | | - remove unused defines - use standard defines for STDOUT - don't cast for memset - avoid using (void) cast Notes: svn path=/head/; revision=334519
* top(1): help scan-build along a bitEitan Adler2018-06-022-0/+6
| | | | | | | | Teach scan-build that some arrays are larger than zero, and thus not to warn. Notes: svn path=/head/; revision=334518
* top(1): Use uid_t for uid rather than 'int'Eitan Adler2018-06-028-21/+19
| | | | | | | Remove unneeded define while here. Notes: svn path=/head/; revision=334517
* top(1): Remove now-invalid NOTEEitan Adler2018-06-021-2/+0
| | | | Notes: svn path=/head/; revision=334516
* top(1): avoid casting mallocEitan Adler2018-06-022-8/+8
| | | | Notes: svn path=/head/; revision=334515
* top(1): Use standard boolean rather than homegrown alternativeEitan Adler2018-06-027-64/+58
| | | | Notes: svn path=/head/; revision=334514
* Fix the default number of threads for Flex File layout pNFS client I/O.Rick Macklem2018-06-022-3/+5
| | | | | | | | | | | | | | | The intent was that the default would be based on number of CPUs, but the code disabled using taskqueue() by default. This code is only executed when mounting a NFSv4.1 server that supports the Flexible File layout for pNFS and, since such servers are rare, this change shouldn't result in a POLA violation. (The FreeBSD pNFS server is still a project and the only other one that uses Flexible File layout is being developed by Primary Data and I don't know if they have even shipped any to customers yet.) Found while testing the pNFS server. Notes: svn path=/head/; revision=334511
* top(1): remove two unneeded headersEitan Adler2018-06-021-2/+0
| | | | Notes: svn path=/head/; revision=334510
* top(1): ansify, style(9). and nitsEitan Adler2018-06-028-205/+64
| | | | | | | | | | - Prefer using ansi prototypes rather than C prototypes - Keep type on separate line from name of function - Try to keep things const where possible. This will help get to WARNS=6 - switch to "bool" where it makes sense Notes: svn path=/head/; revision=334509
* Remove the "pass" variable from the page daemon control loop.Mark Johnston2018-06-021-48/+41
| | | | | | | | | | | | | It serves little purpose after r308474 and r329882. As a side effect, the removal fixes a bug in r329882 which caused the page daemon to periodically invoke lowmem handlers even in the absence of memory pressure. Reviewed by: jeff Differential Revision: https://reviews.freebsd.org/D15491 Notes: svn path=/head/; revision=334508
* Only check for MAP_32BIT when available.Konstantin Belousov2018-06-011-1/+4
| | | | | | | | | Reported by: mmacy Sponsored by: The FreeBSD Foundation MFC after: 10 days Notes: svn path=/head/; revision=334507
* Avoid completing I/O when dumping core after a panic.Mark Johnston2018-06-011-0/+13
| | | | | | | | | | | | | | | Filesystem or pager completion callbacks are generally non-functional after a panic and may trigger deadlocks if invoked in this context (e.g., by attempting to destroying a buffer mapping). To avoid this situation, short-circuit I/O completion in biodone(). Reviewed by: imp Discussed with: mav MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D15592 Notes: svn path=/head/; revision=334506
* Don't export _end on arm64 and riscv.Mark Johnston2018-06-012-2/+0
| | | | | | | | | | These platforms don't support brk() and sbrk(), which are the reason for exporting _end in the first place. MFC after: 1 week Notes: svn path=/head/; revision=334505
* Remove an inaccuracy from mincore.2.Mark Johnston2018-06-011-2/+4
| | | | | | | | | | | Super pages are supported on non-x86 architectures, so just remove the incorrect note. While here, change terminology to be consistent with mmap.2. MFC after: 1 week Notes: svn path=/head/; revision=334504
* at.man: Bump .Dd missed in r334502Conrad Meyer2018-06-011-1/+1
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=334503
* Update other man pages to match leap second realityConrad Meyer2018-06-013-6/+6
| | | | | | | | | | | Missed these in r334501; see justification there: https://svnweb.freebsd.org/base?view=revision&revision=334501 Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=334502
* touch.1: Update to conform to POSIX 2004Conrad Meyer2018-06-011-20/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX borrowed the "double leap second" bug from C89. Double leap seconds can never happen. This mistake was present in at least POSIX 1997 and fixed by POSIX 2004. I can't find a copy of 2001 online to determine if the bug was present in that revision. While here, remove duplicate language between -d and -t. A few other minor enhancements and an igor (lint) bugfix. Further reading: 2018 POSIX (documents -d): http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html 2004 POSIX (documents SS from 0-60): http://pubs.opengroup.org/onlinepubs/009695399/utilities/touch.html 1997 POSIX/SUSv2 (historical interest, 0-61): http://pubs.opengroup.org/onlinepubs/007908799/xcu/touch.html More on this subject (start at "Unix system time and the POSIX standard") https://www.ucolick.org/~sla/leapsecs/onlinebib.html And: https://marc.info/?l=openbsd-tech&m=92682843416159&w=2 Reported by: Vishal Sahu <vsahu AT isilon.com> Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=334501
* Remove support for SYS_sys_exit in favor of SYS_exit.Brooks Davis2018-06-012-8/+0
| | | | | | | | SYS_exit has been defined in the repo since 1994 except for a brief window when SYS_sys_exit was defined in 2000. Notes: svn path=/head/; revision=334500
* Only a small subset of mmap(2)'s flags should be used in combination withAlan Cox2018-06-011-2/+2
| | | | | | | | | | | | | | | the flag MAP_GUARD. Rather than enumerating the flags that are not allowed, enumerate the flags that are allowed. The list of allowed flags is much shorter and less likely to change. (As an aside, one of the previously enumerated flags, MAP_PREFAULT, was not even a legal flag for mmap(2). However, because of an earlier check within kern_mmap(), this misuse of MAP_PREFAULT was harmless.) Reviewed by: kib MFC after: 10 days Notes: svn path=/head/; revision=334499
* Increase powerpc64 KVA from ~7.25GB to 32GBJustin Hibbits2018-06-011-1/+1
| | | | | | | | | | This will let us use much more KVA for ZFS ARC where needed. This may be incresed in the future if memory requirements increase. Discussed with: nwhitehorn Notes: svn path=/head/; revision=334498
* Limit the retransmission timer for SYN-ACKs by TCPTV_REXMTMAX.Michael Tuexen2018-06-011-2/+8
| | | | | | | | | | | Use the same logic to handle the SYN-ACK retransmission when sent from the syn cache code as when sent from the main code. MFC after: 3 days Sponsored by: Netflix, Inc. Notes: svn path=/head/; revision=334497
* audit(4): add tests for the fd audit classAlan Somers2018-06-012-0/+274
| | | | | | | | | | | | | | The only syscalls in this class are rmdir, unlink, unlinkat, rename, and renameat. Also, set is_exclusive for all audit(4) tests, because they can start and stop auditd. Submitted by: aniketp MFC after: 2 weeks Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15647 Notes: svn path=/head/; revision=334496
* indent(1): improve an error messagePiotr Pawel Stefaniak2018-06-011-1/+1
| | | | | | | | When producing a "[...] requires a parameter" error, provide the recognized name of the option instead of argument provided. Notes: svn path=/head/; revision=334495
* Ensure net.inet.tcp.syncache.rexmtlimit is limited by TCP_MAXRXTSHIFT.Michael Tuexen2018-06-011-1/+20
| | | | | | | | | | | | If the sysctl variable is set to a value larger than TCP_MAXRXTSHIFT+1, the array tcp_syn_backoff[] is accessed out of bounds. Discussed with: jtl@ MFC after: 3 days Sponsored by: Netflix, Inc. Notes: svn path=/head/; revision=334494
* indent(1): restore working -pcsPiotr Pawel Stefaniak2018-06-016-1/+23
| | | | | | | | | | | | | | My previous indent(1) commit accidentally broke the -pcs option (which adds space between function name and opening parenthesis in function calls) by copying all but one of a few conditions in an if clause. Reinstate the condition. Add a regression test to lower the chances of breaking it again. Correct a comment with description of what the option does. Notes: svn path=/head/; revision=334493
* Add the BindConnectiontoSession operation to the NFSv4.1 server.Rick Macklem2018-06-017-7/+144
| | | | | | | | | | | | | | Under some fairly unusual circumstances, the Linux NFSv4.1 client is doing a BindConnectiontoSession operation for TCP connections. It is also used by the ESXi6.5 NFSv4.1 client. This patch adds this operation to the NFSv4.1 server. Reported by: andreas.nagy@frequentis.com Tested by: andreas.nagy@frequentis.com MFC after: 2 weeks Notes: svn path=/head/; revision=334492
* Add PNP_INFO to aacWarner Losh2018-06-011-0/+2
| | | | | | | | | Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com> Sponsored by: Google, Inc. (GSoC 2018) Notes: svn path=/head/; revision=334491
* Update the sysctl(9) manpage to indicate that <sys/param.h> is requiredJonathan T. Looney2018-06-011-2/+2
| | | | | | | | | | instead of <sys/types.h>. (<sys/sysctl.h> includes NULL, which is defined with <sys/param.h> and not <sys/types.h>.) Sponsored by: Netflix Notes: svn path=/head/; revision=334490
* cxgbe(4): Include full duplex mediaopt in media that can be reported asNavdeep Parhar2018-06-011-5/+5
| | | | | | | | | active. Always report full duplex in active media. Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=334489
* Unbreak 32-bit binaries on powerpc64Justin Hibbits2018-06-011-0/+4
| | | | | | | | | | | | | | | Recently a change was made which broke loading 32-bit binaries on powerpc64, with an assertion in ld-elf32.so.1: ld-elf32.so.1: assert failed: /usr/local/poudriere/jails/ppc64/usr/src/libexec/rtld-elf/rtld.c:390 It turns out Elf32_AuxInfo was broken for a very long time on powerpc64, as it uses long and pointers, which are both 64 bits on powerpc64, and only manifested with the recent work on auxargs. Notes: svn path=/head/; revision=334488
* audit(4): Add tests for the fw class of syscalls.Alan Somers2018-06-012-0/+142
| | | | | | | | | | | | | | truncate and ftruncate are the only syscalls in this class, apart from certain variations of open and openat, which will be handled in a different file. Submitted by: aniketp MFC after: 2 weeks Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15640 Notes: svn path=/head/; revision=334487