Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


various changes...
[palacios.git] / palacios / src / palacios / vmm_shadow_paging.c
index 4a4e719..0afc383 100644 (file)
 
 #include <palacios/vmm_direct_paging.h>
 
+
+#ifdef CONFIG_SHADOW_PAGING_TELEMETRY
+#include <palacios/vmm_telemetry.h>
+#endif
+
+#ifdef CONFIG_SYMBIOTIC_SWAP
+#include <palacios/vmm_sym_swap.h>
+#endif
+
 #ifndef CONFIG_DEBUG_SHADOW_PAGING
 #undef PrintDebug
 #define PrintDebug(fmt, args...)
@@ -61,6 +70,14 @@ 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);
   
@@ -69,6 +86,12 @@ int v3_init_shadow_page_state(struct guest_info * info) {
     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;
 }
@@ -237,15 +260,12 @@ static struct shadow_page_data * create_new_shadow_pt(struct guest_info * info)
 
 
 static int inject_guest_pf(struct guest_info * info, addr_t fault_addr, pf_error_t error_code) {
+    info->ctrl_regs.cr2 = fault_addr;
 
-#ifdef CONFIG_PROFILE_VMM
-    if (info->enable_profiler) {
-       info->profiler.guest_pf_cnt++;
-    }
+#ifdef CONFIG_SHADOW_PAGING_TELEMETRY
+    info->shdw_pg_state.guest_faults++;
 #endif
 
-    info->ctrl_regs.cr2 = fault_addr;
-
     return v3_raise_exception_with_error(info, PF_EXCEPTION, *(uint_t *)&error_code);
 }
 
@@ -269,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...?
     }