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.


Added selective per CPU initialization option
Brian Kocoloski [Sat, 14 Apr 2012 05:10:06 +0000 (01:10 -0400)]
linux_module/main.c
linux_module/palacios-stubs.c
palacios/include/palacios/vmm.h
palacios/src/palacios/vmm.c

index 62a0fb5..b24df34 100644 (file)
@@ -5,6 +5,7 @@
 
 
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/errno.h>
 #include <linux/percpu.h>
 #include <linux/fs.h>
 
 MODULE_LICENSE("GPL");
 
+// Module parameter
+int cpu_list[NR_CPUS] = {};
+int cpu_list_len = 0;
+module_param_array(cpu_list, int, &cpu_list_len, 0644);
+MODULE_PARM_DESC(cpu_list, "Comma-delimited list of CPUs that Palacios will run on");
+
 int mod_allocs = 0;
 int mod_frees = 0;
 
@@ -171,9 +178,7 @@ static int __init v3_init(void) {
 
     palacios_init_mm();
 
-
     // Initialize Palacios
-    
     palacios_vmm_init();
 
 
index 2499339..c5b0ca0 100644 (file)
@@ -36,6 +36,9 @@ static struct v3_vm_info * irq_to_guest_map[256];
 
 extern unsigned int cpu_khz;
 
+extern int cpu_list[NR_CPUS];
+extern int cpu_list_len;
+
 
 /**
  * Prints a message to the console.
@@ -496,12 +499,35 @@ static struct v3_os_hooks palacios_os_hooks = {
 
 int palacios_vmm_init( void )
 {
+    int num_cpus = num_online_cpus();
+    char * cpu_mask = NULL;
+
+    if (cpu_list_len > 0) {
+       int major = 0;
+       int minor = 0;
+       int i = 0;
+
+        cpu_mask = kmalloc((num_cpus / 8) + 1, GFP_KERNEL);
+       memset(cpu_mask, 0, (num_cpus / 8) + 1);
+        
+        for (i = 0; i < cpu_list_len; i++) {
+           if (cpu_list[i] >= num_cpus) {
+               printk("CPU (%d) exceeds number of available CPUs. Ignoring...\n", cpu_list[i]);
+               continue;
+           }
+
+            major = cpu_list[i] / 8;
+            minor = cpu_list[i] % 8;
     
+            *(cpu_mask + major) |= (0x1 << minor);
+        }
+    }
+
     memset(irq_to_guest_map, 0, sizeof(struct v3_vm_info *) * 256);
-    
+
     printk("palacios_init starting - calling init_v3\n");
     
-    Init_V3(&palacios_os_hooks, num_online_cpus());
+    Init_V3(&palacios_os_hooks, cpu_mask, num_cpus);
 
     return 0;
 
index ee74ad6..7bfb97c 100644 (file)
@@ -331,7 +331,7 @@ struct v3_interrupt {
 
 
 
-void Init_V3(struct v3_os_hooks * hooks,  int num_cpus);
+void Init_V3(struct v3_os_hooks * hooks, char * cpus, int num_cpus);
 void Shutdown_V3( void );
 
 
index 8bd6c0a..cef9ff5 100644 (file)
@@ -100,9 +100,10 @@ static void deinit_cpu(void * arg) {
 }
 
 
-
-void Init_V3(struct v3_os_hooks * hooks, int num_cpus) {
-    int i;
+void Init_V3(struct v3_os_hooks * hooks, char * cpu_mask, int num_cpus) {
+    int i = 0;
+    int minor = 0;
+    int major = 0;
 
     V3_Print("V3 Print statement to fix a Kitten page fault bug\n");
 
@@ -134,26 +135,26 @@ void Init_V3(struct v3_os_hooks * hooks, int num_cpus) {
     V3_init_checkpoint();
 #endif
 
-
-
-
     if ((hooks) && (hooks->call_on_cpu)) {
-       for (i = 0; i < num_cpus; i++) {
 
-           V3_Print("Initializing VMM extensions on cpu %d\n", i);
-           hooks->call_on_cpu(i, &init_cpu, (void *)(addr_t)i);
+        for (i = 0; i < num_cpus; i++) {
+            major = i / 8;
+            minor = i % 8;
 
-           if (v3_mach_type == V3_INVALID_CPU) {
-               v3_mach_type = v3_cpu_types[i];
-           }
+            if ((cpu_mask == NULL) || (*(cpu_mask + major) & (0x1 << minor))) {
+                V3_Print("Initializing VMM extensions on cpu %d\n", i);
+                hooks->call_on_cpu(i, &init_cpu, (void *)(addr_t)i);
 
-       }
+               if (v3_mach_type == V3_INVALID_CPU) {
+                   v3_mach_type = v3_cpu_types[i];
+               }   
+            }
+        }
     }
-
-
 }
 
 
+
 void Shutdown_V3() {
     int i;