Expand description
The tracing engine: a session shared by all vCPUs, and one
VcpuTracer per vCPU.
The engine does not run the guest. Whoever owns the vCPU (your Rust
VMM through crate::kvm::KvmTracer, or QEMU through the interposer)
runs it one step at a time and calls VcpuTracer::on_stop each time
it stops. on_stop receives the state after the previous step,
which is also the state before the next one, so a single register
read per step is enough:
stop k-1 step k stop k
───●────────────[ instruction ]────────●──────▶
│ pre-state of k │ post-state of k
│ decode, plan accesses, │ = pre-state of k+1
│ predict successor │ classify step k, emit recordsStructs§
- File
Sink - Writes
trace_<vcpu>.raw(MacSim) andvcpu<vcpu>.kvt(extended) into a directory. - Memory
Sink - Keeps every record in memory, behind a shared handle; handy in tests.
- Null
Sink - Discards everything.
- Session
- A tracing session: options, output directory, and the state all vCPUs share (breakpoints, global sequence, statistics).
- Stats
- A snapshot of a session’s counters.
- Stop
Action - What the owner of the vCPU must do before running it again.
- Token
- Proof that this vCPU holds the serialization token; dropping it passes the token to the next waiting vCPU.
- Trace
Options - Everything you can switch on and off.
- Vcpu
Tracer - The tracer for one vCPU.
Enums§
- Ordering
- How steps of different vCPUs are ordered against each other.
- Stop
Reason - Why the vCPU stopped.
Constants§
- PACING_
WINDOW - How many instructions an interrupt window (see
TraceOptions::interrupt_pacing) stays open. A few, so that an interrupt pending while the guest briefly has IF = 0 still gets in.
Traits§
- Stop
Context - Services the tracer needs from whoever owns the vCPU, at a stop.
- Trace
Sink - Where a vCPU’s records go.