- Hypervisor Patterns
- Xen Style: a native (bare-metal) hypervisor running directly on processors. Create domains for VMs.
- KVM style: hypervisor run/administered by Host OS kernel. H/w access via Kernel Modules.
-
Xen style, runs I/O proxy (like QEMU) in domain0. KVM style on host OS.
-
AMD-V&Intel VT-xextensions bring processor virtualization support. -
Paravirtualizationhas guest OS aware of virtual machine, making hypercalls to hypervisor for efficiency. Xen batches these calls into multicall.
Now, Xen VMs boot in H/w VM (HVM), then use PV.. hence PVHVM.
-
@Guests: BPF to check virtualized h/w perf; hypercall latency; stolen CPU time; hypervisor interrupt callbacks.
-
@Hosts: Instrument VM exits; I/O proxy workload & latency; prior tools for perf.
-
Guests sometimes have tracepoints for Xen Hypercalls.
-
Hosts have top/trace tools for hypervisor provided, like
xl top,xentrace.
- Xen Hypercalls using
funccount, trace, argdist, stackcount; get PV status viadmesg | grep Hypervisor. Likefunccount 't:xen:*'.
argdist -C 't:xen:xen_mc_flush():int:args->mcidx' ## counting Hypercalls
stackcount 't:xen:xen_mc_issue' ## hypercall stacks
funclatency xen_mc_flush ## hypercall latency
-
xenhyper, bpftrace tool counts hyperalls viaxen:xen_mc_entrytp. -
When Xen calls guest,
/proc/interruptsget grep-ableHYPXen callback entries. Trace viabpftrace -e 'kprobe:xen_evtchn_do_upcall { @[comm] = count(); }'. -
cpustolen, bpftrace tool list stolen CPU time dist. Cab also include time in VMM on behalf of guest. Similar code
#!bpftrace
BEGIN {
printf("Tracing stolen CPU time. Ctrl-C to end.\n");
}
kretprobe:xen_steal_clock, kretprobe:kvm_steal_clock {
if (@last[cpu] > 0) {
@stolen_us = hist((retval - @last[cpu]) / 1000);
}
@last[cpu] = retval;
}
END {
clear(@last);
}
kvmexits, bpftrace tool to show guest exit time dist. Works by tracingkvm:kvm_exit&kvm:kvm_entry.