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.


Replaced spurious V3_Print in apic.c with PrintDebug
[palacios.git] / palacios / src / palacios / vmm_telemetry.c
index 16088a2..42e7822 100644 (file)
@@ -24,8 +24,8 @@
 #include <palacios/vmm_sprintf.h>
 
 
-#ifdef CONFIG_TELEMETRY_GRANULARITY
-#define DEFAULT_GRANULARITY CONFIG_TELEMETRY_GRANULARITY
+#ifdef V3_CONFIG_TELEMETRY_GRANULARITY
+#define DEFAULT_GRANULARITY V3_CONFIG_TELEMETRY_GRANULARITY
 #else 
 #define DEFAULT_GRANULARITY 50000
 #endif
@@ -50,6 +50,10 @@ struct exit_event {
 };
 
 
+static int free_callback(struct v3_vm_info * vm, struct telemetry_cb * cb);
+static int free_exit(struct guest_info * core, struct exit_event * event);
+
+
 void v3_init_telemetry(struct v3_vm_info * vm) {
     struct v3_telemetry_state * telemetry = &(vm->telemetry);
 
@@ -61,6 +65,16 @@ void v3_init_telemetry(struct v3_vm_info * vm) {
     INIT_LIST_HEAD(&(telemetry->cb_list));
 }
 
+void v3_deinit_telemetry(struct v3_vm_info * vm) {
+    struct telemetry_cb * cb = NULL;
+    struct telemetry_cb * tmp = NULL;
+
+    list_for_each_entry_safe(cb, tmp, &(vm->telemetry.cb_list), cb_node) {
+       free_callback(vm, cb);
+    }
+}
+
+
 void v3_init_core_telemetry(struct guest_info * core) {
     struct v3_core_telemetry * telemetry = &(core->core_telem);
 
@@ -72,6 +86,18 @@ void v3_init_core_telemetry(struct guest_info * core) {
     telemetry->exit_root.rb_node = NULL;
 }
 
+void v3_deinit_core_telemetry(struct guest_info * core) {
+    struct rb_node * node = v3_rb_first(&(core->core_telem.exit_root));
+    struct exit_event * evt = NULL;
+
+    while (node) {
+       evt = rb_entry(node, struct exit_event, tree_node);
+       node = v3_rb_next(node);
+
+       free_exit(core, evt);
+    }
+}
+
 
 
 static inline struct exit_event * __insert_event(struct guest_info * info, 
@@ -141,6 +167,15 @@ static inline struct exit_event * create_exit(uint_t exit_code) {
     return evt;
 }
 
+
+
+static int free_exit(struct guest_info * core, struct exit_event * evt) {
+    v3_rb_erase(&(evt->tree_node), &(core->core_telem.exit_root));
+    V3_Free(evt);
+    return 0;
+}
+
+
 void v3_telemetry_start_exit(struct guest_info * info) {
     rdtscll(info->core_telem.vmm_start_tsc);
 }
@@ -190,6 +225,14 @@ void v3_add_telemetry_cb(struct v3_vm_info * vm,
 
 
 
+static int free_callback(struct v3_vm_info * vm, struct telemetry_cb * cb) {
+    list_del(&(cb->cb_node));
+    V3_Free(cb);
+
+    return 0;
+}
+
+
 void v3_print_telemetry(struct v3_vm_info * vm) {
     struct v3_telemetry_state * telemetry = &(vm->telemetry);
     uint64_t invoke_tsc = 0;
@@ -209,7 +252,12 @@ void v3_print_telemetry(struct v3_vm_info * vm) {
        struct exit_event * evt = NULL;
        struct rb_node * node = v3_rb_first(&(core->core_telem.exit_root));
        
-       V3_Print("Exit information for Core %d\n", core->cpu_id);
+       V3_Print("Exit information for Core %d\n", core->vcpu_id);
+
+       if (!node) { 
+           V3_Print("No information yet for this core\n");
+           continue;
+       }
 
        do {
            evt = rb_entry(node, struct exit_event, tree_node);