aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl
Commit message (Collapse)AuthorAgeFilesLines
...
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2719-22/+1
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* sys: Remove ancient SCCS tags.Warner Losh2023-11-276-6/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* boot/zfs: Add some fields to dsl_dir_phys_tMark Johnston2023-10-231-1/+14
| | | | | | | | Most of the first block of pad bytes are now used for space accounting purposes. No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace: remove x86 non-EARLY_AP_STARTUP supportEd Maste2023-10-102-56/+0
| | | | | | | | After 792655abd64c EARLY_AP_STARTUP is mandatory for x86. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42139
* dtrace: fix fbt regression for aarch64Igor Ostapenko2023-10-031-9/+8
| | | | | | | | | | | | | | | fbt computes incorrect instruction position for AArch64 kernel module symbol. The issue is with the for loop, it does an extra increment of instr pointer after the required instruction is found. Hence, a wrong instruction is targeted for patching. Signed-off-by: Igor Ostapenko <pm@igoro.pro> Fixes: 980746e5cb26 ("fbt: simplify arm64 function-prologue parsing") Reviewed by: markj Pull Request: https://github.com/freebsd/freebsd-src/pull/855 MFC after: 1 week
* kinst: do not look for a function epilogueChristos Margiolis2023-09-152-14/+15
| | | | | | | | | | | | | kinst currently only traces functions that start and end with the usual function prologue and epilogue respectively. Ignoring functions that do not have an epilogue however, makes the filtering too strict, as this means that we can not trace functions that never return (e.g vnlru_proc()). This patch relaxes the filtering and only checks whether the function pushes the frame pointer. Reviewed by: markj Approved by: markj Differential Revision: https://reviews.freebsd.org/D41876
* dtrace: Fix a kernel panic in printm()Domagoj Stolfa2023-09-061-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | When using printm(), one should always pass a scratch pointer to it. This is achieved by calling printm with memref BEGIN { printm(fixed_len, memref(ptr, var_len)); } which will return a pointer to the DTrace scratch space of size sizeof(uintptr_t) * 2. However, one can easily call printm() as follows BEGIN { printm(10, (void *)NULL); } and panic the kernel as a result. This commit does two things: (1) adds a new macro DTRACE_INSCRATCHPTR(mstate, ptr, howmany) which checks if a certain pointer is in the DTrace scratch space; (2) uses DTRACE_INSCRATCHPTR() to implement a check on printm()'s DIFO return value in order to avoid the panic and sets CPU_DTRACE_BADADDR if the address is not in the scratch space. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D41722
* sys: Remove $FreeBSD$: one-line catalogWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*\$\s*\$FreeBSD\$$\n/
* sys: Remove $FreeBSD$: one-line bare tagWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\$FreeBSD\$$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-167-14/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-161-1/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-168-8/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1693-186/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* kinst.h: make pointer to probe in kinst_cpu_state constChristos Margiolis2023-07-191-1/+1
| | | | | | | Fixes: 5b701ed19c2e ("kinst: start moving towards per-probe trampolines") Sponsored by: The FreeBSD Foundation
* Revert "dtrace: cache current probe in kdtrace_thread_t"Christos Margiolis2023-07-191-2/+0
| | | | | | | | | | | This reverts commit 22508c8b6c284ad9ad1385c703e224e1ed3fbd7c. The t_kinst_curprobe field is no longer needed by kinst. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41031
* kinst: port to arm64Christos Margiolis2023-07-192-0/+481
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40337
* kinst: use per-probe trampolines in riscvChristos Margiolis2023-07-191-71/+42
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40963
* kinst: start moving towards per-probe trampolinesChristos Margiolis2023-07-193-5/+61
| | | | | | | | | | | | | | | | | | | | | | Using per-CPU and per-thread trampolines is expensive and error-prone, since we're rewriting the same memory blocks constantly. Per-probe trampolines solve this problem by giving each probe its own block of executable memory, which more or less remains the same after the initial write. What this patch does, is get rid of the initialization code which allocates a trampoline for each thread, and instead let each port of kinst allocate a trampoline for each new probe created. It also sets up the infrastructure needed to support the new trampoline scheme. This change is not currently supported on amd64, as the amd64 port needs further changes to work, so this is a temporary/gradual patch to fix the riscv and arm64 ports. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40962
* kinst: exclude cpu_switchChristos Margiolis2023-07-191-0/+7
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40985
* kinst: check for 'push %rbp' anywhere in the functionChristos Margiolis2023-07-191-6/+17
| | | | | | | | | | | | | Currently kinst checks if only the first instruction is 'push %rbp', essentially excluding functions that do push RBP, but not in the first instruction. This patch modifies kinst to check for 'push %rbp', as well, as a following 'pop %rbp', anywhere in the function. This behavior also matches that of FBT. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40283
* kinst.h: reorder function declarations based on implementation fileChristos Margiolis2023-07-191-6/+9
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41032
* Don't bother to check COMPAT_32BIT when __LP64__ is definedJessica Clarke2023-07-091-2/+2
| | | | | | | | Under COMPAT_32BIT we are compiling 32-bit code and so __LP64__ is not defined, __ILP32__ is, and thus the check is completely redundant. Reviewed by: brooks, jhb, imp Differential Revision: https://reviews.freebsd.org/D40917
* inline_fls: remove redundant INLINE_FLS testDoug Moore2023-07-061-2/+2
| | | | | | | HAS_INLINE_FLS and similar macros are defined always. Removes the redundant tests for these always-true conditions. Reviewed by: mhorne Differential Revision: https://reviews.freebsd.org/D40707
* kinst: update LICENSE headersChristos Margiolis2023-07-045-8/+28
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40875
* kinst: port to riscvChristos Margiolis2023-07-042-0/+647
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39884
* dtrace: cache current probe in kdtrace_thread_tChristos Margiolis2023-07-041-0/+2
| | | | | | | | | Needed by the forthcoming RISC-V and ARM64 ports. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40872
* dtrace/arm64: Fix user memory access routinesMark Johnston2023-06-151-7/+9
| | | | | | | | | | Use unprivileged loads to access user memory. Without this, the accesses trap and various dtrace actions such as ustack() fail. Reviewed by: andrew MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40540
* dtrace/arm64: Store the fault address when suppressing a page faultMark Johnston2023-06-151-1/+1
| | | | | | Reviewed by: andrew Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40539
* arm64: Remove struct arm64_frameMark Johnston2023-06-151-1/+1
| | | | | | | | | | | It was used in one place and was added specifically to support dtrace stack unwinding code. Write an equivalent expression using struct unwind_state instead. No functional change intended. Reviewed by: andrew MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40538
* kinst: rename t_kinst to t_kinst_trampChristos Margiolis2023-06-133-10/+11
| | | | | | | | | | | | | The forthcoming RISC-V and ARM64 ports of kinst introduce a new field named "t_kinst_curprobe", so "t_kinst" (which points to a trampoline) becomes a misleading name. No functional change intended. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40507
* kinst: hide KINST_TRAMPCHUNK_SIZE from ISA-specific headersChristos Margiolis2023-06-132-1/+1
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40505
* kinst: fix kinst_probe_md field indentationChristos Margiolis2023-06-031-9/+9
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40411
* kinst: use bool where appropriateChristos Margiolis2023-06-033-12/+12
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40412
* kinst: simplify trampoline fill definitionsChristos Margiolis2023-06-032-5/+6
| | | | | | | | | | | Centralize KINST_TRAMP_FILL_PATTERN and KINST_TRAMP_FILL_SIZE to reduce redefinitions, and use the architecture-dependent kinst_patchval_t as their size. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40406
* fbt: simplify arm64 function-prologue parsingChristos Margiolis2023-06-031-26/+16
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40364
* dtrace: deduplicate arm64 breakpoint definitionChristos Margiolis2023-06-032-4/+7
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40363
* dtrace: deduplicate some RISC-V functionsChristos Margiolis2023-05-304-69/+90
| | | | | | | | | | match_opcode() is defined in FBT, kinst, and dtrace_subr.c. The function prologue-checking functions are defined in FBT and kinst. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40335
* kinst: fix memcpy() tracing crashChristos Margiolis2023-05-263-3/+25
| | | | | | | | | | | | Tracing memcpy() would crash the kernel, because we'd also trace the memcpy() calls from kinst_invop(). To fix this, introduce kinst_memcpy() whose arguments are 'volatile', so that we avoid having the compiler replace it with a regular memcpy(). Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40284
* kinst: add kinst_excluded()Christos Margiolis2023-05-263-1/+64
| | | | | | | | | Exclude functions that are not safe-to-trace. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation ifferential Revision: https://reviews.freebsd.org/D39229
* kinst: be explicit about trampoline placementChristos Margiolis2023-05-251-6/+13
| | | | | | | | | | | The current implementation and comment was specific to amd64. Even though in the case of kinst's supported architectures (RISC-V and ARM64) VM_MIN_KERNEL_ADDRESS is equal to KERNBASE, it's better to be explicit. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40266
* kinst: use dtrace_dis_get_byte() instead of own copyChristos Margiolis2023-05-231-13/+1
| | | | | | | | | No functional change intended. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39872
* dtrace: rename rp to frame in dtrace_getreg()Christos Margiolis2023-05-236-71/+71
| | | | | | | Reviewed by: mhorne, markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40231
* dtrace: add register bindings for arm64Christos Margiolis2023-05-232-5/+48
| | | | | | | Reviewed by: mhorne, markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39956
* dtrace: implement dtrace_instr_size() for arm64Christos Margiolis2023-05-231-0/+14
| | | | | | | Reviewed by: markj Approved by; markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39955
* dtrace: remove ifdef around dtrace_instr_size()Christos Margiolis2023-05-231-2/+0
| | | | | | | | | | | | Architectures that are not included in the #ifdef won't be able to compile libdtrace. This was tested on an ARM64 build. If the ifdef is removed, libdtrace can be compiled with no problems, otherwise it fails at libdtrace. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39948
* kinst: replace KINST_TRAMP_INITChristos Margiolis2023-05-232-13/+21
| | | | | | | | | | | | | | The current implementation of KINST_TRAMP_INIT is working only on amd64, where the breakpoint instruction is one byte long, which might not be the case for other architectures (e.g in RISC-V it's either 2 or 4 bytes). This patch introduces two machine-dependent constants, KINST_TRAMP_FILL_PATTERN and KINST_TRAMP_FILL_SIZE, which hold the fill instruction and the size of that instruction in bytes respectively. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39504
* dtrace: export dtrace_dis_get_byte()Christos Margiolis2023-05-222-1/+6
| | | | | | | | | | | | kinst uses this function as well, but because it is not exported, it implements its own copy of it. The patch also exposes the function to userland, so programs that need to use dtrace_disx86() can use this function instead of rolling their own copies. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39871
* fbt/x86: update FBT_AFRAMES to match the trap handlersChuck Silvers2023-05-111-2/+4
| | | | | | Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D40054
* stand: remove ZFS warning about computered but unused variableWarner Losh2023-05-011-1/+1
| | | | | | | Toss a __unused on the unexpected_errors variable. We compute it, but never use it. Sponsored by: Netflix
* kinst: test lock in kinst_trampoline_dealloc_locked()Christos Margiolis2023-05-011-0/+2
| | | | | | | Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39883