fdeb273d | 23-Nov-2024 |
Mark Johnston <markj@FreeBSD.org> |
dtrace: Add some more annotations for KMSAN
- Don't allow FBT and kinst to instrument the KMSAN runtime. - When fetching data from the traced thread's stack, mark it as initialized. It may well b
dtrace: Add some more annotations for KMSAN
- Don't allow FBT and kinst to instrument the KMSAN runtime. - When fetching data from the traced thread's stack, mark it as initialized. It may well be uninitialized, but as dtrace permits arbitrary inspection of kernel memory, it isn't very useful to raise KMSAN reports. - Mark data copied in from userspace as initialized, as we do for copyin() etc. using interceptors.
MFC after: 2 weeks
show more ...
|
5d12db2d | 22-Nov-2024 |
Mark Johnston <markj@FreeBSD.org> |
dtrace: Avoid excessive pcpu allocations
We were previously allocating MAXCPU structures for several purposes, but this is generally unnecessary and is quite excessive, especially after MAXCPU was b
dtrace: Avoid excessive pcpu allocations
We were previously allocating MAXCPU structures for several purposes, but this is generally unnecessary and is quite excessive, especially after MAXCPU was bumped to 1024 on amd64 and arm64. We already are careful to allocate only as many per-CPU tracing buffers as are needed; extend this to other allocations.
For example, in a 2-vCPU VM, the size of a consumer state structure drops from 64KB to 128B. The size of the per-consumer `dts_buffer` and `dts_aggbuffer` arrays shrink similarly. Ditto for pre-allocations of local and global D variable storage space.
MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47667
show more ...
|
cc3da195 | 22-Nov-2024 |
Mark Johnston <markj@FreeBSD.org> |
dtrace/amd64: Make invop providers usable with KMSAN enabled
- Use a fresh context when entering dtrace_invop() via a breakpoint exception. - Mark the #BP trapframe as initialized.
MFC after: 2 w
dtrace/amd64: Make invop providers usable with KMSAN enabled
- Use a fresh context when entering dtrace_invop() via a breakpoint exception. - Mark the #BP trapframe as initialized.
MFC after: 2 weeks
show more ...
|
5bd7b976 | 19-Sep-2024 |
Mark Johnston <markj@FreeBSD.org> |
dtrace_test: Remove the dependency on dtraceall
FBT refuses to create probes in modules which depend on dtrace(all), but dtrace_test is a convenient place to add functions specifically for testing d
dtrace_test: Remove the dependency on dtraceall
FBT refuses to create probes in modules which depend on dtrace(all), but dtrace_test is a convenient place to add functions specifically for testing dtrace.
The dependency on dtraceall is not needed, so just remove it. In fact, it can be useful to test SDT probe creation by loading dtrace_test with and without dtraceall loaded.
Reviewed by: avg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46673
show more ...
|
bae00433 | 20-Jun-2024 |
Mark Johnston <markj@FreeBSD.org> |
dtrace: Add a partial implementation of dtrace_getarg() on arm64
For invop providers (i.e., fbt and kinst) we can simply reach into the invop trapframe to fetch argument registers for arguments 0-7;
dtrace: Add a partial implementation of dtrace_getarg() on arm64
For invop providers (i.e., fbt and kinst) we can simply reach into the invop trapframe to fetch argument registers for arguments 0-7; for argument 8 and beyond we have to read the value off of the stack.
Reviewed by: Domagoj Stolfa, avg MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D45649
show more ...
|
ddf0ed09 | 19-Jun-2024 |
Mark Johnston <markj@FreeBSD.org> |
sdt: Implement SDT probes using hot-patching
The idea here is to avoid a memory access and conditional branch per probe site. Instead, the probe is represented by an "unreachable" unconditional fun
sdt: Implement SDT probes using hot-patching
The idea here is to avoid a memory access and conditional branch per probe site. Instead, the probe is represented by an "unreachable" unconditional function call. asm goto is used to store the address of the probe site (represented by a no-op sled) and the address of the function call into a tracepoint record. Each SDT probe carries a list of tracepoints.
When the probe is enabled, the no-op sled corresponding to each tracepoint is overwritten with a jmp to the corresponding label. The implementation uses smp_rendezvous() to park all other CPUs while the instruction is being overwritten, as this can't be done atomically in general. The compiler moves argument marshalling code and the sdt_probe() function call out-of-line, i.e., to the end of the function.
Per gallatin@ in D43504, this approach has less overhead when probes are disabled. To make the implementation a bit simpler, I removed support for probes with 7 arguments; nothing makes use of this except a regression test case. It could be re-added later if need be.
The approach taken in this patch enables some more improvements: 1. We can now automatically fill out the "function" field of SDT probe names. The SDT macros let the programmer specify the function and module names, but this is really a bug and shouldn't have been allowed. The intent was to be able to have the same probe in multiple functions and to let the user restrict which probes actually get enabled by specifying a function name or glob. 2. We can avoid branching on SDT_PROBES_ENABLED() by adding the ability to include blocks of code in the out-of-line path. For example:
if (SDT_PROBES_ENABLED()) { int reason = CLD_EXITED;
if (WCOREDUMP(signo)) reason = CLD_DUMPED; else if (WIFSIGNALED(signo)) reason = CLD_KILLED; SDT_PROBE1(proc, , , exit, reason); }
could be written
SDT_PROBE1_EXT(proc, , , exit, reason, int reason;
reason = CLD_EXITED; if (WCOREDUMP(signo)) reason = CLD_DUMPED; else if (WIFSIGNALED(signo)) reason = CLD_KILLED; );
In the future I would like to use this mechanism more generally, e.g., to remove branches and marshalling code used by hwpmc, and generally to make it easier to add new tracepoint consumers without having to add more conditional branches to hot code paths.
Reviewed by: Domagoj Stolfa, avg MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D44483
show more ...
|