diff mbox series

[WIP,04/14] xenalyze: Track generic event information when not in summary mode

Message ID 20240626133853.4150731-5-george.dunlap@cloud.com (mailing list archive)
State New, archived
Headers show
Series AMD Nested Virt Preparation | expand

Commit Message

George Dunlap June 26, 2024, 1:38 p.m. UTC
Generally speaking, a VMEXIT/VMENTRY cycle should have at least three
trace records: the VMEXIT trace (which contains the processor-specific
exit code), a more generic Xen-based Xen event (an HVM_HANDLER trace
record), and a VMEXIT trace; and any given VMEXIT exit reason should
only have a single HVM_HANDLER trace type.  Having duplicate or
missing HVM_HANDLER traces is generally indicative of a problem that's
crept in in the hypervisor tracing scheme.

This is property is checked in hvm_generic_postprocess(), and
violations are flagged with a warning.  In order to do this, when an
HVM trace record that doesn't have a specific post-processor happens,
information about the HVM trace record is stored in
hvm_data->inflight.generic.

Unfortunately, while the check was being done in all "modes", the
relevant information was only being copied into inflight.generic in
summary mode.  This resulted in spurious warnings about missing
HVM_HANDLER traces when running in dump mode.

Since running in dump mode is often critical to understanding how the
warnings came about, just collect the information always as well.

That said, the data from the trace doesn't appear to be used by
anyone; so to save some time, don't bother copying it.

Signed-off-by: George Dunlap <george.dunlap@cloud.com>
---
 tools/xentrace/xenalyze.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 52ee7a5f9f..46248e9a70 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -1367,7 +1367,6 @@  struct hvm_data {
             } msr;
             struct {
                 unsigned int event;
-                uint32_t d[4];
             } generic;
             struct {
                 unsigned eax;
@@ -4572,8 +4571,7 @@  void hvm_npf_process(struct record_info *ri, struct hvm_data *h)
                (unsigned long long)r->gpa, r->qualification,
                (unsigned long long)r->mfn, r->p2mt);
 
-    if ( opt.summary_info )
-        hvm_generic_postprocess_init(ri, h);
+    hvm_generic_postprocess_init(ri, h);
 }
 
 void hvm_rdtsc_process(struct record_info *ri, struct hvm_data *h)
@@ -4621,7 +4619,6 @@  void hvm_generic_postprocess_init(struct record_info *ri, struct hvm_data *h)
         fprintf(warn, "%s: Strange, h->postprocess set!\n",
                 __func__);
     h->inflight.generic.event = ri->event;
-    bcopy(h->d, h->inflight.generic.d, sizeof(unsigned int) * 4);
 }
 
 void hvm_generic_postprocess(struct hvm_data *h)
@@ -4899,8 +4896,7 @@  needs_vmexit:
     default:
         if(opt.dump_all)
             hvm_generic_dump(ri, "]");
-        if(opt.summary_info)
-            hvm_generic_postprocess_init(ri, h);
+        hvm_generic_postprocess_init(ri, h);
         break;
     }
 }
@@ -6166,11 +6162,10 @@  void shadow_fault_generic_process(struct record_info *ri, struct hvm_data *h)
 
     /* pf-case traces, vs others */
     h->inflight.generic.event = ri->event;
-    bcopy(ri->d, h->inflight.generic.d, sizeof(unsigned int) * 4);
 
     if(opt.dump_all)
-        shadow_fault_generic_dump(h->inflight.generic.event,
-                                  h->inflight.generic.d,
+        shadow_fault_generic_dump(ri->event,
+                                  ri->d,
                                   "]", ri->dump_header);
 
     h->inflight.pf_xen.pf_case = sevt.minor;