numa-guest-support elfnote
PATCH 8/11 numa-guest-support elfnote
This patch add numa-guest-support to the xen feature elfnote and uses that to determine if a PV guest image is capable of understanding virtual NUMA enlightenment.
-dulloor
Signed-off-by Dulloor Rao <[email protected]>
tools/libxc/xc_dom.h +3 -0
@@ -114,6 +114,9 @@int (*allocate) (struct xc_dom_image * dom,xen_vaddr_t up_to); }; +#define XC_DOM_IS_NUMA_GUEST (dom) \ + (elf_xen_feature_get(XENFEAT_numa_guest_support, (dom)->parms.f_supported)) +/* --- pluggable kernel loader ------------------------------------- */ struct xc_dom_loader {
tools/libxc/xc_dom_numa.c +12 -9
@@ -409,7 +409,7 @@static int xc_select_domain_vnodes (struct xc_dom_image *dom,xc_machine_numa_layout_t *phys_layout,xc_domain_numa_layout_t *pv_layout) { -int i; +int i, numa_split_supported;uint32_t page_shift, numa_strategy;xen_pfn_t pv_dom_pages;
@@ -439,21 +439,24 @@return -1 ; } +if (!XC_DOM_IS_NUMA_GUEST (dom)) +xc_dom_printf ("%s: Image doesn't support guest numa\n" , __FUNCTION__); +if (!XC_POWER_OF_2 (pv_layout->max_vcpus)) +xc_dom_printf ("%s: #vcpus != 2^n (disable numa split)\n" , __FUNCTION__); + numa_split_supported = + (XC_DOM_IS_NUMA_GUEST (dom) &&XC_POWER_OF_2 (pv_layout->max_vcpus)); +/* Attempt to confine or split the VM */ for (i = 1; i <= phys_layout->max_nodes; i<<=1) { uint64_t vnode_size_pages; vnode_size_pages = pv_dom_pages/i; - if ((vnode_size_pages << page_shift) < XC_VNODE_MIN_SIZE) - break; + if ((vnode_size_pages << page_shift) < XC_VNODE_MIN_SIZE) break; - /* Not enough vcpus to distribute over */ - if (pv_layout->max_vcpus < (i*XC_VCPUS_PER_VNODE)) - break; - - if ((i > 1) && !XC_POWER_OF_2(pv_layout->max_vcpus)) - break; + if ((i > 1) && !numa_split_supported) break; + /* Not enough vcpus to distribute */ + if (pv_layout->max_vcpus < (i*XC_VCPUS_PER_VNODE)) break; memset(node_pages_selected, 0, sizeof(node_pages_selected)); if (!xc_select_best_fit_nodes(phys_layout, i, vnode_size_pages,
xen/common/kernel.c +2 -0
@@ -244,6 +244,8 @@ (1U << XENFEAT_highmem_assist) | (1U << XENFEAT_gnttab_map_avail_bits);#endif +if (is_numa_domain (current->domain)) + fi.submap |= (1U << XENFEAT_numa_guest_support);break ;default :return -EINVAL ;
xen/common/libelf/libelf-dominfo.c +2 -1
@@ -12,7 +12,8 @@ [XENFEAT_writable_descriptor_tables] = "writable_descriptor_tables", [XENFEAT_auto_translated_physmap] = "auto_translated_physmap", [XENFEAT_supervisor_mode_kernel] = "supervisor_mode_kernel", - [XENFEAT_pae_pgdir_above_4gb] = "pae_pgdir_above_4gb" + [XENFEAT_pae_pgdir_above_4gb] = "pae_pgdir_above_4gb", + [XENFEAT_numa_guest_support] = "numa_guest_support" };static const int elf_xen_features =sizeof (elf_xen_feature_names) /sizeof (elf_xen_feature_names[0 ]);
xen/include/public/features.h +6 -0
@@ -68,6 +68,12 @@*/ #define XENFEAT_gnttab_map_avail_bits 7 +/* +* If set, the guest is made aware of the underlying NUMA characteristics +* (numa guest enlightenment) +*/ +#define XENFEAT_numa_guest_support 8 +#define XENFEAT_NR_SUBMAPS 1#endif /* __XEN_PUBLIC_FEATURES_H__ */
xen/include/xen/sched.h +1 -0
@@ -347,6 +347,7 @@#define put_domain (_d) \ if ( atomic_dec_and_test(&(_d)->refcnt) ) domain_destroy(_d) +#define is_numa_domain (d) ((d)->numa_layout != NULL)/* * Use this when you don't have an existing reference to @d. It returns * FALSE if @d is being destroyed.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel