xenalyze: Handle all MMIO events
PATCH 1/1 xenalyze: Handle all MMIO events
Use a generic mmio-assist post processor if no other post-process functions are present.
This will make sure we catch not only APIC_ACCESS vmexits, but also NPF vmexits (and any future hardware innovations).
Signed-off-by George Dunlap <[email protected]>
xenalyze.c +22 -17
@@ -1829,11 +1829,14 @@ } interval; } P = { 0 }; +/* Function prototypes */ char *pcpu_string (int pcpu);void process_generic (struct record_info *ri);void dump_generic (FILE *f,struct record_info *ri);ssize_t __read_record (int fd,struct trace_record *rec,loff_t offset);void error (enum error_level l,struct record_info *ri); +void update_io_address (struct io_address ** list,unsigned int pa,int dir, +tsc_t arc_cycles,unsigned int va);void cpumask_init (cpu_mask_t *c) { *c =0UL ;
@@ -3542,6 +3545,20 @@ } +/* Also called by shadow_mmio_postprocess */ +void enumerate_mmio (struct hvm_data *h) +{ +struct pf_xen_extra *e = &h->inflight.pf_xen; + +if ( e->mmio_data_valid ) +update_io_address (&h->summary.mmio, e->gpa, e->mmio_is_write, h->arc_cycles, e->va); +} + +void hvm_mmio_assist_postprocess (struct hvm_data *h) +{ +if ( opt.with_mmio_enumeration ) +enumerate_mmio (h); +}#define HVM_IO_ASSIST_WRITE 0x200void hvm_mmio_assist_process (struct record_info *ri,struct hvm_data *h)
@@ -3594,6 +3611,11 @@if ((e->gpa &0xfffff000 ) ==0xfee00000 )hvm_vlapic_handler (h); + +/* Catch MMIOs that don't go through the shadow code */ +if ( h->post_process ==NULL ) + h->post_process = hvm_mmio_assist_postprocess; + }void hvm_inj_virq_process (struct record_info *ri,struct hvm_data *h) {
@@ -4520,21 +4542,6 @@ } } -/* Also called by shadow_mmio_postprocess */ -void enumerate_mmio (struct hvm_data *h) -{ -struct pf_xen_extra *e = &h->inflight.pf_xen; - -if ( e->mmio_data_valid ) -update_io_address (&h->summary.mmio, e->gpa, e->mmio_is_write, h->arc_cycles, e->va); -} - -void hvm_apic_access_postprocess (struct hvm_data *h) -{ -if ( opt.with_mmio_enumeration ) -enumerate_mmio (h); -} -void hvm_npf_process (struct record_info *ri,struct hvm_data *h) {struct {
@@ -5040,8 +5047,6 @@case EXIT_REASON_EXCEPTION_NMI : h->post_process = hvm_exception_nmi_generic_postprocess;break ; -case EXIT_REASON_APIC_ACCESS : - h->post_process = hvm_apic_access_postprocess;default : ; }