Commit d95df95
kvm: tracing: Fix unmatched kvm_entry and kvm_exit events
On VMX, if we exit and then re-enter immediately without leaving
the vmx_vcpu_run() function, the kvm_entry event is not logged.
That means we will see one (or more) kvm_exit, without its (their)
corresponding kvm_entry, as shown here:
CPU-1979 [002] 89.871187: kvm_entry: vcpu 1
CPU-1979 [002] 89.871218: kvm_exit: reason MSR_WRITE
CPU-1979 [002] 89.871259: kvm_exit: reason MSR_WRITE
It also seems possible for a kvm_entry event to be logged, but then
we leave vmx_vcpu_run() right away (if vmx->emulation_required is
true). In this case, we will have a spurious kvm_entry event in the
trace.
Fix these situations by moving trace_kvm_entry() inside vmx_vcpu_run()
(where trace_kvm_exit() already is).
A trace obtained with this patch applied looks like this:
CPU-14295 [000] 8388.395387: kvm_entry: vcpu 0
CPU-14295 [000] 8388.395392: kvm_exit: reason MSR_WRITE
CPU-14295 [000] 8388.395393: kvm_entry: vcpu 0
CPU-14295 [000] 8388.395503: kvm_exit: reason EXTERNAL_INTERRUPT
Of course, not calling trace_kvm_entry() in common x86 code any
longer means that we need to adjust the SVM side of things too.
Signed-off-by: Lorenzo Brescia <lorenzo.brescia@edu.unito.it>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Message-Id: <160873470698.11652.13483635328769030605.stgit@Wayrath>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent 01ead84 commit d95df95
3 files changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3739 | 3739 | | |
3740 | 3740 | | |
3741 | 3741 | | |
| 3742 | + | |
| 3743 | + | |
3742 | 3744 | | |
3743 | 3745 | | |
3744 | 3746 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6653 | 6653 | | |
6654 | 6654 | | |
6655 | 6655 | | |
| 6656 | + | |
| 6657 | + | |
6656 | 6658 | | |
6657 | 6659 | | |
6658 | 6660 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8992 | 8992 | | |
8993 | 8993 | | |
8994 | 8994 | | |
8995 | | - | |
8996 | | - | |
8997 | 8995 | | |
8998 | 8996 | | |
8999 | 8997 | | |
| |||
11560 | 11558 | | |
11561 | 11559 | | |
11562 | 11560 | | |
| 11561 | + | |
11563 | 11562 | | |
11564 | 11563 | | |
11565 | 11564 | | |
| |||
0 commit comments