Skip to contentSkip to conversation

domain setup per allocation strategies

PATCH In review Dulloor 1 participant 1 message Apr 4, 2010

lore
Share & tools
lore

Dulloor

author
#0 lore raw

PATCH 7/11 domain setup per allocation strategies

This patch use the previously constructed domain numa-layout info to setup the domain memory. The domain vcpus are pinned according to allocation strategy in the following way :
- CONFINE : all vcpus are pinned to the node cpus
- STRIPE : all vcpus are pinned to the logical-or of the subset of node cpus
- SPLIT : vcpus are pinned to the node from which the vnode is allocated

Also, in case of SPLIT, the domain is made aware of the virtual NUMA enlightenment through a flag in xen_start_info (SIF_NUMA_DOMAIN).

-dulloor

tools/libxc/xc_dom_core.c +2 -2
diff -r 3004092c4792 -r aa6ed694499d tools/libxc/xc_dom_core.c
@@ -681,10 +681,10 @@
 
     xc_dom_printf("%s: 0x%" PRIpfn " pages\n", __FUNCTION__, dom->total_pages);
 
-    if (xc_setup_domain_numa_layout(dom))
+    if (xc_setup_numa_domain(dom))
     {
         /* Ignore the error and proceed as non-numa guest */
-        xc_dom_printf("%s: xc_setup_domain_layout failed\n", __FUNCTION__);
+        xc_dom_printf("%s: xc_setup_numa_domain failed\n", __FUNCTION__);
     }
 
     return 0;
tools/libxc/xc_dom_numa.c +193 -27

295 lines not on this page · raw message

tools/libxc/xc_dom_numa.h +22 -10
diff -r 3004092c4792 -r aa6ed694499d tools/libxc/xc_dom_numa.h
@@ -3,19 +3,31 @@
 
 #define XC_MAX_NODES 8
 
-struct xc_machine_numa_layout {
-    uint64_t memsize;
-    uint64_t memfree;
-
-    uint32_t max_nodes;
-    uint32_t node_distance[XC_MAX_NODES*XC_MAX_NODES];
-    struct xenmem_node_data node_data[XC_MAX_NODES];
-};
-typedef struct xc_machine_numa_layout xc_machine_numa_layout_t;
 typedef struct xen_domain_numa_layout xc_domain_numa_layout_t;
 
-extern int xc_setup_domain_numa_layout(struct xc_dom_image *dom);
+extern int xc_setup_numa_domain(struct xc_dom_image *dom);
+extern int xc_domain_numa_pinvcpus(struct xc_dom_image *dom, 
+                                struct xen_domain_numa_layout *pv_layout);
+
 extern int xc_domain_nodemem_distribution(struct xc_dom_image *dom);
+extern int __xc_domain_numa_layout(uint32_t cmd, int xc_handle, domid_t domid, 
+                                struct xen_domain_numa_layout *pv_layout);
+
+
+static inline int xc_get_domain_numa_layout(struct xc_dom_image *dom,
+                                    struct xen_domain_numa_layout *layout)
+{
+    return __xc_domain_numa_layout(
+        XENMEM_get_domain_numa_layout, dom->guest_xc, dom->guest_domid, layout);
+}
+
+static inline int xc_set_domain_numa_layout(struct xc_dom_image *dom,
+                                    struct xen_domain_numa_layout *layout)
+{
+    return __xc_domain_numa_layout(
+        XENMEM_set_domain_numa_layout, dom->guest_xc, dom->guest_domid, layout);
+}
+
 extern void dump_guest_numa_layout(struct xc_dom_image *dom,
                                         xc_domain_numa_layout_t *layout);
 #endif
tools/libxc/xc_dom_x86.c +158 -5

209 lines not on this page · raw message

xen/arch/x86/mm.c +7 -3
diff -r 3004092c4792 -r aa6ed694499d xen/arch/x86/mm.c
@@ -4615,9 +4615,13 @@
                             return -EFAULT;
                         }
                     }
-                    break;
-                }
-
+                    printk("XENMEM_memnode_map : %u, %d, %lu\n",
+                            map->bufsize, memnode_shift, memnodemapsize);
+
+                    break;
+                }
+
+            case XENMEM_get_domain_numa_layout:
             case XENMEM_set_domain_numa_layout:
                 {
                     struct xenmem_domain_numa_layout *layout;
xen/include/public/memory.h +2 -1
diff -r 3004092c4792 -r aa6ed694499d xen/include/public/memory.h
@@ -271,7 +271,7 @@
 DEFINE_XEN_GUEST_HANDLE(xen_foreign_memory_map_t);
 
 
-/* Returns numa related info */
+/* xen guest numa operations */
 #define XENMEM_numa_op           15
 
 #define XEN_DOM_NUMA_INTERFACE_VERSION  0x00000001
@@ -353,6 +353,7 @@
 
 struct xenmem_domain_numa_layout {
     domid_t domid;
+    uint32_t version;
 
     uint32_t bufsize;
     XEN_GUEST_HANDLE(void) buf;
xen/include/public/xen.h +1 -0
diff -r 3004092c4792 -r aa6ed694499d xen/include/public/xen.h
@@ -590,6 +590,7 @@
 #define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
 #define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
 #define SIF_MULTIBOOT_MOD (1<<2)  /* Is mod_start a multiboot module? */
+#define SIF_NUMA_DOMAIN   (1<<3)  /* Is the domain NUMA aware ? */
 #define SIF_PM_MASK       (0xFF<<8) /* reserve 1 byte for xen-pm options */
 
 /*

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel