xref: /aosp_15_r20/external/bcc/examples/tracing/kvm_hypercall.txt (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1*387f9dfdSAndroid Build Coastguard WorkerDemonstrations of kvm_hypercall.py, showing eBPF/bcc based hypercall analysis
2*387f9dfdSAndroid Build Coastguard Worker
3*387f9dfdSAndroid Build Coastguard WorkerThis example demonstrates how we can statefully save static tracepoint
4*387f9dfdSAndroid Build Coastguard Workerevents based on conditions being met for other events with which they are
5*387f9dfdSAndroid Build Coastguard Workerassociated. Here, we wish to record kvm_exit and kvm_entry events which are
6*387f9dfdSAndroid Build Coastguard Workerlinked to the kvm_hypercall event. We are interested in kvm_exit with exit
7*387f9dfdSAndroid Build Coastguard Workerreason as VMCALL (18). This may be useful to analyze latency caused by a
8*387f9dfdSAndroid Build Coastguard Workerhypercall itself.
9*387f9dfdSAndroid Build Coastguard Worker
10*387f9dfdSAndroid Build Coastguard WorkerTo test this, while the python script is run, induce a hypercall from a
11*387f9dfdSAndroid Build Coastguard Workerguest based on the following example:
12*387f9dfdSAndroid Build Coastguard Workerhttps://gist.github.com/abenbachir/344822b5ba9fc5ac384cdec3f087e018
13*387f9dfdSAndroid Build Coastguard Worker
14*387f9dfdSAndroid Build Coastguard Worker# ./kvm_hypercall.py
15*387f9dfdSAndroid Build Coastguard WorkerTIME(s)            COMM             PID    MESSAGE
16*387f9dfdSAndroid Build Coastguard Worker2445.577087000     CPU 0/KVM        8896   KVM_EXIT exit_reason : 18
17*387f9dfdSAndroid Build Coastguard Worker2445.577122000     CPU 0/KVM        8896   HYPERCALL nr : 0
18*387f9dfdSAndroid Build Coastguard Worker2445.577129000     CPU 0/KVM        8896   KVM_ENTRY vcpu_id : 0
19*387f9dfdSAndroid Build Coastguard Worker2445.577136000     CPU 0/KVM        8896   KVM_EXIT exit_reason : 18
20*387f9dfdSAndroid Build Coastguard Worker2445.577145000     CPU 0/KVM        8896   HYPERCALL nr : 1
21*387f9dfdSAndroid Build Coastguard Worker2445.577149000     CPU 0/KVM        8896   KVM_ENTRY vcpu_id : 0
22*387f9dfdSAndroid Build Coastguard Worker2445.577155000     CPU 0/KVM        8896   KVM_EXIT exit_reason : 18
23*387f9dfdSAndroid Build Coastguard Worker2445.577160000     CPU 0/KVM        8896   HYPERCALL nr : 2
24*387f9dfdSAndroid Build Coastguard Worker2445.577164000     CPU 0/KVM        8896   KVM_ENTRY vcpu_id : 0
25*387f9dfdSAndroid Build Coastguard Worker2445.577170000     CPU 0/KVM        8896   KVM_EXIT exit_reason : 18
26*387f9dfdSAndroid Build Coastguard Worker2445.577175000     CPU 0/KVM        8896   HYPERCALL nr : 3
27*387f9dfdSAndroid Build Coastguard Worker2445.577179000     CPU 0/KVM        8896   KVM_ENTRY vcpu_id : 0
28*387f9dfdSAndroid Build Coastguard Worker2445.577185000     CPU 0/KVM        8896   KVM_EXIT exit_reason : 18
29*387f9dfdSAndroid Build Coastguard Worker2445.577190000     CPU 0/KVM        8896   HYPERCALL nr : 4
30*387f9dfdSAndroid Build Coastguard Worker2445.577194000     CPU 0/KVM        8896   KVM_ENTRY vcpu_id : 0
31*387f9dfdSAndroid Build Coastguard Worker
32*387f9dfdSAndroid Build Coastguard WorkerThis output shows a sequence of exit -> hypercall -> entry where the
33*387f9dfdSAndroid Build Coastguard Workerexit_reason was VMCALL.
34