aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* arm: fix atomic_testand{set,clear}_64 for ops on high bitsRyan Libby2021-01-031-4/+2
| | | | | | | | | | The fix in bd03acedb804add1e22178d50eb2bfb703974ddf worked for 32-bit ops, and for 64-bit ops for bit arguments of 0 - 95, but then was broken for operations on the high 32 bits after that. Reviewed by: markj, mmel Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27897
* Handle KDB_WHY_TRAP return on arm and mipsMitchell Horne2021-01-022-2/+12
| | | | | | | | | Upon exit from the debugger, checking the return code of kdb_trap() allows one to retry the fatal page fault. This matches what is done on all other architectures. Reviewed by: jhb (earlier version) Differential Revision: https://reviews.freebsd.org/D27535
* arm64: fix mask in atomic_testand{set,clear}_64Ryan Libby2021-01-021-2/+2
| | | | | | | | | | | | | These macros generate both the 32- and 64-bit ops, but the mask was hard coded for 32-bit ops, causing the 64-bit ops always to affect only the low 32 bits. PR: 252324 Reported by: gbe, mmel Reviewed by: markj, mmel Tested by: mmel, rwatson Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27886
* loader: implement framebuffer consoleToomas Soome2021-01-022-3/+5
| | | | | | | | | | | | | | | | | | | | | | | Draw console on efi. Add vbe framebuffer for BIOS loader (vbe off, vbe on, vbe list, vbe set xxx). autoload font (/boot/fonts) based on resolution and font size. Add command loadfont (set font by file) and variable screen.font (set font by size). Pass loaded font to kernel. Export variables: screen.height screen.width screen.depth Add gfx primitives to draw the screen and put png image on the screen. Rework menu draw to iterate list of consoles to enamble device specific output. Probably something else I forgot... Relnotes: yes Differential Revision: https://reviews.freebsd.org/D27420
* arm: Fix atomic_testand{set,clear}_32(). According to atomic (9), the bit ↵Michal Meloun2021-01-021-4/+23
| | | | | | | position argument should be a modulo operand size. While I'm in, add missing implementation of atomic_testandclear_64(). For more details see https://reviews.freebsd.org/D27886 Discused with: rlibby MFC after: 3 weeks
* nfs server: improve use of the VFS KPIKonstantin Belousov2021-01-022-17/+22
| | | | | | | | | | | | | | | | | In particular, do not assume that vn_start_write() returns the same mp as it was passed in, or never returns error. Also be more accurate to return NULL vp and mp when error occured, to catch wrong control flow easier. Stop checking for NULL mp before calling vn_finished_write(), NULL mp is handled transparently by the function. Reviewed by: rmacklem Tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27881
* nfsd: fix NFSv4.0 seqid handling for ERELOOKUPRick Macklem2021-01-013-0/+8
| | | | | | | | | | | Commit 774a36851e0e fixed the NFS server so that it could handle ERELOOKUP returns from VOP calls by redoing the operation/RPC. However, for NFSv4.0, redoing an Open would increment the open_owner's seqid multiple times, breaking the protocol. This patch sets a new flag called ND_ERELOOKUP on the RPC when a redo is in progress. Then the code that increments the seqid avoids the seqid increment/check when the flag is set, since it indicates this has already been done for the Open.
* nfsd: fix NFS server for ERELOOKUPRick Macklem2021-01-013-4/+65
| | | | | | | | | | | | | | | | r367672 modified UFS such that certain VOPs, such as VOP_CREATE() will intermittently return ERELOOKUP. When this happens, the entire system call, or NFS operation in the case of the NFS server, must be redone. This patch adds that support to the NFS server by rolling back the state of the NFS request arguments and NFS reply arguments mbuf lists to the condition they were in before the operation and then redoing the operation. Tested by: pho Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D27875
* fusefs: implement FUSE_COPY_FILE_RANGE.Alan Somers2021-01-016-89/+272
| | | | | | | | | | This updates the FUSE protocol to 7.28, though most of the new features are optional and are not yet implemented. MFC after: 2 weeks Relnotes: yes Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D27818
* sctp: improve handling of aborted associationsMichael Tuexen2021-01-011-9/+8
| | | | | Don't clear a flag, when the structure already has been freed. Reported by: syzbot+07667d16c96779c737b4@syzkaller.appspotmail.com
* jail: revert the attachment part of b4e87a632955Jamie Gritton2021-01-011-8/+2
| | | | | | | The change to kern_jail_set that was supposed to "also properly clean up when attachment fails" didn't fix a memory leak but actually caused a double free. Back that part out, and leave the part that manages allprison_lock state.
* tmpfs: use VNPASS when asserting on a vnode in tmpfs_read_pgcacheMateusz Guzik2021-01-011-1/+1
|
* ufs: use VNPASS when asserting on a vnode in ufs_read_pgcacheMateusz Guzik2021-01-011-1/+1
|
* cache: fold NCF_WHITE check into the restMateusz Guzik2021-01-011-5/+13
| | | | Tested by: pho
* cache: call cache_fplookup_modifying in negMateusz Guzik2021-01-011-6/+2
| | | | Tested by: pho
* cache: refactor cache_fpl_handle_root to fit the rest of the code betterMateusz Guzik2021-01-011-26/+29
| | | | Tested by: pho
* cache: refactor dot handlingMateusz Guzik2021-01-011-21/+30
| | | | Tested by: pho
* cache: remove a branch from mount point checkingMateusz Guzik2021-01-011-4/+3
| | | | Tested by: pho
* cache: support lockless lookup of degenerate pathsMateusz Guzik2021-01-011-9/+52
| | | | Tested by: pho
* cache: save on branching when parsing the path by inserting a sentinelMateusz Guzik2021-01-011-6/+15
| | | | Tested by: pho
* cache: hoist trailing slash and degenerate path handling out of the loopMateusz Guzik2021-01-011-30/+61
| | | | Tested by: pho
* fd: inline pwd_get_smrMateusz Guzik2021-01-012-11/+1
| | | | Tested by: pho
* ddb: Display process flags (p_flag and p_flag2) in 'show proc'.John Baldwin2021-01-011-0/+2
| | | | | | Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27872
* Use kdb_thr_* to iterate over threads consistently in DDB.John Baldwin2021-01-012-26/+22
| | | | | | | | | | The "findstack", "show all trace", and "show active trace" commands were iterating over allproc to enumerate threads. This missed threads executing in exit1() after being removed from allproc. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27829
* Use kdb_thr_from_pid() in db_lookup_thread().John Baldwin2021-01-011-5/+3
| | | | | | | | The code is identical, so this should be a no-op. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27828
* Don't check P_INMEM in kdb_thr_*().John Baldwin2021-01-013-11/+16
| | | | | | | | | | Not all debugger operations that enumerate threads require thread stacks to be resident in memory to be useful. Instead, push P_INMEM checks (if needed) into callers. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27827
* Enumerate processes via the pid hash table in kdb_thr_*().John Baldwin2021-01-011-15/+24
| | | | | | | | | | Processes part way through exit1() are not included in allproc. Using allproc to enumerate processes prevented getting the stack trace of a thread in this part of exit1() via ddb. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27826
* Add a proc_off_p_hash helper variable.John Baldwin2021-01-011-0/+1
| | | | | | | | | This is used by kernel debuggers to enumerate processes via the pid hash table. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27825
* ddb ps: Use the pidhash to enumerate processes not in allproc.John Baldwin2021-01-012-8/+15
| | | | | | | | | | | | | | | Exiting processes that have been removed from allproc but are still executing are not yet marked PRS_ZOMBIE, so they were not listed (for example, if a thread panics during exit1()). To detect these processes, clear p_list.le_prev to NULL explicitly after removing a process from the allproc list and check for this sentinel rather than PRS_ZOMBIE when walking the pidhash. While here, simplify the pidhash walk to use a single outer loop. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27824
* jail: Clean up allprison_lock handing in kern_jail_setJamie Gritton2020-12-311-12/+18
| | | | | | | | Keep explicit track of the allprison_lock state during the final part of kern_jail_set, instead of deducing it from the JAIL_ATTACH flag. Also properly clean up when the attachment fails, fixing a long- standing (though minor) memory leak.
* uma dbg: catch more corruption with atomicsRyan Libby2020-12-311-5/+4
| | | | | | | | | | Use atomic testandset and testandclear to catch concurrent double free, and to reduce the number of atomic operations. Submitted by: jeff Reviewed by: cem, kib, markj (all previous version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22703
* bitset: implement BIT_TEST_CLR_ATOMIC & BIT_TEST_SET_ATOMICRyan Libby2020-12-311-0/+14
| | | | | | | | | | That is, provide wrappers around the atomic_testandclear and atomic_testandset primitives. Submitted by: jeff Reviewed by: cem, kib, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22702
* Stop defaulting to DWRAF2 in kernel compilationEd Maste2020-12-311-11/+0
| | | | | | | | | | | | After the removal of obsolete GDB 6.1.1 from the base system in 1c0ea326aa6d we no longer need to downgrade to DWARF2 debug info. We will need to ensure that our tools (e.g. ctfconvert) handle DWARF5 prior to it becoming the default in the Clang and GCC versions we use. Reported by: jhb Relnotes: Yes Sponsored by: The FreeBSD Foundation
* arm: tune vmparam.h towards a little more modernKyle Evans2020-12-311-3/+3
| | | | | | | | | | | | | | | | An 8MB max stack size is quite limiting in today's world, and in-fact is the *default* stack size for almost every other arch (including mips). Raise the default to 4MB (should be pretty reasonable) and the max to 64MB. NetBSD made a similar move back in 2015 and raised MAXDSIZ to 1856 at the same time, so let's just roll that in as well. They later lowered it, but eventually raised it back to 1856 in order to build rust. This was noticed while looking at qemu-bsd-user's default stack sizes and growth behavior (or lack thereof). Reviewed by: ian Differential Revision: https://reviews.freebsd.org/D27218
* vt: restore tty when console is ungrabbedKyle Evans2020-12-312-0/+8
| | | | | | | | | | | | | | | | | | | When a break-to-debugger is triggered, kdb will grab the console and vt(4) will generally switch back to ttyv0. If one issues a continue from the debugger, then kdb will ungrab the console and the system rolls on. This change adds a perhaps minor feature: when we're down to grab == 0 and if vt actually switched away to ttyv0, switch back to the tty it was previously on before the console was grabbed. The justification behind this is that a typical flow is to work in !ttyv0 to avoid console spam while occasionally dropping to ddb to inspect system state before returning. This could easily enough be tossed behind a sysctl or something if it's not generally appreciated, but I anticipate indifference. Reviewed by: ray Differential Revision: https://reviews.freebsd.org/D27110
* vt: more carefully handle vt_allocate_keyboard grab workKyle Evans2020-12-311-24/+55
| | | | | | | | | | | | | vt_allocate_keyboard only needs to unwind the effects of keyboard-grabbing, rather than any associated vt window action that may have also happened. Split out the bits that do the keyboard work into *_noswitch equivalents, and use those in keyboard allocation. This will be less error-prone when a later change will offer up different window state behavior when the console is ungrabbed. Reviewed by: ray Differential Revision: https://reviews.freebsd.org/D27110
* fusefs: update FUSE protocol to 7.24 and implement FUSE_LSEEKAlan Somers2020-12-316-21/+193
| | | | | | | | | | FUSE_LSEEK reports holes on fuse file systems, and is used for example by bsdtar. MFC after: 2 weeks Relnotes: yes Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D27804
* copyrights: Happy New Year 2021Glen Barber2020-12-311-4/+2
| | | | | | Good riddance 2020. Sponsored by: Rubicon Communications, LLC (netgate.com)
* Add pmu.h missed in 5e78bbb74a1fAndrew Turner2020-12-311-0/+52
| | | | | Reported by: rlibby Sponsored by: Innovate UK
* Streamline the infiniband code according to the ethernet code.Hans Petter Selasky2020-12-311-2/+0
| | | | | | | | | Fix LINT-NOIP kernel build. Submitted by: rlibby @ Differential Revision: https://reviews.freebsd.org/D27861 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking
* rsu: Don't modify read-only firmware block.John Baldwin2020-12-301-19/+18
| | | | | | | | | | | | | | | | | | | | | | The firmware header loaded into an rsu(4) device has to be customized to reflect device settings. The driver was overwriting the header from the shared firmware image before sending it to the device. If two devices attached at the same time with different settings, one device could potentially get a corrupted header. The recent changes in a095390344fb1795c1b118a2f84da8f6a7f254ab exposed this bug in the form of a panic as the firmware blobs are now marked read-only in object files and mapped read-only by the kernel. To avoid the bug, change the driver to allocate a copy of the firmware header on the stack that is initialized before writing it to the device. PR: 252163 Reported by: vidwer+fbsdbugs@gmail.com Tested by: vidwer+fbsdbugs@gmail.com Reviewed by: hselasky, bz, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27850
* [POWERPC64LE] enable IPMI using OPAL busAlfredo Dal'Ava Junior2020-12-311-1/+1
| | | | | | | | Enable build of IPMI over OPAL on powerpc64le Reviewed by: bdragon Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D27443
* powerpc: Fix copyin/copyout race conditionJustin Hibbits2020-12-301-10/+6
| | | | | | | | | It's possible for a context switch, and CPU migration, to occur between fetching the PCPU context and extracting the pc_curpcb. This can cause the fault handler to be installed for the wrong thread, leading to a panic in copyin()/copyout(). Since curthread is already in %r13, just use that directly, as GPRs are migrated, so there is no migration race risk.
* powerpc: Optimize copyinstr() to avoid repeatedly mapping user stringsJustin Hibbits2020-12-301-13/+33
| | | | | | | | | | | | Currently copyinstr() uses fubyte() to read each byte from userspace. However, this means that for each byte, it calls pmap_map_user_ptr() to map the string into memory. This is needlessly wasteful, since the string will rarely ever cross a segment boundary. Instead, map a segment at a time, and copy as much from that segment as possible at a time. Measured with the HPT pmap on powerpc64, this saves roughly 8% time on buildkernel, and 5% on buildworld, in wallclock time.
* Radix dump updatesJustin Hibbits2020-12-301-0/+8
|
* powerpc/radix_mmu: Apply errata fixes for POWER9 TLB invalidation bugJustin Hibbits2020-12-301-1/+19
| | | | Found in Linux, the only apparent source of errata documentation.
* powerpc/aim: Add machine check handler for TLB multihitJustin Hibbits2020-12-301-1/+2
| | | | | Handle TLB multi-hit the same as ERAT multi-hit, by flushing the full TLB.
* [POWERPC64LE] fix sysctl dev.opal_sensor.* on little-endian kernelAlfredo Dal'Ava Junior2020-12-313-6/+43
| | | | | | | | | - fix values returned by 'sysctls dev.opal_sensor.*.sensor' - fix missing 'dev.opal_sensor.*.sensor_[max|min]' on sysctl Reviewed-by: jhibbits Sponsored-by: Eldorado Research Institute (eldorado.org.br) Differential-Revision: https://reviews.freebsd.org/D27365
* Don't try to adjust a TLS TOE socket that has been closed.John Baldwin2020-12-301-0/+4
| | | | | | | | | | The handshake timer can race with another thread sending a FIN or RST to close a TOE TLS socket. Just bail from the timer without rescheduling if the connection is closed when the timer fires. Reported by: Sony Arpita Das @ Chelsio QA Reviewed by: np Differential Revision: https://reviews.freebsd.org/D27583
* Split out the FDT arm pmu attachmentAndrew Turner2020-12-304-207/+245
| | | | | | | This will allow us to add an ACPI attachment. Submitted by: Greg V <greg@unrelenting.technology> (earlier version) Sponsored by: Innovate UK