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.


Subset barrier support (counting barriers)
Peter Dinda [Thu, 18 Jun 2015 21:47:38 +0000 (16:47 -0500)]
palacios/include/palacios/vmm_subset.h [new file with mode: 0644]

diff --git a/palacios/include/palacios/vmm_subset.h b/palacios/include/palacios/vmm_subset.h
new file mode 100644 (file)
index 0000000..adc13de
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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) 2015, Peter Dinda <pdinda@northwestern.edu>
+ * Copyright (c) 2015, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: 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".
+ */
+
+#ifndef __VMM_SUBSET_H__
+#define __VMM_SUBSET_H__
+
+#ifdef __V3VEE__
+
+#include <palacios/vmm_types.h>
+
+/* Subset Barriers */
+
+typedef struct v3_counting_barrier {
+    // number of threads that must arrive at the barrier
+    // note that this can only be set when there is no barreir in progress
+    uint64_t      size;
+    uint64_t      count[2];
+    uint64_t      cur;
+} v3_counting_barrier_t;
+
+
+static inline void v3_init_counting_barrier(v3_counting_barrier_t *b, uint64_t size)
+{
+    b->size=size; b->count[0]=b->count[1]=0; b->cur=0;
+}
+
+static inline void v3_counting_barrier(volatile v3_counting_barrier_t *b)
+{
+    uint64_t old;
+    volatile uint64_t *curp = &(b->cur);
+    long mycur = *curp;
+    volatile uint64_t *countp = &(b->count[mycur]);
+    old = __sync_fetch_and_add(countp,1);
+
+    if (old==(b->size-1)) { 
+       // I'm the last to the party
+       *curp ^= 0x1;
+       *countp = 0;
+    } else {
+       // k1om compiler does not know what "volatile" means
+       // hence this hand-coding.
+       do { 
+           __asm__ __volatile__( "movq %1, %0" : "=r"(old) : "m"(*countp) : );
+       } while (old);
+    }
+}
+
+
+#endif
+
+#endif