From: George Dunlap Subject: [PATCH] xenalyze: Handle all MMIO events Date: Mon, 22 Nov 2010 12:40:17 +0000 Message-ID: <4e88187c91bae8b0f74a.1290429617@gdunlap-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: george.dunlap@eu.citrix.com List-Id: xen-devel@lists.xenproject.org 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 diff -r 2a404c7a4fa2 -r 4e88187c91ba xenalyze.c --- a/xenalyze.c Mon Nov 22 12:38:56 2010 +0000 +++ b/xenalyze.c Mon Nov 22 12:39:38 2010 +0000 @@ -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 0x200 void 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: ; }