aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* tcp: Missing mfree in rack and bbrRandall Stewart2021-06-142-1/+6
| | | | | | | | | | | | | | | | | Recently (Nov) we added logic that protects against a peer negotiating a timestamp, and then not including a timestamp. This involved in the input path doing a goto done_with_input label. Now I suspect the code was cribbed from one in Rack that has to do with the SYN. This had a bug, i.e. it should have a m_freem(m) before going to the label (bbr had this missing m_freem() but rack did not). This then caused the missing m_freem to show up in both BBR and Rack. Also looking at the code referencing m->m_pkthdr.lro_nsegs later (after processing) is not a good idea, even though its only for logging. Best to copy that off before any frees can take place. Reviewed by: mtuexen Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30727 (cherry picked from commit ba1b3e48f5be320f0590bc357ea53fdc3e4edc65)
* tcp: Mbuf leak while holding a socket buffer lock.Randall Stewart2021-06-144-52/+84
| | | | | | | | | | | | | | | | | | | | | | | When running at NF the current Rack and BBR changes with the recent commits from Richard that cause the socket buffer lock to be held over the ip_output() call and then finally culminating in a call to tcp_handle_wakeup() we get a lot of leaked mbufs. I don't think that this leak is actually caused by holding the lock or what Richard has done, but is exposing some other bug that has probably been lying dormant for a long time. I will continue to look (using his changes) at what is going on to try to root cause out the issue. In the meantime I can't leave the leaks out for everyone else. So this commit will revert all of Richards changes and move both Rack and BBR back to just doing the old sorwakeup_locked() calls after messing with the so_rcv buffer. We may want to look at adding back in Richards changes after I have pinpointed the root cause of the mbuf leak and fixed it. Reviewed by: mtuexen,rscheff Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30704 (cherry picked from commit 67e892819b26c198e4232c7586ead7f854f848c5)
* tcp: LRO timestamps have lost their previous precisionRandall Stewart2021-06-143-12/+26
| | | | | | | | | | | | | Recently we had a rewrite to tcp_lro.c that was tested but one subtle change was the move to a less precise timestamp. This causes all kinds of chaos in tcp's that do pacing and needs to be fixed to use the more precise time that was there before. Reviewed by: mtuexen, gallatin, hselasky Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30695 (cherry picked from commit b45daaea95abd8bda52caaacf120f9197caab3e7)
* arm64: Fix pmap_copy()'s handling of 2MB mappingsMark Johnston2021-06-141-5/+2
| | | | | | | | | | | | | | | | | | | | When copying mappings from parent to child, we clear the accessed and dirty bits. This is done for both 4KB and 2MB PTEs. However, pmap_demote_l2() asserts that writable superpages must be dirty. This is to avoid races with the MMU setting the dirty bit during promotion and demotion. pmap_copy() can create clean, writable superpage mappings, so it violates this assertion. Modify pmap_copy() to preserve the accessed and dirty bits when copying 2MB mappings, like we do on amd64. Fixes: ca2cae0b4dd Reported by: Jenkins via mhorne Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30643 (cherry picked from commit 4e4035ef1fb5e2f9da6b658ffae8a54862b4d018)
* Fix handling of D_GIANTOKMark Johnston2021-06-141-4/+7
| | | | | | | | | | | | It was meant to suppress only the printf(), not the subsequent injection of Giant-protected thunks for various file operations. Fixes: fbeb4ccac9 Reported by: pho Tested by: pho Pointy hat: markj (cherry picked from commit 887c753c9f451322cae3efbf9b63f53f3d9011c8)
* riscv: Rename pmap_fault_fixup() to pmap_fault()Mark Johnston2021-06-143-3/+3
| | | | | | | | | | This is consistent with other platforms, specifically arm and arm64. No functional change intended. Reviewed by: jrtc27 Sponsored by: The FreeBSD Foundation (cherry picked from commit 317113bb125166f6ba3035a29408339af38cca54)
* arm: Remove last_fault_codeMark Johnston2021-06-141-8/+0
| | | | | | | | It is unused since the removal of pmap-v4.c in commit b88b275145. Sponsored by: The FreeBSD Foundation (cherry picked from commit 62ba0def5584bc1fc84fc7df6d7a1256e4a34fb8)
* riscv: Handle hardware-managed dirty bit updates in pmap_promote_l2()Mark Johnston2021-06-141-9/+32
| | | | | | | | | | | | | | | | | | | pmap_promote_l2() failed to handle implementations which set the accessed and dirty flags. In particular, when comparing the attributes of a run of 512 PTEs, we must handle the possibility that the hardware will set PTE_D on a clean, writable mapping. Following the example of amd64 and arm64, change riscv's pmap_promote_l2() to downgrade clean, writable mappings to read-only, so that updates are synchronized by the pmap lock. Fixes: f6893f09d Reported by: Nathaniel Filardo <nwf20@cl.cam.ac.uk> Tested by: Nathaniel Filardo <nwf20@cl.cam.ac.uk> Reviewed by: jrtc27, alc, Nathaniel Filardo Sponsored by: The FreeBSD Foundation (cherry picked from commit c05748e028b84c216d0161e70418f8cb09e074e4)
* Suppress D_NEEDGIANT warnings for some driversMark Johnston2021-06-144-3/+4
| | | | | | | | | | | | | | | | During boot we warn that the kbd and openfirm drivers are Giant-locked and may be deleted. Generally, the warning helps signal that certain old drivers are not being maintained and are subject to removal, but this doesn't really apply to certain drivers which are harder to detangle from Giant. Add a flag, D_GIANTOK, that devices can specify to suppress the misleading warning. Use it in the kbd and openfirm drivers. Reviewed by: imp, jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit fbeb4ccac990fdb3bc26ab925a3ca8e7d2f89721)
* iwn: adjust EEPROM read timeout for Intel 4965AGN M2Radosław Chmielarz2021-06-141-2/+2
| | | | | | | | | | Reading EEPROM from Intel 4965AGN M2 takes 60 us which was causing panic on system startup. PR: 255465 Reviewed by: markj (cherry picked from commit 03d4b58feee396d392668f192ecdde08ecc8036c)
* ngatm: Handle errors from uni_msg_extend()Mark Johnston2021-06-141-2/+4
| | | | | | | | | | | uni_msg_extend() may fail due to a memory allocation failure. In this case, though, the message is freed, so callers shouldn't touch it. PR: 255861 Reviewed by: harti Sponsored by: The FreeBSD Foundation (cherry picked from commit e755e2776ddff729ae4102f3273473aa33b00077)
* arm64: Use the right PTE when downgrading perms in pmap_promote_l2()Mark Johnston2021-06-141-1/+10
| | | | | | | | | | | | | | | | | | When promoting a run of small mappings to a superpage, we have to downgrade clean, writable mappings to read-only, to handle the possibility that the MMU will concurrently mark one of the mappings as dirty. The code which performed this operation for the first PTE in the run used the wrong PTE pointer. As a result, the comparison would always fail, aborting the promotion. This only occurs when promoting writable, clean mappings. Fixes: ca2cae0b4dd Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit a48f51b3d396664f9b0a91f016159f4e4324da85)
* linuxkpi: Add list_for_each_entry_lockless() macroNeel Chauhan2021-06-142-1/+3
| | | | | | | | | This is needed by the drm-kmod 5.7 update. Approved by: hselasky (src) Differential Revision: https://reviews.freebsd.org/D30708 (cherry picked from commit b47f461c8e67253fdb394968428b760e880baa08)
* pf: Convenience function for optional (numeric) argumentsKristof Provost2021-06-142-21/+29
| | | | | | | | | | | | | | | | | Add _opt() variants for the uint* functions. These functions set the provided default value if the nvlist doesn't contain the relevant value. This is helpful for optional values (e.g. when the API is extended to add new fields). While here simplify the header by also using macros to create the prototypes for the macro-generated function implementations. Reviewed by: scottl MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30510 (cherry picked from commit 7c4342890bf17b72f0d79ada1326d9cbf34e736c)
* LinuxKPI: add pr_err_onceGreg V2021-06-141-0/+2
| | | | | | | | Reviewed by: hselasky, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30672 (cherry picked from commit 05c2d94a081d5948560a01c26c7f432960cde606)
* tcp: fix two bugs in new renoMichael Tuexen2021-06-131-2/+4
| | | | | | | | | | | * Completely initialise the CC module specific data * Use beta_ecn in case of an ECN event whenever ABE is enabled or it is requested by the stack. Reviewed by: rscheff, rrs Sponsored by: Netflix, Inc. (cherry picked from commit fa3746be4203fc9a3414afb21d964eec8bad74f8)
* tcp: remove debug output from RACKMichael Tuexen2021-06-131-2/+0
| | | | | | | | | | Reported by: iron.udjin@gmail.com, Marek Zarychta Reviewed by: rrs PR: 256538 Differential Revision: https://reviews.freebsd.org/D30723 Sponsored by: Netflix, Inc. (cherry picked from commit f1536bb53898b12e2d19938f8fe2d04b5e5d12a6)
* tcp: fix compilation of IPv4-only buildsMichael Tuexen2021-06-131-0/+2
| | | | | | | | PR: 256538 Reported by: iron.udjin@gmail.com Sponsored by: Netflix, Inc. (cherry picked from commit 224cf7b35b9bbe8d075f6004249d850c620b7855)
* ums(4): Do not stop USB xfers on FIFO close when evdev is still activeVladimir Kondratyev2021-06-131-5/+8
| | | | | | | | | | | This fixes lose of evdev events after moused has been killed. While here use bitwise operations for UMS_EVDEV_OPENED flag. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30342 (cherry picked from commit 05ab03a31798d4cc96c22a8f30b1d9a0d7a3dd35)
* ums(4): Start USB xfers on opening of evdev node unconditionally.Vladimir Kondratyev2021-06-131-1/+1
| | | | | | | | | | This fixes inability to start USB xfers in a case when FIFO has been already open()-ed but no read() or poll() calls has been issued yet. MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30343 (cherry picked from commit 47791339f0cfe3282a6f64b5607047f7bca968ad)
* usbhid(4): Add second set of USB transfers to work in polled mode.Vladimir Kondratyev2021-06-134-19/+73
| | | | | | | | | | The second set of USB transfer is requested by hkbd(4) and should improve HID keyboard handling in kdb and panic contexts. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30486 (cherry picked from commit 9aa0e5af75d033aa2dff763dd2886daaa7213612)
* usbhid(4): Fix NULL pointer dereference in usbd_xfer_max_len()Vladimir Kondratyev2021-06-131-15/+49
| | | | | | | | | | Which happens when USB transfer setup is failed. PR: 254974 Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30485 (cherry picked from commit e889a462d878675551b227a382764c3879e6c2b3)
* Create VM_MEMATTR_DEVICE on all architecturesAndrew Turner2021-06-135-1/+6
| | | | | | | | | | | | | This is intended to be used with memory mapped IO, e.g. from bus_space_map with no flags, or pmap_mapdev. Use this new memory type in the map request configured by resource_init_map_request, and in pciconf. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29692 (cherry picked from commit 5d2d599d3f3494d813e51e1bcd1c9693eb9c098b)
* zfs: merge openzfs/zfs@c3b60eded (zfs-2.1-release) into stable/13Martin Matuska2021-06-13243-13894/+11622
| | | | | | | | | | | | | | | | | | | | | | Notable upstream pull request merges: #12015 Replace zstreamdump with zstream link #12046 Improve scrub maxinflight_bytes math. #12052 FreeBSD: incorporate changes to the VFS_QUOTACTL(9) KPI #12072 Let zfs diff be more permissive #12091 libzfs: On FreeBSD, use MNT_NOWAIT with getfsstat #12104 Reminder to update boot code after zpool upgrade #12114 Introduce write-mostly sums #12125 Modernise all (most) remaining .TH manpages #12145 More aggsum optimizations #12149 Multiple man-pages: Move to appropriate section #12158 Re-embed multilist_t storage #12177 Livelist logic should handle dedup blkptrs #12196 Unify manpage makefiles, move pages to better sexions, revisit some #12212 Remove pool io kstats Obtained from: OpenZFS OpenZFS commit: c3b60ededa6e6ce36a457a54451ca153c4c630dc OpenZFS tag: zfs-2.1.0-rc7
* vfs: slightly rework vn_rlimit_fsizeMateusz Guzik2021-06-131-4/+17
| | | | (cherry picked from commit 478c52f1e3654213c7d79096a2bc7f908e0b501d)
* ktrace: Remove vrele() at the end of ktr_writerequest()Mark Johnston2021-06-131-1/+0
| | | | (cherry picked from commit 6f6cd1e8e8aa3a48b35598992f1b6c21003d35cd)
* ktrace: fix a race between writes and closeKonstantin Belousov2021-06-131-11/+11
| | | | (cherry picked from commit fc369a353b5b5e0f8046687fcbd78a7cd9ad1810)
* Fix limit testing after 1762f674ccb571e6 ktrace commit.Mateusz Guzik2021-06-131-1/+1
| | | | (cherry picked from commit e71d5c7331700504e58cf1a35dca529381723e02)
* Fix a braino in previous.Mateusz Guzik2021-06-132-2/+4
| | | | (cherry picked from commit 48235c377f960050e9129aa847d7d73019561c82)
* Fix tinderbox build after 1762f674ccb571e6 ktrace commit.Mateusz Guzik2021-06-133-2/+15
| | | | (cherry picked from commit 154f0ecc10abdd3c23d233bf85e292011a130583)
* ktrace: add a kern.ktrace.filesize_limit_signal knobKonstantin Belousov2021-06-133-3/+18
| | | | (cherry picked from commit ea2b64c2413355ac0d5fc6ff597342e9437a34d4)
* ktrace: use the limit of the trace initiator for file size limit on writesKonstantin Belousov2021-06-133-8/+17
| | | | (cherry picked from commit 02645b886bc62dfd8a998fd51d2e6c1bbca03ecb)
* ktrace: pack all ktrace parameters into allocated structure ktr_io_paramsKonstantin Belousov2021-06-136-106/+165
| | | | (cherry picked from commit 1762f674ccb571e6b03c009906dd1af3c6343f9b)
* ktrace: do not stop tracing other processes if our cannot write to this vnodeKonstantin Belousov2021-06-131-34/+19
| | | | (cherry picked from commit a6144f713cee8f522150b1398b225eedbf4cfef1)
* accounting: explicitly mark the exiting thread as doing accountingKonstantin Belousov2021-06-133-22/+8
| | | | (cherry picked from commit 9bb84c23e762e7d1b6154ef4afdcc80662692e76)
* Change the return type of sv__setid_allowed from bool to intKonstantin Belousov2021-06-133-3/+3
| | | | (cherry picked from commit 62b8258a7e43f3c774f13eab758b2cfdf353073e)
* linuxolator: Add compat.linux.setid_allowed knobKonstantin Belousov2021-06-136-0/+20
| | | | | | PR: 21463 (cherry picked from commit 598f6fb49c9ca688029b79de0a44227ab79c608c)
* sysent: allow ABI to disable setid on exec.Konstantin Belousov2021-06-132-0/+6
| | | | (cherry picked from commit 2d423f7671fe452486932c8e41e7d3547afe82aa)
* kern_exec.c: Add execve_nosetid() helperKonstantin Belousov2021-06-131-5/+11
| | | | (cherry picked from commit 19e6043a443ea51207786b85c8d62d070ec36005)
* hyperv: register intr handler as usermode-mapped if loaded as moduleKonstantin Belousov2021-06-121-0/+16
| | | | (cherry picked from commit fe7d7ac40881c9d01a54bf57fff71a3af199f237)
* Clean up early arm64 pmap codeAndrew Turner2021-06-123-32/+3
| | | | | | | | | | | | Early in the arm64 pmap code we need to translate between a virtual address and a physical address. Rather than manually walking the page table we can ask the hardware to do it for us. Reviewed by: kib, markj Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D30357 (cherry picked from commit e779604f1d4e5fd0cdf3a9d1bb756b168f97b39c)
* Use '.arch_extension crc' in the arm64 crc32 codeAndrew Turner2021-06-121-1/+2
| | | | | | | | | We don't care about the base architecture here, just that the crc extension is enabled. Sponsored by: Innovate UK (cherry picked from commit 0ec3e991112d85a790ca3bbb4175652f37f4bd15)
* Implement bus_map_resource on arm64Andrew Turner2021-06-121-14/+63
| | | | | | | | | | | | | This will allow us to allocate an unmapped memory resource, then later map it with a specific memory attribute. This is also needed for virtio with the modern PCI attachment. Reviewed by: kib (via D29723) Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D29694 (cherry picked from commit fe3822497726ab84a1e3753be41e43e4d51aab0b)
* Clean up the style in the arm64 bus.hAndrew Turner2021-06-121-12/+14
| | | | | | | MFC after: 2 weeks Sponsored by: Innovate UK (cherry picked from commit 5998328e55f8850718a6b48842823eb0a6524ae6)
* nfscl: Use hash lists to improve expected search performance for opensRick Macklem2021-06-121-90/+75
| | | | | | | | | | | | | | | | | | | | | | | | A problem was reported via email, where a large (130000+) accumulation of NFSv4 opens on an NFSv4 mount caused significant lock contention on the mutex used to protect the client mount's open/lock state. Although the root cause for the accumulation of opens was not resolved, it is obvious that the NFSv4 client is not designed to handle 100000+ opens efficiently. When searching for an open, usually for a match by file handle, a linear search of all opens is done. Commit 3f7e14ad9345 added a hash table of lists hashed on file handle for the opens. This patch uses the hash lists for searching for a matching open based of file handle instead of an exhaustive linear search of all opens. This change appears to be performance neutral for a small number of opens, but should improve expected performance for a large number of opens. This commit should not affect the high level semantics of open handling. (cherry picked from commit 96b40b896772bbce5f93d62eaa640e1eb51b4a30)
* nfscl: Use hash lists to improve expected search performance for opensRick Macklem2021-06-121-33/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | A problem was reported via email, where a large (130000+) accumulation of NFSv4 opens on an NFSv4 mount caused significant lock contention on the mutex used to protect the client mount's open/lock state. Although the root cause for the accumulation of opens was not resolved, it is obvious that the NFSv4 client is not designed to handle 100000+ opens efficiently. When searching for an open, usually for a match by file handle, a linear search of all opens is done. Commit 3f7e14ad9345 added a hash table of lists hashed on file handle for the opens. This patch uses the hash lists for searching for a matching open based of file handle instead of an exhaustive linear search of all opens. This change appears to be performance neutral for a small number of opens, but should improve expected performance for a large number of opens. This patch also moves any found match to the front of the hash list, to try and maintain the hash lists in recently used ordering (least recently used at the end of the list). This commit should not affect the high level semantics of open handling. (cherry picked from commit 724072ab1d588677a83a5a5011b5ad9ff5d56538)
* linuxkpi: Add macros for might_lock_nested() and lockdep_(re/un/)pin_lock()Neel Chauhan2021-06-122-1/+6
| | | | | | | | | | | | | In Linux, these are macros to locks in the kernel for scheduling purposes. But as with other macros in this header, we aren't doing anything with them so we are doing `do {} while (0)` for now. This is needed by the drm-kmod 5.7 update. Approved by: hselasky (src) Differential Revision: https://reviews.freebsd.org/D30710 (cherry picked from commit 8a1a42b2a7a428fb97fda9f19fd0d67a4eec7535)
* linuxkpi: Add _RET_IP_ macro in kernel.hNeel Chauhan2021-06-121-0/+2
| | | | | | | | | This is needed by the drm-kmod 5.7 update. Approved by: hselasky (src) Differential Revision: https://reviews.freebsd.org/D30707 (cherry picked from commit fee0d486ef34c6bd113ed743e33357ff626f2495)
* linuxkpi: Add rom and romlen to struct pci_devNeel Chauhan2021-06-121-0/+2
| | | | | | | Approved by: bz (src), hselasky (src) Differential Reivison: https://reviews.freebsd.org/D30686 (cherry picked from commit 096104e790fb182d230f25f169792cc610b8f41c)
* Also enable IPIs on 32-bit armAndrew Turner2021-06-111-0/+1
| | | | | | | | This was missed in 2420f6a Reported by: tuexen, imp (cherry picked from commit 0ec205197b56b9257cf0fdc1a5b268fef3e3f2dc)