Revision tags: release/14.0.0 |
|
#
5b701ed1 |
| 19-Jul-2023 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: start moving towards per-probe trampolines
Using per-CPU and per-thread trampolines is expensive and error-prone, since we're rewriting the same memory blocks constantly. Per-probe trampoline
kinst: start moving towards per-probe trampolines
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
show more ...
|
#
9310bf54 |
| 04-Jul-2023 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: update LICENSE headers
Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40875
|
#
1aa48621 |
| 13-Jun-2023 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: rename t_kinst to t_kinst_tramp
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 misleadin
kinst: rename t_kinst to t_kinst_tramp
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
show more ...
|
#
33373127 |
| 13-Jun-2023 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: hide KINST_TRAMPCHUNK_SIZE from ISA-specific headers
Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40
kinst: hide KINST_TRAMPCHUNK_SIZE from ISA-specific headers
Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40505
show more ...
|
#
9b091f12 |
| 03-Jun-2023 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: simplify trampoline fill definitions
Centralize KINST_TRAMP_FILL_PATTERN and KINST_TRAMP_FILL_SIZE to reduce redefinitions, and use the architecture-dependent kinst_patchval_t as their size.
kinst: simplify trampoline fill definitions
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
show more ...
|
#
855ade9e |
| 25-May-2023 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: be explicit about trampoline placement
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_KERNE
kinst: be explicit about trampoline placement
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
show more ...
|
#
ecca3180 |
| 23-May-2023 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: replace KINST_TRAMP_INIT
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 arch
kinst: replace KINST_TRAMP_INIT
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
show more ...
|
#
e11d11c5 |
| 01-May-2023 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: test lock in kinst_trampoline_dealloc_locked()
Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39883
|
Revision tags: release/13.2.0 |
|
#
ad5d6f38 |
| 08-Dec-2022 |
Mark Johnston <markj@FreeBSD.org> |
kinst: Correct a comment
Fixes: f0bc4ed144fc ("kinst: Initial revision")
|
Revision tags: release/12.4.0 |
|
#
73a78b5e |
| 14-Oct-2022 |
Mark Johnston <markj@FreeBSD.org> |
kinst: Clarify a comment in the trampoline allocator
Fixes: f0bc4ed144fc ("kinst: Initial revision")
|
#
b4e483bd |
| 13-Oct-2022 |
Mark Johnston <markj@FreeBSD.org> |
kinst: Remove an unused constant
This was left over after a rework of the trampoline allocator.
Fixes: f0bc4ed144fc ("kinst: Initial revision")
|
#
f0bc4ed1 |
| 11-Oct-2022 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: Initial revision
This is a new DTrace provider which allows arbitrary kernel instructions to be traced. Currently it is implemented only for amd64.
kinst probes are created on demand by lib
kinst: Initial revision
This is a new DTrace provider which allows arbitrary kernel instructions to be traced. Currently it is implemented only for amd64.
kinst probes are created on demand by libdtrace, and there is a probe for each kernel instruction. Probes are named kinst:<module>:<function>:<offset>, where "offset" is the offset of the target instruction relative to the beginning of the function. Omitting "offset" causes all instructions in the function to be traced.
kinst works similarly to FBT in that it places a breakpoint on the target instruction and hooks into the kernel breakpoint handler. Because kinst has to be able to trace arbitrary instructions, it does not emulate most of them in software but rather causes the traced thread to execute a copy of the instruction before returning to the original code.
The provider is quite low-level and as-is will be useful mostly only to kernel developers. However, it provides a great deal of visibility into kernel code execution and could be used as a building block for higher-level tooling which can in some sense translate between C sources and generated machine code. In particular, the "regs" variable recently added to D allows the CPU's register file to be accessed from kinst probes.
kinst is experimental and should not be used on production systems for now.
In collaboration with: markj Sponsored by: Google, Inc. (GSoC 2022) MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D36851
show more ...
|