@@ -952,6 +952,7 @@ enum {
HVM_EVENT_VLAPIC,
HVM_EVENT_XCR_READ,
HVM_EVENT_XCR_WRITE,
+ HVM_EVENT_VMRUN,
HVM_EVENT_HANDLER_MAX
};
const char * hvm_event_handler_name[HVM_EVENT_HANDLER_MAX] = {
@@ -989,7 +990,8 @@ const char * hvm_event_handler_name[HVM_EVENT_HANDLER_MAX] = {
"trap_debug",
"vlapic",
"xcr_read",
- "xcr_write"
+ "xcr_write",
+ "vmrun"
};
enum {
@@ -4610,6 +4612,19 @@ void hvm_rdtsc_process(struct record_info *ri, struct hvm_data *h)
h->last_rdtsc = r->tsc;
}
+
+void hvm_vmrun_process(struct record_info *ri, struct hvm_data *h)
+{
+ struct {
+ uint64_t vmcbaddr;
+ } *r = (typeof(r))h->d;
+
+ if ( opt.dump_all )
+ printf(" %s vmrun %llx\n",
+ ri->dump_header,
+ (unsigned long long)r->vmcbaddr);
+}
+
void hvm_generic_summary(struct hvm_data *h, void *data)
{
long evt = (long)data;
@@ -4910,6 +4925,9 @@ needs_vmexit:
case TRC_HVM_RDTSC:
hvm_rdtsc_process(ri, h);
break;
+ case TRC_HVM_VMRUN:
+ hvm_vmrun_process(ri, h);
+ break;
case TRC_HVM_DR_READ:
case TRC_HVM_DR_WRITE:
case TRC_HVM_CPUID:
@@ -2177,6 +2177,8 @@ svm_vmexit_do_vmrun(struct cpu_user_regs *regs,
return;
}
+ TRACE(TRC_HVM_VMRUN, vmcbaddr, vmcbaddr >> 32);
+
vcpu_nestedhvm(v).nv_vmentry_pending = 1;
return;
}
@@ -222,6 +222,7 @@
#define TRC_HVM_VLAPIC (TRC_HVM_HANDLER + 0x25)
#define TRC_HVM_XCR_READ64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x26)
#define TRC_HVM_XCR_WRITE64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x27)
+#define TRC_HVM_VMRUN (TRC_HVM_HANDLER + 0x28)
#define TRC_HVM_IOPORT_WRITE (TRC_HVM_HANDLER + 0x216)
#define TRC_HVM_IOMEM_WRITE (TRC_HVM_HANDLER + 0x217)
Note that this trace is SVM-specific. Most HVM handler traces are shared between VMX and SVM because the underlying instruction set is largely the equivalent; but in this case, the instructions are different enough that there's no sensible way to share HVM handler traces between them. Keeping the target VMCB address should allow future analysis of which L2 vcpu within an L1 is running. Signed-off-by: George Dunlap <george.dunlap@cloud.com> --- tools/xentrace/xenalyze.c | 20 +++++++++++++++++++- xen/arch/x86/hvm/svm/svm.c | 2 ++ xen/include/public/trace.h | 1 + 3 files changed, 22 insertions(+), 1 deletion(-)