> uprobes currently always require entering the kernel to log anything.
> While that works well, it is rather slow.
> 
> Modern Intel CPUs have the ptwrite instruction, which can log data to
> the Processor Trace buffer. Add support in uprobes for patching PTWRITE
> instead of kernel entries. When a user collects Processor Trace with perf
> the logged data will appear in the PT log, otherwise the instructions will
> be nops.
> 
> PTWRITE provides much faster logging, but it is missing various
> features that the full featured probes have.
> 
> The instrumentation is similar to optimized uprobes. Add a trampoline
> page. Replace the original instruction (5 byte nop) with a jump
> to the trampoline. The nop restriction will be relaxed in a later patch.
> The trampoline does ptwrites and then jumps back.
> 
> Build the high-level infrastructure without any x86-64-specific
> parts (except for one data structure). Add register/unregister, basic data
> structures and high level hooks. Add weak stubs to handle the no uprobes
> or different architectures case.
> 
> Assisted-by: omp:gpt-5.6-luna
> Signed-off-by: Andi Kleen <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1


Reply via email to