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.


gcc-instrumenation added
changb [Mon, 9 Feb 2009 03:26:37 +0000 (21:26 -0600)]
build/Makefile
palacios/build/Makefile
palacios/include/palacios/vmm_instrument.h [new file with mode: 0644]
palacios/src/palacios/vmm.c
palacios/src/palacios/vmm_instrument.c [new file with mode: 0644]

index a217d7d..012e2f8 100644 (file)
@@ -160,6 +160,9 @@ ifeq ($(PROFILE_VMM),1)
   GEEKOS_FLAGS:= $(GEEKOS_FLAGS) PROFILE_VMM=1
 endif
 
+ifeq ($(INSTRUMENT_VMM),1)
+  GEEKOS_FLAGS:= $(GEEKOS_FLAGS) INSTRUMENT_VMM=1
+endif
 
 # ----------------------------------------------------------------------
 # Targets -
index e93fd63..8fbe2a2 100644 (file)
@@ -217,6 +217,9 @@ endif
 
 
 
+ifeq ($(INSTRUMENT_VMM),1)
+  EXTRA_C_OPTS:= -DINSTRUMENT_VMM
+endif
 
 # ----------------------------------------------------------------------
 # Configuration -
@@ -270,6 +273,7 @@ VMM_OBJS := \
        palacios/vmm_profiler.o \
        palacios/vmm_direct_paging.o \
        palacios/vmm_ringbuffer.o \
+       palacios/vmm_instrument.o \
 
 #              vmx.c vmcs_gen.c vmcs.c
 
@@ -403,7 +407,11 @@ CC_GENERAL_OPTS = \
 #-fPIC \
 #-fvisibility=hidden
 
-
+ifeq ($(INSTRUMENT_VMM),1)
+       INSTRUMENT_OPT = -finstrument-functions
+else
+       INSTRUMENT_OPT = 
+endif
 
 # Flags passed to objcopy program (strip unnecessary sections from kernel.exe)
 OBJCOPY_FLAGS := -R .dynamic -R .note -R .comment
@@ -440,6 +448,7 @@ CC_COMPILE = \
                -c \
                $< \
                -o $@ \
+               $(INSTRUMENT_OPT) \
        )
 
 AS_COMPILE = \
@@ -449,6 +458,7 @@ AS_COMPILE = \
                -c \
                $< \
                -o $@ \
+               $(INSTRUMENT_OPT) \
        )
 
 
diff --git a/palacios/include/palacios/vmm_instrument.h b/palacios/include/palacios/vmm_instrument.h
new file mode 100644 (file)
index 0000000..f9e1176
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
+ * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Chang Bae <c.s.bae@u.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+#ifndef __VMM_INSTRUMENT_H__
+#define __VMM_INSTRUMENT_H__
+
+#ifdef __V3VEE__
+
+#ifdef INSTRUMENT_VMM 
+
+#include <palacios/vmm_types.h>
+#include <palacios/vmm_ringbuffer.h>
+
+ullong_t now, last;
+
+int instrument_start;
+
+struct Inst_RingBuff *ring_buff;
+
+struct PackData *pack_data;
+
+void __attribute__((__no_instrument_function__)) v3_init_cyg_profiler ();
+void __attribute__((__no_instrument_function__))
+__cyg_profile_func_enter( void *this, void *callsite );
+void __attribute__((__no_instrument_function__)) 
+__cyg_profile_func_exit( void *this, void *callsite );
+
+
+#endif // INSTRUMENT_VMM
+
+#endif // __V3VEE__
+
+#endif // 
+
+
index 6ef7fa1..8459e4c 100644 (file)
@@ -23,6 +23,7 @@
 #include <palacios/vmm_intr.h>
 #include <palacios/vmm_config.h>
 #include <palacios/vm_guest.h>
+#include <palacios/vmm_instrument.h>
 
 
 v3_cpu_arch_t v3_cpu_type;
@@ -43,7 +44,9 @@ void Init_V3(struct v3_os_hooks * hooks, struct v3_ctrl_ops * vmm_ops) {
 
   v3_cpu_type = V3_INVALID_CPU;
 
-
+       #ifdef INSTRUMENT_VMM
+           v3_init_cyg_profiler();
+       #endif
 
   if (v3_is_svm_capable()) {
 
diff --git a/palacios/src/palacios/vmm_instrument.c b/palacios/src/palacios/vmm_instrument.c
new file mode 100644 (file)
index 0000000..e67f818
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
+ * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Chang Bae <c.s.bae@u.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+#ifdef INSTRUMENT_VMM
+#include <palacios/svm_handler.h>
+#include <palacios/vmm_instrument.h>
+#include <palacios/vmm_ringbuffer.h>
+void __attribute__((__no_instrument_function__)) v3_init_cyg_profiler (){
+
+// initialize
+
+       v3_Inst_RingBuff_init (&ring_buff, 2048); //dequeue at every 4095
+       
+       instrument_start = 1;
+       
+}
+
+static void inline __attribute__((__no_instrument_function__)) read_cyg_profiler (){
+
+               while( v3_Inst_RingBuff_data_size(ring_buff) > 0) {
+
+               v3_Inst_RingBuff_read (ring_buff, pack_data, 1); 
+               PrintDebug("CYG_PROF: %d %8lu %08x %08x\n", pack_data->state, (unsigned long)pack_data->time, pack_data->cur_fn, pack_data->pre_fn);    
+       
+               }       
+}
+
+void __attribute__((__no_instrument_function__))
+__cyg_profile_func_enter( void *this, void *callsite )
+{
+               
+       if(instrument_start > 0) {
+
+       rdtscll(now);
+       
+       if((v3_Inst_RingBuff_data_size(ring_buff) % 500) == 0 || v3_Inst_RingBuff_data_size(ring_buff) == 4095) {
+       read_cyg_profiler();
+       }
+  
+  
+  pack_data->time = now - last; //time spent previous
+  pack_data->state = 0; //enter to be 0
+  pack_data->cur_fn = (unsigned int)this; //this
+  pack_data->pre_fn = (unsigned int)callsite; //callsite
+
+       v3_Inst_RingBuff_write (ring_buff, pack_data, 1);  
+
+  rdtscll(now);
+  last = now;
+       }
+}
+
+void __attribute__((__no_instrument_function__)) 
+__cyg_profile_func_exit( void *this, void *callsite )
+{
+       if(instrument_start > 0 ) {
+       rdtscll(now);
+
+       if((v3_Inst_RingBuff_data_size(ring_buff) % 500) == 0 || v3_Inst_RingBuff_data_size(ring_buff) == 4095) {
+       read_cyg_profiler();
+       }
+  
+  pack_data->time = now - last; //time spent previous
+  pack_data->state = 1; //exit to be 0
+  pack_data->cur_fn = (unsigned int)this; //this
+  pack_data->pre_fn = (unsigned int)callsite; //callsite
+  
+  v3_Inst_RingBuff_write (ring_buff, pack_data, 1);
+  
+  rdtscll(now);
+  last = now;
+       }
+}
+
+#endif