George Dunlap
2011-Mar-02 20:13 UTC
[Xen-devel] [PATCH] xenalyze: Unify setting of vcpu data type
# HG changeset patch # User George Dunlap <george.dunlap@eu.citrix.com> # Date 1299096700 0 # Node ID df4a4a3e8a606e274209030fe64776a971d39e5f # Parent 3ef6e80faa4584837b55a58b8ffdd379e8ad0071 xenalyze: Unify setting of vcpu data type Also initialize the hvm struct when the type is set, not when the first vmexit happens. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> diff -r 3ef6e80faa45 -r df4a4a3e8a60 xenalyze.c --- a/xenalyze.c Wed Mar 02 20:11:40 2011 +0000 +++ b/xenalyze.c Wed Mar 02 20:11:40 2011 +0000 @@ -1889,6 +1889,7 @@ void update_io_address(struct io_address ** list, unsigned int pa, int dir, tsc_t arc_cycles, unsigned int va); int check_extra_words(struct record_info *ri, int expected_size, const char *record); +int vcpu_set_data_type(struct vcpu_data *v, int type); void cpumask_init(cpu_mask_t *c) { *c = 0UL; @@ -5290,12 +5291,10 @@ struct hvm_data *h = &v->hvm; assert(p->current); - assert(p->current->data_type == VCPU_DATA_NONE - || p->current->data_type == VCPU_DATA_HVM); - - if(!v->data_type) - v->data_type = VCPU_DATA_HVM; - + + if(vcpu_set_data_type(p->current, VCPU_DATA_HVM)) + return; + if(ri->evt.sub == 2) { UPDATE_VOLUME(p, hvm[HVM_VOL_HANDLER], ri->size); @@ -6214,8 +6213,8 @@ int gpl = sevt.paging_levels + 2; assert(p->current); - assert(p->current->data_type == VCPU_DATA_NONE - || p->current->data_type == VCPU_DATA_HVM); + if(vcpu_set_data_type(p->current, VCPU_DATA_HVM)) + return; h = &p->current->hvm; @@ -6543,8 +6542,8 @@ union pv_event pevt = { .event = ri->event }; - assert(p->current->data_type == VCPU_DATA_NONE - || p->current->data_type == VCPU_DATA_PV); + if(vcpu_set_data_type(p->current, VCPU_DATA_PV)) + return; if(opt.summary_info) { pv->summary_info=1; @@ -7686,6 +7685,26 @@ } } +int vcpu_set_data_type(struct vcpu_data *v, int type) +{ + if (v->data_type == VCPU_DATA_NONE ) + { + v->data_type = type; + switch(type) + { + case VCPU_DATA_HVM: + init_hvm_data(&v->hvm, v); + break; + default: + break; + } + } + else + assert(v->data_type == type); + return 0; +} + + void lose_vcpu(struct vcpu_data *v, tsc_t tsc) { if(v->data_type == VCPU_DATA_HVM) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel