• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Demonstrations of kvm_hypercall.py, showing eBPF/bcc based hypercall analysis
2
3This example demonstrates how we can statefully save static tracepoint
4events based on conditions being met for other events with which they are
5associated. Here, we wish to record kvm_exit and kvm_entry events which are
6linked to the kvm_hypercall event. We are interested in kvm_exit with exit
7reason as VMCALL (18). This may be useful to analyze latency caused by a
8hypercall itself.
9
10To test this, while the python script is run, induce a hypercall from a
11guest based on the following example:
12https://gist.github.com/abenbachir/344822b5ba9fc5ac384cdec3f087e018
13
14# ./kvm_hypercall.py
15TIME(s)            COMM             PID    MESSAGE
162445.577087000     CPU 0/KVM        8896   KVM_EXIT exit_reason : 18
172445.577122000     CPU 0/KVM        8896   HYPERCALL nr : 0
182445.577129000     CPU 0/KVM        8896   KVM_ENTRY vcpu_id : 0
192445.577136000     CPU 0/KVM        8896   KVM_EXIT exit_reason : 18
202445.577145000     CPU 0/KVM        8896   HYPERCALL nr : 1
212445.577149000     CPU 0/KVM        8896   KVM_ENTRY vcpu_id : 0
222445.577155000     CPU 0/KVM        8896   KVM_EXIT exit_reason : 18
232445.577160000     CPU 0/KVM        8896   HYPERCALL nr : 2
242445.577164000     CPU 0/KVM        8896   KVM_ENTRY vcpu_id : 0
252445.577170000     CPU 0/KVM        8896   KVM_EXIT exit_reason : 18
262445.577175000     CPU 0/KVM        8896   HYPERCALL nr : 3
272445.577179000     CPU 0/KVM        8896   KVM_ENTRY vcpu_id : 0
282445.577185000     CPU 0/KVM        8896   KVM_EXIT exit_reason : 18
292445.577190000     CPU 0/KVM        8896   HYPERCALL nr : 4
302445.577194000     CPU 0/KVM        8896   KVM_ENTRY vcpu_id : 0
31
32This output shows a sequence of exit -> hypercall -> entry where the
33exit_reason was VMCALL.
34