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.


P-State (DVFS) control host interface
Kyle Hale, Shiva Rao, and Peter Dinda [Wed, 13 Aug 2014 00:02:08 +0000 (19:02 -0500)]
palacios/include/interfaces/vmm_pstate_ctrl.h [new file with mode: 0644]
palacios/src/interfaces/Kconfig
palacios/src/interfaces/Makefile
palacios/src/interfaces/vmm_pstate_ctrl.c [new file with mode: 0644]

diff --git a/palacios/include/interfaces/vmm_pstate_ctrl.h b/palacios/include/interfaces/vmm_pstate_ctrl.h
new file mode 100644 (file)
index 0000000..7096e17
--- /dev/null
@@ -0,0 +1,82 @@
+#ifndef __VMM_PSTATE_CTRL_H__
+#define __VMM_PSTATE_CTRL_H__
+
+/*
+ * 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) 2014, the V3VEE Project <http://www.v3vee.org>
+ * all rights reserved.
+ *
+ * Author: Kyle C. Hale <kh@u.northwestern.edu>
+ *         Shiva Rao <shiva.rao.717@gmail.com>
+ *         Peter Dinda <pdinda@northwestern.edu>
+ *
+ * This is free software.  you are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+#include <palacios/vmm_types.h>
+
+struct v3_cpu_pstate_chars {
+    // bit mask of features this host implentation has
+    uint32_t features;
+#define V3_PSTATE_EXTERNAL_CONTROL 1  // host will expose user control to Palacios
+#define V3_PSTATE_DIRECT_CONTROL   2  // host will directly manipulate HW pstate if asked by Palacios
+#define V3_PSTATE_INTERNAL_CONTROL 4  // host will deactivate its control so Palacios can manipulate hardware itself
+    uint32_t cur_mode;      // current mode (0=>NONE - host control), else one of the above
+    uint64_t min_freq_khz;  // minimum frequency that can be configed by EXTERANL_CONTROL
+    uint64_t max_freq_khz;  // maximum frequency that can be configed by EXTERANL_CONTROL
+    uint64_t cur_freq_khz;  // current selected frequency only meaningful under EXTERANL CONTROL
+    uint8_t  min_pstate;    // minimum pstate that can be configed by DIRECT_CONTROL
+    uint8_t  max_pstate;    // maximum pstate that can be configed by DIRECT_CONTROL
+    uint8_t  cur_pstate;    // current selected pstate only meaningful under DIRECT_CONTROL
+} ;
+
+
+struct v3_host_pstate_ctrl_iface {
+    // get characteristics of the implementation
+    void (*get_chars)(struct v3_cpu_pstate_chars *chars);
+    // acquire control on the caller's core
+    // ttype=V3_PSTATE_DIRECT_CONTROL or V3_PSTATE_INTERNAL_CONTROL or V3_PSTATE_EXTERNAL_CONTROL
+    void (*acquire)(uint32_t type);
+    void (*release)(void);
+    // pstate control applies if we have acquired DIRECT_CONTROL
+    void (*set_pstate)(uint8_t pstate);
+    uint8_t (*get_pstate)(void);
+    // freq control applies if we have acquired EXTERNAL_CONTROL
+    void (*set_freq)(uint64_t freq_khz);
+    uint64_t (*get_freq)(void);
+    // if we have INTERNAL_CONTROL, we do as we please
+};
+
+extern void V3_Init_Pstate_Ctrl (struct v3_host_pstate_ctrl_iface * palacios_pstate_ctrl);
+
+#ifdef __V3VEE__
+
+// get characteristics of the calling core
+void v3_get_cpu_pstate_chars(struct v3_cpu_pstate_chars *chars);
+
+// Tell the host to acquire control over this core
+void v3_acquire_pstate_ctrl(uint32_t type);
+
+// for DIRECT_CONTROL
+uint8_t v3_get_cpu_pstate(void);
+void    v3_set_cpu_pstate (uint8_t p);
+
+// for EXTERANL_CONTROL
+uint64_t v3_get_cpu_freq(void);
+void     v3_set_cpu_freq(uint64_t freq_khz);
+
+// Tell the host to release control over this core
+void v3_release_pstate_control(); 
+
+
+#endif 
+
+#endif
index 581852a..d7671a0 100644 (file)
@@ -89,6 +89,12 @@ config HOST_PWRSTAT
                Select this if you would like to access energy/power
                measurements within Palacios
 
+config HOST_PSTATE_CTRL
+    bool "Host allows us control of P-states"
+    default n
+    help
+      Select this if your host allows control of hardware P-states (DVFS)
+
 config HOST_LAZY_FPU_SWITCH
        bool "Host provides lazy FPU context switching"
        default n
index 262b6cc..63a393a 100644 (file)
@@ -10,6 +10,7 @@ obj-$(V3_CONFIG_HOST_HYPERCALL) += vmm_host_hypercall.o
 obj-$(V3_CONFIG_HOST_PCI) += host_pci.o
 obj-$(V3_CONFIG_HOST_PMU) += vmm_pmu.o
 obj-$(V3_CONFIG_HOST_PWRSTAT) += vmm_pwrstat.o
+obj-$(V3_CONFIG_HOST_PSTATE_CTRL) += vmm_pstate_ctrl.o
 obj-$(V3_CONFIG_HOST_LAZY_FPU_SWITCH) += vmm_lazy_fpu.o
 
 obj-y += null.o
diff --git a/palacios/src/interfaces/vmm_pstate_ctrl.c b/palacios/src/interfaces/vmm_pstate_ctrl.c
new file mode 100644 (file)
index 0000000..e810b47
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * 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) 2014, the V3VEE Project <http://www.v3vee.org>
+ * all rights reserved.
+ *
+ * Author: Kyle C. Hale <kh@u.northwestern.edu>
+ *         Shiva Rao <shiva.rao.717@gmail.com>
+ *         Peter Dinda <pdinda@northwestern.edu>
+ *
+ * This is free software.  you are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+#include <palacios/vmm.h>
+
+#include <interfaces/vmm_pstate_ctrl.h>
+
+static struct v3_host_pstate_ctrl_iface *pstate_ctrl_hooks = 0;
+
+
+void V3_Init_Pstate_Ctrl(struct v3_host_pstate_ctrl_iface *hooks)
+{
+    pstate_ctrl_hooks = hooks;
+
+    PrintDebug(VM_NONE, VCORE_NONE, "V3 host p-state control interface inited\n");
+
+    return;
+}
+
+
+void v3_get_cpu_pstate_chars(struct v3_cpu_pstate_chars *chars)
+{
+    if (pstate_ctrl_hooks && pstate_ctrl_hooks->get_chars) { 
+       pstate_ctrl_hooks->get_chars(chars);
+    }
+}
+
+
+void v3_acquire_pstate_ctrl(uint32_t type)
+{
+    if (pstate_ctrl_hooks && pstate_ctrl_hooks->acquire) { 
+       pstate_ctrl_hooks->acquire(type);
+    }
+}
+
+
+uint8_t v3_get_cpu_pstate(void)
+{
+    if (pstate_ctrl_hooks && pstate_ctrl_hooks->get_pstate) { 
+       return pstate_ctrl_hooks->get_pstate();
+    } else {
+       return 0;
+    }
+}
+
+void    v3_set_cpu_pstate (uint8_t p)
+{
+    if (pstate_ctrl_hooks && pstate_ctrl_hooks->set_pstate) { 
+       pstate_ctrl_hooks->set_pstate(p);
+    }
+}
+
+uint64_t v3_get_cpu_freq(void)
+{
+    if (pstate_ctrl_hooks && pstate_ctrl_hooks->get_freq) { 
+       return pstate_ctrl_hooks->get_freq();
+    } else {
+       return 0;
+    }
+}
+
+void    v3_set_cpu_freq(uint64_t f)
+{
+    if (pstate_ctrl_hooks && pstate_ctrl_hooks->set_freq) { 
+       pstate_ctrl_hooks->set_freq(f);
+    }
+}
+
+// If using direct control, relinquish
+void v3_release_pstate_control()
+{
+    if (pstate_ctrl_hooks && pstate_ctrl_hooks->release) { 
+       pstate_ctrl_hooks->release();
+    }
+}