aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl
Commit message (Collapse)AuthorAgeFilesLines
* Adjust function definition in riscv's dtrace_subr.c to avoid clang 15 warningDimitry Andric2022-08-141-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/cddl/dev/dtrace/riscv/dtrace_subr.c:165:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] dtrace_gethrtime() ^ void This is because dtrace_gethrtime() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Adjust function definition in powerpc's dtrace_subr.c to avoid clang 15 warningDimitry Andric2022-08-141-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/cddl/dev/dtrace/powerpc/dtrace_subr.c:237:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] dtrace_gethrtime() ^ void This is because dtrace_gethrtime() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Adjust function definition in arm's dtrace_subr.c to avoid clang 15 warningDimitry Andric2022-08-141-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/cddl/dev/dtrace/arm/dtrace_subr.c:174:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] dtrace_gethrtime() ^ void This is because dtrace_gethrtime() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* dtrace/amd64: Implement emulation of call instructionsMark Johnston2022-08-093-7/+59
| | | | | | | | | | | | | | | | | | | Here, the provider is responsible for updating the trapframe to redirect control flow and for computing the return address. Once software-saved registers are restored, the emulation shifts the remaining context down on the stack to make space for the return address, then copies the address provided by the invop handler. dtrace_invop() is modified to allocate temporary storage space on the stack for use by the provider to return the return address. This is to support a new provider for amd64 which can instrument arbitrary instructions, not just function entry and exit instructions as FBT does. In collaboration with: christos Sponsored by: Google, Inc. (GSoC 2022) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* fbt/x86: Extract arg1 for return probes from the trapframeMark Johnston2022-08-091-2/+4
| | | | | | | | | dtrace invop handlers have access to the whole trapframe, just use that to extract %rax/%eax for return probes instead of relying on an additional parameter to the handler. No functional change intended. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* stand/libsa: zfs use standard ZFS_EARLY stuffWarner Losh2022-07-241-0/+2
| | | | | | | | | | | | | | | | | | | | Now that the minor issues preventing zfs.c from using CFLAGS_EARLY have been fixed, use that mechanism like everything else that needs the OpenZFS spl headers. This simplifies things somewhat. Update comments to document why zfs.c is still special, though in different ways. Note: We also use the fact that NEED_SOLARIS_BOOLEAN is only defined in an environment where the solaris compat boolean stuff will be defined prior to this point (eg, when we're building zfs.c in libsa), but not in other environments (like when we're building mkimage and stand-alone boot loaders that don't use libsa). These latter uses should be changed to use the same ZFS compile env, but aren't as part of this commit. This has to be done in the same change as the ZFS_EARLY change to not break zfs.c building for one commit affecting bisectabiltiy. Sponsored by: Netflix Reviewed by: tsoome, delphij Differential Revision: https://reviews.freebsd.org/D35894
* zfs: Increase compatibility for different environmentsWarner Losh2022-07-241-0/+2
| | | | | | | | | | | | | | libsa uses the full OpenZFS compilation environment when we build this included in zfs.c there. Other parts of the tree have not been adapted to the full OpenZFS environment yet and need these ASSERT* defines to build properly. Since the ASSERT* macros are normally defined in sys/debug.h in the OpenZFS compatibility spl, only define them when ASSERT3S is not defined to cope with the parts of the loader that don't yet use the full OpenZFS environment. Sponsored by: Netflix Reviewed by: tsoome, delphij Differential Revision: https://reviews.freebsd.org/D35893
* Adjust fbt_unload() definition to avoid clang 15 warningDimitry Andric2022-07-211-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/cddl/dev/fbt/fbt.c:1273:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] fbt_unload() ^ void This is because fbt_unload() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Adjust prototype_unload() definition to avoid clang 15 warningDimitry Andric2022-07-201-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warnings is produced: sys/cddl/dev/prototype.c:99:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] prototype_unload() ^ void This is because prototype_unload() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Adjust dtrace_unload() definition to avoid clang 15 warningDimitry Andric2022-07-191-1/+1
| | | | | | | | | | | | | | | | With clang 15, the following -Werror warnings is produced: In file included from sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c:18440: sys/cddl/dev/dtrace/dtrace_unload.c:26:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] dtrace_unload() ^ void This is because dtrace_unload() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Adjust dtrace_getf_barrier() definition to avoid clang 15 warningDimitry Andric2022-07-191-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warnings is produced: sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c:17019:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] dtrace_getf_barrier() ^ void This is because dtrace_getf_barrier() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Adjust profile_unload() definition to avoid clang 15 warningDimitry Andric2022-07-191-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warnings is produced: sys/cddl/dev/profile/profile.c:640:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] profile_unload() ^ void This is because profile_unload() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Adjust dtmalloc_unload() definition to avoid clang 15 warningDimitry Andric2022-07-191-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warnings is produced: sys/cddl/dev/dtmalloc/dtmalloc.c:177:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] dtmalloc_unload() ^ void This is because dtmalloc_unload() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* stand: Add blake3 support to boot loaderWarner Losh2022-07-093-1/+104
| | | | | | | | | | | | | | | | | | | | | | Add the necessary glue to get blake3 building for the boot loaded as well as connected to the ZFS system so it is useful. On some platforms, we create references to blake3_sse2_impl and blake3_sse41_impl ops structs to utilize SIMD. These aren't present on x86 (since we dind't ask for them), but are on aarch64 with no implementation. Since we don't want SIMD in the boot loader, have these all return 'unsupported' always. This should be fixed upstream to allow more flexibility in this selection, but for now we use this hack to not modify the sys/contrib/openzfs with difficult to maintain hacks while an upstreamable solution is found. tsoome@ did the implementation bits in sys/cddl/boot, and I did the Makefile work and the aweful blake3_impl_hack.c. Co-author: tsoome@freebsd.org Sponsored by: Netflix Reviewed by: kevans (earlier version) Differential Revision: https://reviews.freebsd.org/D35750
* loader: add support for gzip compressionToomas Soome2022-06-093-9/+107
| | | | | | | | | | | As we do have zlib code in loader, we should also support gzip compression in zfs. PR: 153173 Submitted by: Mikhail Zakharov <zmey20000@yahoo.com> Reviewed by: imp, markj, delphij Differential Revision: https://reviews.freebsd.org/D35320 MFC after: 1 month
* Use KERNEL_PANICKED() in more placesMitchell Horne2022-06-021-2/+2
| | | | | | | | | | This is slightly more optimized than checking panicstr directly. For most of these instances performance doesn't matter, but let's make KERNEL_PANICKED() the common idiom. Reviewed by: mjg MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D35373
* dtrace: add warning for /dev/dtrace/prototypeChristos Margiolis2022-06-011-1/+4
| | | | | | | Let the programmer know that creating a device is not necessary. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D35381
* dtrace: remove /dev/dtrace/fbtChristos Margiolis2022-06-011-20/+0
| | | | | | | It is unused. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D35377
* dtrace: remove /dev/dtrace/profileChristos Margiolis2022-06-011-21/+0
| | | | | | | It is unused. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D35380
* dtrace: remove /dev/dtrace/dtmallocChristos Margiolis2022-06-011-20/+0
| | | | | | | It is unused. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D35379
* boot/zfs: Extend zfsimpl.h and make it easier to useMark Johnston2022-05-211-18/+213
| | | | | | | | | | | | | | | | | | Some makefs(8) patches make use of zfsimpl.h (not zfsimpl.c though) to provide definitions for various on-disk structures. Most of this diff simply adds new definitions that are useful. Also reduce dependencies of the header: - remove an unused list_node_t field to drop the sys/list.h dependency - replace CTASSERT with _Static_assert And fix the declaration of decode_embedded_bp_compressed(). No functional change intended. Reviewed by: tsoome MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35278
* libsa: Make the nvlist implementation more self-containedMark Johnston2022-05-201-34/+0
| | | | | | | | | | | | | | | | | | | | Move declarations into a new nvlist.h rather than putting everything in libzfs.h. This makes this nvlist code easier to reuse elsewhere. In particular, the nvlist implementation in sys/contrib/libnv does not provide XDR encoding, but this is needed when reading from or writing to ZFS pools. Also: - Remove references to boolean_t. It has to be a 32-bit int here, so just reference the underlying type. - Add includes needed when compiling the nvlist code outside of stand/. No functional change intended. Reviewed by: tsoome MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35255
* stand/zfs: Fix const-qual warningsMark Johnston2022-05-041-4/+4
| | | | | | | | | The input buffer is read-only, update casts to match. No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* zfs: merge openzfs/zfs@a86e08941 (master) into mainMartin Matuska2022-03-081-2/+2
| | | | | | | | | | | | | | | | | | | | Notable upstream pull request merges: #9078: log xattr=sa create/remove/update to ZIL #11919: Cross-platform xattr user namespace compatibility #13014: Report dnodes with faulty bonuslen #13016: FreeBSD: Fix zvol_cdev_open locking #13019: spl: Don't check FreeBSD rwlocks for double initialization #13027: Fix clearing set-uid and set-gid bits on a file when replying a write #13031: Add enumerated vdev names to 'zpool iostat -v' and 'zpool list -v' #13074: Enable encrypted raw sending to pools with greater ashift #13076: Receive checks should allow unencrypted child datasets #13098: Avoid dirtying the final TXGs when exporting a pool #13172: Fix ENOSPC when unlinking multiple files from full pool Obtained from: OpenZFS OpenZFS commit: a86e089415679cf1b98eb424a159bb36aa2c19e3
* fbt: Add support for CTFv3 containersMark Johnston2022-03-071-78/+231
| | | | | | | | | | | | | | | The general aim in this and subsequent patches is to minimize the amount of code that directly references CTF types such as ctf_type_t, ctf_array_t, etc. To that end, introduce some routines similar to the existing fbt_get_ctt_size() (which exists to deal with differences between v1 and v2) and change ctf_lookup_by_id() to return a void pointer. Support for v2 containers is preserved. MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34361
* ctf: Import ctf.h from OpenBSDMark Johnston2022-03-071-360/+0
| | | | | | | | | | | | | | | | | Use it instead of the existing ctf.h from OpenSolaris. This makes it easier to use CTF in the core kernel, and to extend the CTF format to support wider type IDs. The imported ctf.h is modified to depend only on _types.h, and also to provide macros which use the "parent" bit of a type ID to refer to types in a parent CTF container. No functional change intended. Reviewed by: Domagoj Stolfa, emaste MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34358
* fasttrap: Avoid creating WX mappingsMark Johnston2022-03-012-3/+4
| | | | | | | | | | | | | | | | | fasttrap instruments certain instructions by overwriting them and copying the original instruction to some per-thread scratch space which is executed after the probe fires. This trampoline jumps back to the tracepoint after executing the original instruction. The created mapping has both write and execute permissions, and so this mechanism doesn't work when allow_wx is disabled. Work around the restriction by using proc_rwmem() to write to the trampoline. Reviewed by: vangyzen Tested by: Amit <akamit91@hotmail.com> MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34304
* fasttrap: Assert that fasttrap_fork() successfully unmaps scratch spaceMark Johnston2022-03-011-2/+3
| | | | | | | No functional change intended. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* fbt: Remove handling for CTFv1Mark Johnston2022-02-231-2/+1
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* fd: rename fget*_locked to fget*_norefMateusz Guzik2022-02-221-1/+4
| | | | | | | | This gets rid of the error prone naming where fget_unlocked returns with a ref held, while fget_locked requires a lock but provides nothing in terms of making sure the file lives past unlock. No functional changes.
* Teach DTrace about BTI on arm64Andrew Turner2022-01-192-0/+11
| | | | | | | | | | | | | The Branch Target Identification (BTI) Armv8-A extension adds new instructions that can be placed where we may indirrectly branch to, e.g. at the start of a function called via a function pointer. We can't emulate these in DTrace as the kernel will have raised a different exception before the DTrace handler has run. Skip over the BTI instruction if it's used as the first instruction in a function. Sponsored by: The FreeBSD Foundation
* dtrace: add a knob to control maximum size of principal buffersAndriy Gapon2022-01-112-1/+7
| | | | | | | | | | | | | | | | | | We had a hardcoded limit of 1/128-th of physical memory that was further subdivided between all CPUs as principal buffers are allocated on the per-CPU basis. Actually, the buffers could use up 1/64-th of the memmory because with the default switch policy there are two buffers per CPU. This commit allows to change that limit. Note that the discussed limit is per dtrace command invocation. The idea is to limit the size of a single malloc(9) call, not the total memory size used by DTrace buffers. Reviewed by: markj MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D33648
* Remove mips dtrace.Warner Losh2022-01-076-1503/+0
| | | | | | Remove mips dtrace code. It's no longer needed. Sponsored by: Netflix
* dtrace: Use C99 fixed-width integer types.John Baldwin2021-12-281-12/+12
| | | | | | | No functional change. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D33631
* dtrace: Disable getf() as it is broken on FreeBSDDomagoj Stolfa2021-12-171-0/+4
| | | | | | | | | | | | | | | | | | getf() on FreeBSD calls _sx_slock(), _sx_sunlock() and fget_locked(). Furthermore, it does not set the per-core fault flag, meaning it usually ends up in a double fault panic once getf() does get called, especially from fbt. Reviewing the DTrace Toolkit + a number of other scripts scattered around FreeBSD, I have not been able to find one use of getf(). Given how broken the implementation currently is, we disable it until it can be implemented properly. Also comment out a test in aggs/tst.subr.d for getf(). Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33378
* stand/zfs: Mark pcount as unusedWarner Losh2021-12-161-1/+2
| | | | | | | pcount is unused in the sense that it's set but never used except in an assert. But asserts are compiled out always, so just mark it as unused. Sponsored by: Netflix
* Fix dtrace fbt return probes on arm64Andrew Turner2021-12-142-6/+12
| | | | | | | | | | As with arm and riscv fix return fbt probes on arm64. arg0 should be the offset within the function of the return instruction and arg1 should be the return value. Reviewed by: kp, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33440
* Allow ddb and dtrace use the DMAP region on arm64Andrew Turner2021-10-011-1/+5
| | | | | | | | | | | | When writing to memory on arm64 we may be trying to be accessing a read-only page. In this case try to access via the DMAP region to get a writable location. While here simplify writing data in DDB and stop trashing the size as it is passed into the cache handling functions. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32053
* kern: drop remaining references to removed makesyscalls.shKyle Evans2021-09-101-2/+2
| | | | | | | This was accidentally omitted from the recent removal of makeyscalls.sh. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D30250
* Create sys/reg.h for the common code previously in machine/reg.hAndrew Turner2021-08-307-7/+1
| | | | | | | | | | Move the common kernel function signatures from machine/reg.h to a new sys/reg.h. This is in preperation for adding PT_GETREGSET to ptrace(2). Reviewed by: imp, markj Sponsored by: DARPA, AFRL (original work) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19830
* sys/cddl: remove extraneous semicolonsEd Maste2021-08-162-3/+3
| | | | | | | Fixes: 5a1b490d502e ("FreeBSD changes to vendor source.") Fixes: 91eaf3e1831d ("Custom DTrace kernel module...") MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace: use %zu format specifier for data of size_t typeKonstantin Belousov2021-08-082-2/+2
| | | | Sponsored by: The FreeBSD Foundation
* fbt: Remove some handling for multiple CTF containersMark Johnston2021-04-021-35/+9
| | | | | | | | | | | | | This was ported from illumos but not completely done. Currently we do not perform type deduplication between KLDs and the kernel, i.e., kernel modules have a complete type graph. So, remove it for now since it's not functional and complicates the task of modifying various CTF type definitions, and we are hitting some limits in the current format which necessitate an update. No functional change intended. MFC after: 2 weeks
* x86: remove gcov kernel supportKonstantin Belousov2021-04-021-2/+1
| | | | | | Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D29529
* Teach DTrace that unaligned accesses are OK on aarch64, not just x86.Robert Watson2021-03-221-1/+1
| | | | | | MFC after: 3 days Reviewed: andrew Differential Revision: https://reviews.freebsd.org/D29369
* Tune DTrace 'aframes' for the FBT and profile providers on arm64.Robert Watson2021-03-222-4/+4
| | | | | | | | | In both cases, too few frames were trimmed, leading to exception handling or DTrace internals being exposed in stack traces exposed by D's stack() primitive. MFC after: 3 days Reviewed by: emaste, andrew
* DTrace: remove sparc64 remnants in non-contrib codeEd Maste2021-03-221-17/+0
| | | | Sponsored by: The FreeBSD Foundation
* Handle functions that use a nop in the arm64 fbtAndrew Turner2021-03-033-19/+39
| | | | | | | | | To trace leaf asm functions we can insert a single nop instruction as the first instruction in a function and trigger off this. Reviewed by: gnn Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D28132
* Reimplement the arm64 dtrace_gethrtime(), which provides theRobert Watson2021-02-191-10/+13
| | | | | | | | | | | | | high-resolution nanosecond timestamp used for the DTrace 'timestamp' built-in variable. The new implementation uses the EL0 cycle counter and frequency registers in ARMv8-A. This replaces a previous implementation that relied on an instrumentation-safe implementation of getnanotime(), which provided only timer resolution. MFC after: 3 days Reviewed by: andrew, bsdimp (older version) Useful comments appreciated: jrtc27, emaste
* arm64: Improve DDB backtrace supportJessica Clarke2021-02-011-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The existing implementation relies on each trap handler saving a normal stack frame record, which is a waste of time and space when we're already saving a trapframe to the stack. It's also wrong as it currently saves LR not ELR. Instead of patching it up, rewrite it based on the RISC-V implementation with inspiration from the amd64 implementation for how to handle vectored traps to provide an improved implementation. This includes compressing the information down to one line like other architectures rather than the highly-verbose old form that repeats itself by printing LR and FP in one frame only to print them as PC and SP in the next. It also includes printing out actually useful information about the traps that occurred, though FAR is not saved in the trapframe so we cannot print it (in general it can be clobbered between when the trap happened and now), only ESR. The AAPCS also allows the stack frame record to be located anywhere in the frame, not just the top, so the caller's SP is not at a fixed offset from the callee's FP like on almost all other architectures in existence. This means there is no way to derive the caller's SP in the unwinder, and so we have to drop that bit of (unused) state everywhere. Reviewed by: jhb, markj Differential Revision: https://reviews.freebsd.org/D28026