#define HVM_VMX_EXIT_REASON_MAX (EXIT_REASON_XSETBV+1)
char * hvm_vmx_exit_reason_name[HVM_VMX_EXIT_REASON_MAX] = {
- [0] = "NONE",
[EXIT_REASON_EXCEPTION_NMI]="EXCEPTION_NMI",
[EXIT_REASON_EXTERNAL_INTERRUPT]="EXTERNAL_INTERRUPT",
[EXIT_REASON_TRIPLE_FAULT]="TRIPLE_FAULT",
s->count++;
}
-static inline void clear_interval_summary(struct event_cycle_summary *s) {
- s->interval.count = 0;
- s->interval.cycles = 0;
-}
-
static inline void update_cycles(struct cycle_summary *s, long long c) {
/* We don't know ahead of time how many samples there are, and working
* with dynamic stuff is a pain, and unnecessary. This algorithm will
e->instructions = 0;
}
+#if 0
static inline void update_cpi(struct weighted_cpi_summary *s,
unsigned long long i,
unsigned long long c) {
s->interval.count = 0;
s->interval.instructions = 0;
}
+#endif
static inline void print_cpu_affinity(struct cycle_summary *s, char *p) {
if(s->count) {
}
}
+int cr3_time_compare(const void *_a, const void *_b) {
+ struct cr3_value_struct *a=*(typeof(&a))_a;
+ struct cr3_value_struct *b=*(typeof(&a))_b;
+
+ if(a->total_time.interval.cycles < b->total_time.interval.cycles)
+ return 1;
+ else if(b->total_time.interval.cycles == a->total_time.interval.cycles) {
+ if(a->total_time.interval.count < b->total_time.interval.count)
+ return 1;
+ else if(a->total_time.interval.count == b->total_time.interval.count)
+ return 0;
+ else
+ return -1;
+ } else
+ return -1;
+}
+
void interval_cr3_schedule_ordered_output(void) {
struct cr3_value_struct *p;
int i;
struct cr3_value_struct **qsort_array;
int N=0;
- int cr3_time_compare(const void *_a, const void *_b) {
- struct cr3_value_struct *a=*(typeof(&a))_a;
- struct cr3_value_struct *b=*(typeof(&a))_b;
-
- if(a->total_time.interval.cycles < b->total_time.interval.cycles)
- return 1;
- else if(b->total_time.interval.cycles == a->total_time.interval.cycles) {
- if(a->total_time.interval.count < b->total_time.interval.count)
- return 1;
- else if(a->total_time.interval.count == b->total_time.interval.count)
- return 0;
- else
- return -1;
- } else
- return -1;
- }
-
for(p=P.cr3.head; p; p=p->gnext)
N++;
update_summary(&p->summary, cycles);
}
+int eip_compare(const void *_a, const void *_b) {
+ struct eip_list_struct *a=*(typeof(&a))_a;
+ struct eip_list_struct *b=*(typeof(&a))_b;
+
+ if(a->summary.cycles < b->summary.cycles)
+ return 1;
+ else if(b->summary.cycles == a->summary.cycles) {
+ if(a->summary.count < b->summary.count)
+ return 1;
+ else if(a->summary.count == b->summary.count)
+ return 0;
+ else
+ return -1;
+ } else
+ return -1;
+}
+
void dump_eip(struct eip_list_struct *head) {
struct eip_list_struct *p;
int i;
struct eip_list_struct **qsort_array;
int N=0;
- int eip_compare(const void *_a, const void *_b) {
- struct eip_list_struct *a=*(typeof(&a))_a;
- struct eip_list_struct *b=*(typeof(&a))_b;
-
- if(a->summary.cycles < b->summary.cycles)
- return 1;
- else if(b->summary.cycles == a->summary.cycles) {
- if(a->summary.count < b->summary.count)
- return 1;
- else if(a->summary.count == b->summary.count)
- return 0;
- else
- return -1;
- } else
- return -1;
- }
-
for(p=head; p; p=p->next)
{
total += p->summary.count;
return o;
}
+void ipi_send(struct vcpu_data *ov, int vec)
+{
+ struct vlapic_struct *vla;
+ struct outstanding_ipi *o = NULL;
+
+ if(ov->runstate.state == RUNSTATE_LOST) {
+ if(opt.dump_all)
+ fprintf(warn, "%s: v%d in state RUNSTATE_LOST, not counting ipi\n",
+ __func__, ov->vid);
+ return;
+ }
+
+ vla = &ov->vlapic;
+
+ o = find_vec(vla, vec);
+
+ if(!o)
+ {
+ fprintf(warn, "%s: Couldn't find an open slot!\n",
+ __func__);
+ return;
+ }
+
+ if(!o->first_tsc)
+ o->first_tsc = P.now;
+
+ if(opt.dump_all && o->count == 0 && o->injected)
+ printf(" [vla] Pre-injection\n");
+
+ o->count++;
+
+ if((opt.dump_all)
+#if 0
+ && (ov->runstate.state != RUNSTATE_RUNNING
+ || ov->hvm.vmexit_valid)
+#endif
+ )
+ printf(" [vla] d%dv%d vec %d state %s (outstanding ipis %d)\n",
+ ov->d->did, ov->vid,
+ o->vec,
+ runstate_name[ov->runstate.state],
+ o->count);
+}
+
void hvm_vlapic_icr_handler(struct hvm_data *h)
{
struct mmio_info *m = &h->inflight.mmio;
};
} icr = { .val = m->data };
- void ipi_send(struct vcpu_data *ov, int vec)
- {
- struct vlapic_struct *vla;
- struct outstanding_ipi *o = NULL;
-
- if(ov->runstate.state == RUNSTATE_LOST) {
- if(opt.dump_all)
- fprintf(warn, "%s: v%d in state RUNSTATE_LOST, not counting ipi\n",
- __func__, ov->vid);
- return;
- }
-
- vla = &ov->vlapic;
-
- o = find_vec(vla, vec);
-
- if(!o)
- {
- fprintf(warn, "%s: Couldn't find an open slot!\n",
- __func__);
- return;
- }
-
- if(!o->first_tsc)
- o->first_tsc = P.now;
-
- if(opt.dump_all && o->count == 0 && o->injected)
- printf(" [vla] Pre-injection\n");
-
- o->count++;
-
- if((opt.dump_all)
-#if 0
- && (ov->runstate.state != RUNSTATE_RUNNING
- || ov->hvm.vmexit_valid)
-#endif
- )
- printf(" [vla] d%dv%d vec %d state %s (outstanding ipis %d)\n",
- ov->d->did, ov->vid,
- o->vec,
- runstate_name[ov->runstate.state],
- o->count);
- }
-
if(m->is_write) {
if(opt.dump_all) {
printf(" [vla] d%dv%d icr vec %d %s\n",
gmfn, cr3->prealloc_unpin.count);
}
+int cr3_compare_start(const void *_a, const void *_b) {
+ struct cr3_value_struct *a=*(typeof(&a))_a;
+ struct cr3_value_struct *b=*(typeof(&a))_b;
+
+ if(a->first_time > b->first_time)
+ return 1;
+ else if(b->first_time == a->first_time)
+ return 0;
+ else
+ return -1;
+}
+
void cr3_dump_list(struct cr3_value_struct *head){
struct cr3_value_struct *p;
struct cr3_value_struct **qsort_array;
int i, N=0;
- int cr3_compare_start(const void *_a, const void *_b) {
- struct cr3_value_struct *a=*(typeof(&a))_a;
- struct cr3_value_struct *b=*(typeof(&a))_b;
-
- if(a->first_time > b->first_time)
- return 1;
- else if(b->first_time == a->first_time)
- return 0;
- else
- return -1;
- }
-
if(!head)
return;