path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* loader: remove BORDER_PIXELSToomas Soome2021-02-091-1/+0
| | | | | | | | BORDER_PIXELS is left over from picking up the source from illumos port. Since FreeBSD VT does not use border in terminal size calculation, there is no reason why should loader use it. MFC after: 1 week
* kern: sonewconn: set so_options before pru_attach()Kyle Evans2021-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | Protocol attachment has historically been able to observe and modify so->so_options as needed, and it still can for newly created sockets. 779f106aa169 moved this to after pru_attach() when we re-acquire the lock on the listening socket. Restore the historical behavior so that pru_attach implementations can consistently use it. Note that some pru_attach() do currently rely on this, though that may change in the future. D28265 contains a change to remove the use in TCP and IB/SDP bits, as resetting the requested linger time on incoming connections seems questionable at best. This does move the assignment out from under the head's listen lock, but glebius notes that head won't be going away and applications cannot assume any specific ordering with a race between a connection coming in and the application changing socket options anyways. Discussed-with: glebius MFC-after: 1 week
* devfs: fix use count leak when using TIOCSCTTYMateusz Guzik2021-02-091-1/+1
| | | | | | by matching devfs_ctty_ref Fixes: 3b44443626603f65 ("devfs: rework si_usecount to track opens")
* Simplify the FreeBSD check using __FreeBSD__ compiler macro.Cy Schubert2021-02-0918-59/+59
| | | | | | | | Rather than rely on __FreeBSD_version, defined in sys/param.h, use __FreeBSD__ defined by the compiler. Reported by: emaste MFC after: 1 week
* ZFS: fix assertions with INVARIANTSAlan Somers2021-02-081-0/+2
| | | | | | | | | | | AFAICT, this was an oversight from 9e5787d2284e187abb5b654d924394a65772e004 (svn r364746). That revision inadvertently disabled assertions unconditionally. Reviewed by: freqlabs MFC after: 3 days Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D28256
* Revert "SO_RERROR indicates that receive buffer overflows should be handled ↵Alexander V. Chernikov2021-02-0819-79/+33
| | | | | | | | as errors." Wrong version of the change was pushed inadvertenly. This reverts commit 4a01b854ca5c2e5124958363b3326708b913af71.
* hid: bump HID_ITEM_MAXUSAGES to 8Warner Losh2021-02-081-1/+1
| | | | | | | | | | | My YOGA requires a minimum of 7 to parse w/o an error. Since the memory savings are trivial and the yoga a popular system, bump the default up to 8. There's no API/ABI issues in doing this. This hid_item struct isn't exported to userland and the one libusbhid has is different and only shares a name... MFC After: 3 days Reviewed by: wulf@ Differential Revision: https://reviews.freebsd.org/D28543
* acpi: limit the AMDI0020/AMDI0010 workaround to an optionWarner Losh2021-02-082-0/+4
| | | | | | | | | | | | | It appears that production versions of EPYC firmware get the _STA method right for these nodes. In fact, this workaround breaks on production hardware by including too many uart nodes. This work around was for pre-release hardware that wound up not having a large deployment. Move this work around to a kernel option since the machines that needed it have been powered off and are difficult to resurrect. Should there be a more significant deployment than is understood, we can restrict it based on smbios strings. Discussed with: mmacy@, seanc@, jhb@ MFC After: 3 days
* Turn off forgotten multipath debug messagesAlexander V. Chernikov2021-02-081-1/+0
| | | | | Reported by: mike tancsa<mike at sentex.net> MFC after: 3 days
* SO_RERROR indicates that receive buffer overflows should be handled as errors.Alexander V. Chernikov2021-02-0819-33/+79
| | | | | | | | | | | | Historically receive buffer overflows have been ignored and programs could not tell if they missed messages or messages had been truncated because of overflows. Since programs historically do not expect to get receive overflow errors, this behavior is not the default. This is really really important for programs that use route(4) to keep in sync with the system. If we loose a message then we need to reload the full system state, otherwise the behaviour from that point is undefined and can lead to chasing bogus bug reports.
* wsp: Add sysctl tunable for Z-Axis inversionVladimir Kondratyev2021-02-081-1/+6
| | | | | | | | | | This adds a new sysctl to Wellspring Touchpad driver for controlling Z-Axis (2-finger vertical scroll) direction "hw.usb.wsp.z_invert". Submitted by: James Wright <james.wright_AT_digital-chaos_DOT_com> Reviewed by: wulf PR: 253321 Differential revision: https://reviews.freebsd.org/D28521
* nvme: Make nvme_ctrlr_hw_reset staticWarner Losh2021-02-082-2/+1
| | | | | nvme_ctrlr_hw_reset is no longer used outside of nvme_ctrlr.c, so make it static. If we need to change this in the future we can.
* nvme: use NVME_GONE rather than hard-coded 0xffffffffWarner Losh2021-02-083-4/+6
| | | | | Make it clearer that the value 0xfffffff is being used to detect the device is gone. We use it other places in the driver for other meanings.
* mca: Handle inconsistent CMCI capability reportingMark Johnston2021-02-081-0/+18
| | | | | | | | | | | | A BIOS bug may apparently cause the BSP to report that it does not implement CMCI, with some APs reporting that they do. In this scenario, avoid a NULL pointer dereference that occurs in cmci_monitor() because cmc_state was not allocated by the BSP. PR: 253272 Reported by: asomers, mmacy Reviewed by: kib (previous version) MFC after: 1 week
* amd64: fix up a braino in strlen commentMateusz Guzik2021-02-081-1/+1
* amd64: implement strlen in assemblyMateusz Guzik2021-02-088-1/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The C variant in libkern performs excessive branching to find the non-zero byte instead of using the bsfq instruction. The same code patched to use it is still slower than the routine implemented here as the compiler keeps neglecting to perform certain optimizations (like using leaq). On top of that the routine can is a starting point for copyinstr which operates on words instead of bytes. Tested with glibc test suite. Sample results (calls/s): Haswell: $(perl -e "print 'A' x 3"): stock: 211198039 patched:338626619 asm: 465609618 $(perl -e "print 'A' x 100"): stock: 83151997 patched: 98285919 asm: 120719888 AMD EPYC 7R32: $(perl -e "print 'A' x 3"): stock: 282523617 asm: 491498172 $(perl -e "print 'A' x 100"): stock: 114857172 asm: 112082057
* Restore the augmented strlen commentaryMateusz Guzik2021-02-081-11/+4
| | | | ... lost in revert
* libkern: use compiler builtins for strcpy, strcmp and strlenMateusz Guzik2021-02-081-0/+4
* vt: terminal size can grow too big with small fontToomas Soome2021-02-081-6/+12
| | | | | | | | | | | | | | vt is using static buffers for on screen data, the buffer size is calculated based on maximum supported screen size and 8x16 font. When using hi-res graphics and very smaller than 8x16 font, we need to be careful not to overflow static buffers in vt. Testing: I did test by building smaller buffers than vt currently is using, royger was testing on actual 4k capable hardware. MFC after: 1 week Tested by: royger
* ktls: Avoid wakeups and locking for synchronous callbacksMark Johnston2021-02-081-7/+18
| | | | | | | | | | | | | | | | | | When performing encryption in software, the KTLS crypto callback always locks the session to deliver a wakeup. But, if we're handling the operation synchronously this is wasted effort and can result in sleepqueue lock contention on large systems. Use CRYPTO_SESS_SYNC() to determine whether the operation will be completed asynchronously or not, and select a callback appropriately. Avoid locking the session to check for completion if the session handles requests synchronously. Reviewed by: jhb Sponsored by: Ampere Computing Submitted by: Klara, Inc. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28195
* opencrypto: Introduce crypto_dispatch_async()Mark Johnston2021-02-088-105/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, OpenCrypto consumers can request asynchronous dispatch by setting a flag in the cryptop. (Currently only IPSec may do this.) I think this is a bit confusing: we (conditionally) set cryptop flags to request async dispatch, and then crypto_dispatch() immediately examines those flags to see if the consumer wants async dispatch. The flag names are also confusing since they don't specify what "async" applies to: dispatch or completion. Add a new KPI, crypto_dispatch_async(), rather than encoding the requested dispatch type in each cryptop. crypto_dispatch_async() falls back to crypto_dispatch() if the session's driver provides asynchronous dispatch. Get rid of CRYPTOP_ASYNC() and CRYPTOP_ASYNC_KEEPORDER(). Similarly, add crypto_dispatch_batch() to request processing of a tailq of cryptops, rather than encoding the scheduling policy using cryptop flags. Convert GELI, the only user of this interface (disabled by default) to use the new interface. Add CRYPTO_SESS_SYNC(), which can be used by consumers to determine whether crypto requests will be dispatched synchronously. This is just a helper macro. Use it instead of looking at cap flags directly. Fix style in crypto_done(). Also get rid of CRYPTO_RETW_EMPTY() and just check the relevant queues directly. This could result in some unnecessary wakeups but I think it's very uncommon to be using more than one queue per worker in a given workload, so checking all three queues is a waste of cycles. Reviewed by: jhb Sponsored by: Ampere Computing Submitted by: Klara, Inc. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28194
* armv8crypto: Extract GCM state into a structureMark Johnston2021-02-081-70/+65
| | | | | | | | | | | | | | This makes it easier to refactor the GCM code to operate on crypto_buffer_cursors rather than plain contiguous buffers, with the aim of minimizing the amount of copying and zeroing done today. No functional change intended. Reviewed by: jhb MFC after: 1 week Sponsored by: Ampere Computing Submitted by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D28500
* armv8crypto: Fix some edge cases in the AES-GCM implementationMark Johnston2021-02-081-18/+29
| | | | | | | | | | | | | | | | | | | | | - We were only hashing up to the first 16 bytes of the AAD. - When computing the digest during decryption, handle the case where len == trailer, i.e., len < AES_BLOCK_LEN, properly. While here: - trailer is always smaller than AES_BLOCK_LEN, so remove a pair of unnecessary modulus operations. - Replace some byte-by-byte loops with memcpy() and memset() calls. In particular, zero the full block before copying a partial block into it since we do that elsewhere and it means that the memset() length is known at compile time. Reviewed by: jhb Sponsored by: Ampere Computing Submitted by: Klara, Inc. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28501
* ktls: Make configuration sysctls available as tunablesMark Johnston2021-02-081-2/+2
| | | | | | | | Reviewed by: gallatin, jhb Sponsored by: Ampere Computing Submitted by: Klara, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28499
* ktls: Use COUNTER_U64_DEFINE_EARLYMark Johnston2021-02-082-70/+28
| | | | | | | | | | | This makes it a bit more straightforward to add new counters when debugging. No functional change intended. Reviewed by: jhb Sponsored by: Ampere Computing Submitted by: Klara, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28498
* netgraph/ng_base: Allow larger BINARY2ASCII conversionsLutz Donnerhacke2021-02-081-5/+9
| | | | | | | | | Allocate the necessary memory for the conversion dynamically starting with a value which is sufficient for almost all normal cases. PR: 187835 Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D23840
* arm64: optimize set_syscall_retval()Edward Tomasz Napierala2021-02-081-3/+5
| | | | | | | | | Microoptimize set_syscall_retval() for arm64 by predicting the return value to be zero. This is similar to what has been done for other architectures Reviewed By: emaste, mhorne Differential Revision: https://reviews.freebsd.org/D26991
* epoll: Store epoll_event udata member in ext member of kevent.Vladimir Kondratyev2021-02-073-99/+11
| | | | | | | | | | | | | | | | | | | | Current epoll implementation stores udata fields of epoll_event structure in special dynamically-sized table rather than in udata field of backing kevent structure because of 2 reasons: 1. Kevent's udata size is smaller than epoll's on 32-bit archs. 2. Kevent's udata can be clobbered on execution EPOLL_CTL_ADD as kqueue modifies existing event while epoll returns error in this case. After r320043 has introduced four new 64bit user data members (ext[]), we can store epoll udata in one of them and drop aforementioned table. According to kqueue_register() source code ext members are not updated when existing kevent is modified that fixes p.2. As a side effect the patch fixes PR/252582. Reviewed by: trasz MFC after: 1 month Differential revision: https://reviews.freebsd.org/D28169
* powerpc64: Fix boot on virtual-mode OF (PowerMac G5)Brandon Bergren2021-02-071-0/+10
| | | | | | | | | | | | | | | | In 78599c32efed3247d165302a1fbe8d9203e38974, CFI endproc decoration was added to locore64.S. However, it missed the subtle detail that __restartkernel_virtual() falls through to __restartkernel(). This was causing boot failure on PowerMac G5, as it tried to execute the epilogue as code. Fix this by branching to __restartkernel() instead of intentionally running off the end of the function. While here, add some additional notes on how the virtual mode restart works. MFC after: 3 days
* linux: add support for SO_PEERSEC getsockoptEdward Tomasz Napierala2021-02-072-0/+27
| | | | | | | It returns "unconfined", like Linux without SELinux would. Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28164
* netgraph/ng_bridge: Make simple internal functions read-onlyLutz Donnerhacke2021-02-073-6/+15
| | | | | | | | | | | | | | | The data path in netgraph is designed to work on an read only state of the whole netgraph network. Currently this is achived by convention, there is no technical enforcment. In the case of NETGRAPH_DEBUG all nodes can be annotated for debugging purposes, so the strict enforcment needs to be lifted for this purpose. This patch is part of a series to make ng_bridge multithreaded, which is done by rewrite the data path to operate on const. Reviewed By: kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28141
* Revert "netgraph/ng_bridge: Make simple internal functions read-only"Lutz Donnerhacke2021-02-073-11/+6
| | | | | | Patch mass breaks LINT kernels. This reverts commit bb67e52db143b699bdac1830717930b26a7b5766.
* netgraph/ng_bridge: Make simple internal functions read-onlyLutz Donnerhacke2021-02-073-6/+11
| | | | | | | | | | | | The data path in netgraph is designed to work on an read only state of the whole netgraph network. Currently this is achived by convetion, there is no technical enforcment. This patch is part of a series to make ng_brigde multithreaded, which is done by rewrite the data path to const handling. Reviewed By: kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28141
* netgraph/ng_bridge: Remove old table ABILutz Donnerhacke2021-02-072-112/+0
| | | | | | | | | | | | | This was announced to happen after the 12 relases. Remove a depeciated ABI. The complete removal is for HEAD only. I'll remove the #define in stable/13 as MFC, so the code will still exist in 13.x, but will not included by default. Earlier versions will not be affected. Reviewed by: kp MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D28518
* linux: fix handling of flags for 32 bit send(2) syscallEdward Tomasz Napierala2021-02-061-1/+1
| | | | | | | | | | | | | Previously the flags were passed as-is, which could resulted in spurious EAGAIN returned for non-blocking sockets, which broke some Steam games. PR: 248065 Reported By: Alex S <iwtcex@gmail.com> Tested By: Alex S <iwtcex@gmail.com> Reviewed By: emaste MFC After: 3 days Sponsored By: The FreeBSD Foundation
* netgraph/ng_bridge: switch stats to counter frameworkLutz Donnerhacke2021-02-061-25/+108
| | | | | | | | | This is the first patch of a series of necessary steps to make ng_bridge(4) multithreaded. Reviewed by: melifaro (network), afedorov MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D28125
* netgraph/ng_bridge: Derive forwarding mode from first attached hookLutz Donnerhacke2021-02-061-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Handling of unknown MACs on an bridge with incomplete learning capabilites (aka uplink ports) can be defined in different ways. The classical approach is to broadcast unicast frames send to an unknown MAC, because the unknown devices can be everywhere. This mode is default for ng_bridge(4). In the case of dedicated uplink ports, which prohibit learning of MAC addresses in order to save memory and CPU cycles, the broadcast approach is dangerous. All traffic to the uplink port is broadcasted to every downlink port, too. In this case, it's better to restrict the distribution of frames to unknown MAC to the uplink ports only. In order to keep the chance small and the handling as natural as possible, the first attached link is used to determine the behaviour of the bridge: If it is an "uplink" port, then the bridge switch from classical mode to restricted mode. Reviewed By: kp Approved by: kp (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28487
* netgraph/ng_bridge: Introduce "uplink" ports without MAC learningLutz Donnerhacke2021-02-062-35/+62
| | | | | | | | | | | | | | | | | | | | | The ng_bridge(4) node is designed to work in moderately small environments. Connecting such a node to a larger network rapidly fills the MAC table for no reason. It even become complicated to obtain data from the gettable message, because the result is too large to transmit. This patch introduces, two new functionality bits on the hooks: - Allow or disallow MAC address learning for incoming patckets. - Allow or disallow sending unknown MACs through this hook. Uplinks are characterized by denied learing while sending out unknowns. Normal links are charaterized by allowed learning and sending out unknowns. Reviewed by: kp Approved by: kp (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D23963
* ipfilter: Use the softn (NAT softc) host map size in ip_nat6 calculation.Cy Schubert2021-02-061-1/+1
| | | | | | | | | | | | The ipfilter NAT table host map size is a tunable that defaults to a macro value defined at build time. HOSTMAP_SIZE is saved in softn (the ipnat softc) at initialization. It can be tuned (changed) at runtime using the ipf -T command. If the hostmap_size tunable is adjusted the calculation to determine where to put new entries in the table was incorrect. Use the tunable in the NAT softc instead of the static build time value. MFC after: 1 week
* Simplify BSD macro tests.Cy Schubert2021-02-064-15/+3
| | | | | | All FreeBSD and NetBSD are BSD >= 199306 and have been for a long time. MFC after: 1 week
* powerpc64le: readd COMPAT_FREEBSD11 and COMPAT_FREEBSD12Piotr Kubaj2021-02-061-1/+3
| | | | | | | lang/rust needs COMPAT_FREEBSD11 to build, even though powerpc64le itself is supported only since 13.0. I also corrected a comment, because if we ever have lib32 for powerpc64le, it will be for powerpcle. Reviewed by: bdragon (on IRC)
* cache: remove the largely obsolete general descriptionMateusz Guzik2021-02-051-46/+0
| | | | | | | | | | | | Examples of inconsistencies with the current state: - references LRU of all entries, removed years ago - references a non-existent lock (neglist) - claims negative entries have a NULL target It will be replaced with a more accurate and more informative description. In the meantime take it out so it stops misleading.
* cache: fix vfs:namecache:lookup:miss probe call sitesMateusz Guzik2021-02-051-5/+3
* cache: drop spurious arg from panic in cache_validateMateusz Guzik2021-02-051-3/+2
| | | | vp is already reported when noting mismatch
* cache: comment on FNVMateusz Guzik2021-02-051-1/+23
* [POWERPC64LE] add mrsas to GENERIC64LEAlfredo Dal'Ava Junior2021-02-051-0/+1
| | | | | | | Reviewed by: bdragon Sponsored by: Eldorado Research Institute (eldorado.org.br) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28475
* mrsas: unbreak i386 buildAlfredo Dal'Ava Junior2021-02-051-3/+1
| | | | | | | | | Fix build regression introduced by e34a057ca6ebdf8e30ec8b0dc21d18eb450bf36a Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D28494
* Add support for arm64 nGnRE device memoryAndrew Turner2021-02-053-3/+8
| | | | | | | | | | | | | | | | | | On arm64 we can select how strongly we order device memory. Currently we use the strongest type of non-Gathering, non-Reordering, no Early write acknowledgement. This is equivalent to VM_MEMATTR_SO in the 32-bit arm code. Create a new memory type to remove the no Early write acknowledgement option to create a memory attribute that is equivalent to the arm VM_MEMATTR_DEVICE. Keep the the old nGnRnE memory as what we provide for VM_MEMATTR_DEVICE until we can test nGnRE on more hardware. A method for dynamically switching back may be needed as at least one vendor is known to have broken nGnRE memory. Sponsored by: Innovate UK
* amd64 GENERIC: compile in mlx5en(4)Konstantin Belousov2021-02-051-0/+9
| | | | | | | Reviewed by: hselasky, manu Sponsored by: NVidia Networking/Mellanox Technologies MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28469
* Enable pvscsi and vmx in arm64 GENERICEd Maste2021-02-051-0/+2
| | | | | | | | | | FreeBSD pvscsi and vmx work with VMware ESXi Arm "Fling"; provide these in GENERIC for a convenient out-of-the-box experience. PR: 253202 Reported by: Vincent Milum Jr MFC after: 3 days Sponsored by: The FreeBSD Foundation