X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_shadow_paging.c;h=0afc383269000e456d57847a5cdfc6c5d86a1973;hp=b2d3b6cacd09cf5908cec479abee765e27e344fd;hb=0e097100a26bc43eb8964734fa43130fc4c71429;hpb=39849abeb743c4e6b669a790c307979fa8d51884 diff --git a/palacios/src/palacios/vmm_shadow_paging.c b/palacios/src/palacios/vmm_shadow_paging.c index b2d3b6c..0afc383 100644 --- a/palacios/src/palacios/vmm_shadow_paging.c +++ b/palacios/src/palacios/vmm_shadow_paging.c @@ -30,7 +30,16 @@ #include -#ifndef DEBUG_SHADOW_PAGING + +#ifdef CONFIG_SHADOW_PAGING_TELEMETRY +#include +#endif + +#ifdef CONFIG_SYMBIOTIC_SWAP +#include +#endif + +#ifndef CONFIG_DEBUG_SHADOW_PAGING #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -51,7 +60,7 @@ struct shadow_page_data { static struct shadow_page_data * create_new_shadow_pt(struct guest_info * info); -static void inject_guest_pf(struct guest_info * info, addr_t fault_addr, pf_error_t error_code); +static int inject_guest_pf(struct guest_info * info, addr_t fault_addr, pf_error_t error_code); static int is_guest_pf(pt_access_status_t guest_access, pt_access_status_t shadow_access); @@ -61,13 +70,28 @@ static int is_guest_pf(pt_access_status_t guest_access, pt_access_status_t shado +#ifdef CONFIG_SHADOW_PAGING_TELEMETRY +static void telemetry_cb(struct guest_info * info, void * private_data, char * hdr) { + V3_Print("%s Guest Page faults: %d\n", hdr, info->shdw_pg_state.guest_faults); +} +#endif + + + int v3_init_shadow_page_state(struct guest_info * info) { struct shadow_page_state * state = &(info->shdw_pg_state); state->guest_cr3 = 0; state->guest_cr0 = 0; + state->guest_efer.value = 0x0LL; INIT_LIST_HEAD(&(state->page_list)); + +#ifdef CONFIG_SHADOW_PAGING_TELEMETRY + if (info->enable_telemetry) { + v3_add_telemetry_cb(info, telemetry_cb, NULL); + } +#endif return 0; } @@ -235,13 +259,14 @@ static struct shadow_page_data * create_new_shadow_pt(struct guest_info * info) } -static void inject_guest_pf(struct guest_info * info, addr_t fault_addr, pf_error_t error_code) { - if (info->enable_profiler) { - info->profiler.guest_pf_cnt++; - } - +static int inject_guest_pf(struct guest_info * info, addr_t fault_addr, pf_error_t error_code) { info->ctrl_regs.cr2 = fault_addr; - v3_raise_exception_with_error(info, PF_EXCEPTION, *(uint_t *)&error_code); + +#ifdef CONFIG_SHADOW_PAGING_TELEMETRY + info->shdw_pg_state.guest_faults++; +#endif + + return v3_raise_exception_with_error(info, PF_EXCEPTION, *(uint_t *)&error_code); } @@ -264,12 +289,19 @@ static int is_guest_pf(pt_access_status_t guest_access, pt_access_status_t shado return 1; } - if ((shadow_access == PT_ACCESS_NOT_PRESENT) && - (guest_access == PT_ACCESS_NOT_PRESENT)) { + /* + if ((shadow_access == PT_ACCESS_NOT_PRESENT) && + (guest_access == PT_ACCESS_NOT_PRESENT)) { + // Page tables completely blank, handle guest first + return 1; + } + */ + + if (guest_access == PT_ACCESS_NOT_PRESENT) { // Page tables completely blank, handle guest first return 1; } - + // Otherwise we'll handle the guest fault later...? }