Xen-devel [XEN PATCH] [Linux-PVOPS] ballooning on numa domains
Subsystems (3)
Problems :
* With ballooning, the mfns could change underneath and the numa mappings could get distorted (even for domains with the actual physical memory map).
* xen/interface/memory.h included with pvops is not in sync with the latest xen version. Added the definitions needed for the patch.
-dulloor
arch/ia64/xen/grant-table.c +1 -1
@@ -77,7 +77,7 @@ void xen_free_vm_area(struct vm_struct *area)unsigned long gpfn = (phys_addr >>PAGE_SHIFT ) + i;struct xen_memory_reservation reservation = { .nr_extents =1 , - .address_bits =0 , + .mem_flags =0 , .extent_order =0 , .domid =DOMID_SELF };
arch/x86/xen/mmu.c +1 -1
@@ -2239,7 +2239,7 @@ static int xen_exchange_memory(unsigned long extents_in, unsigned int order_in, .nr_extents = extents_out, .extent_order = order_out, .extent_start = mfns_out, - .address_bits = address_bits, + .mem_flags = address_bits, .domid = DOMID_SELF } };
arch/x86/xen/setup.c +1 -1
@@ -38,7 +38,7 @@ extern void xen_syscall32_target(void);static unsigned long __init xen_release_chunk (phys_addr_t start_addr,phys_addr_t end_addr) {struct xen_memory_reservation reservation = { - .address_bits =0 , + .mem_flags =0 , .extent_order =0 , .domid =DOMID_SELF };
drivers/xen/balloon.c +56 -25
197 lines not on this page · raw message
include/xen/interface/memory.h +17 -7
@@ -19,6 +19,21 @@#define XENMEM_increase_reservation 0#define XENMEM_decrease_reservation 1#define XENMEM_populate_physmap 6 + +/* +* Maximum # bits addressable by the user of the allocated region (e.g., I/O +* devices often have a 32-bit limitation even in 64-bit systems). If zero +* then the user has no addressing restriction. This field is not used by +* XENMEM_decrease_reservation. +*/ +#define XENMEMF_address_bits (x) (x) +#define XENMEMF_get_address_bits (x) ((x) & 0xffu) +/* NUMA node to allocate from. */ +#define XENMEMF_node (x) (((x) + 1) << 8) +#define XENMEMF_get_node (x) ((((x) >> 8) - 1) & 0xffu) +/* Flag to populate physmap with populate-on-demand entries */ +#define XENMEMF_populate_on_demand (1<<16) +struct xen_memory_reservation {/*
@@ -37,13 +52,8 @@ struct xen_memory_reservation {unsigned long nr_extents;unsigned int extent_order; -/* -* Maximum # bits addressable by the user of the allocated region (e.g., -* I/O devices often have a 32-bit limitation even in 64-bit systems). If -* zero then the user has no addressing restriction. -* This field is not used by XENMEM_decrease_reservation. -*/ -unsigned int address_bits; +/* XENMEMF flags. */ +unsigned int mem_flags;/* previously called address_bits */ /* * Domain whose reservation is being changed.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Dulloor <[email protected]> 09.11.09 08:40 >>>
Problems :
* With ballooning, the mfns could change underneath and the numa mappings could get distorted (even for domains with the actual physical memory map).
Besides being unsure about the idea as such (I don't think Xen kernels have been knowing much about NUMA characteristics of the underlying machine), you're assuming that node IDs in kernel and hypervisor are identical, which I don't think is generally valid; XENMEMF_node(), afaict, is presently meant to be used by the Xen tools (and hypervisor internal users) only.
Jan
- Xen guest domains can't read the numa acpi tables and this patch (in the current state) is a no-op for them.
- dom0 can read the numa tables (same as xen). Also, the memory map for dom0 is (currently) set in a way that the numa ranges are consistent. I don't see that changing, so I feel the assumption is valid.
- XENMEMF flags are indeed meant for xen tools. But, ballooning is completely xen specific too ... it is a xen tool, except that it resides in domain's kernel/tree.
Please let know your take on this.
-dulloor
Quoted 16 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Dulloor <[email protected]> 09.11.09 08:40 >>>
Problems :
* With ballooning, the mfns could change underneath and the numa mappings could get distorted (even for domains with the actual physical memory map).Besides being unsure about the idea as such (I don't think Xen kernels have been knowing much about NUMA characteristics of the underlying machine), you're assuming that node IDs in kernel and hypervisor are identical, which I don't think is generally valid;
XENMEMF_node(), afaict, is presently meant to be used by the Xen tools (and hypervisor internal users) only.Jan
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Dulloor <[email protected]> 09.11.09 11:35 >>>
- dom0 can read the numa tables (same as xen). Also, the memory map for dom0 is (currently) set in a way that the numa ranges are consistent. I don't see that changing, so I feel the assumption is valid.
Pseudo-consistent at best - there's no reason to believe that the node a physical page appears to live on (by looking up its address in the SRAT) has any relationship to the node it really lives on.
And even if that was the case, you could easily end up with many (up to all but one) nodes appearing unpopulated (due to dom0_mem=).
Quoted 3 lines
- XENMEMF flags are indeed meant for xen tools. But, ballooning is completely xen specific too ... it is a xen tool, except that it resides in domain's kernel/tree.
That doesn't help you with the node ID issue: The tools can make meaningful use of Xen node IDs; if you want to do this in the kernel you'll have to establish a kernel<->Xen translation of node IDs.
Jan
Quoted 6 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Dulloor <[email protected]> 09.11.09 11:35 >>>
- dom0 can read the numa tables (same as xen). Also, the memory map for dom0 is (currently) set in a way that the numa ranges are consistent. I don't see that changing, so I feel the assumption is valid.
Quoted 6 lines
Pseudo-consistent at best - there's no reason to believe that the node a physical page appears to live on (by looking up its address in the SRAT) has any relationship to the node it really lives on.
And even if that was the case, you could easily end up with many (up to all but one) nodes appearing unpopulated (due to dom0_mem=).
Agreed pseudo-consistent (offseted by alloc_spfn). But, even with the dom0_mem set,
the numa ranges are silently clipped, so the mappings are still (almost)consistent.
Quoted 9 lines
Quoted 4 lines
- XENMEMF flags are indeed meant for xen tools. But, ballooning is completely xen specific too ... it is a xen tool, except that it resides in domain's kernel/tree.
That doesn't help you with the node ID issue: The tools can make meaningful use of Xen node IDs; if you want to do this in the kernel you'll have to establish a kernel<->Xen translation of node IDs.
For other guest domains, we will need translation (part of my next patches). But, for dom0, translation is implicit due to shared acpi tables.
I could work on a patch to make mappings fully consistent (by rigging the slit/srat values as seen by dom0), inertia being an interface acceptable to Linux folks. Do we need that ?
Quoted 3 lines
Jan
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Dulloor <[email protected]> 09.11.09 15:18 >>>
Quoted 6 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Dulloor <[email protected]> 09.11.09 11:35 >>>
- dom0 can read the numa tables (same as xen). Also, the memory map for dom0 is (currently) set in a way that the numa ranges are consistent. I don't see that changing, so I feel the assumption is valid.
Quoted 8 lines
Quoted 6 lines
Pseudo-consistent at best - there's no reason to believe that the node a physical page appears to live on (by looking up its address in the SRAT) has any relationship to the node it really lives on.
And even if that was the case, you could easily end up with many (up to all but one) nodes appearing unpopulated (due to dom0_mem=).
Agreed pseudo-consistent (offseted by
alloc_spfn). But, even with the
alloc_spfn (or really the only instance I'm aware of that would matter here) is relevant only for the single big blob that contains kernel, initial page tables, and such; all other of Dom0's memory can be distributed randomly across the address space.
Quoted 3 lines
dom0_memset,
the numa ranges are silently clipped, so the mappings are still (almost)consistent.
Correct - but, as previously said, with certain (possibly all but one) nodes having no memory at all (possibly until ballooning). (Have you checked that a previously unpopulated node suddenly becoming populated is being handled properly in all respects in the kernel's memory management subsystem, and can you guarantee this will always be the case in the future?)
Quoted 11 lines
Quoted 9 lines
Quoted 4 lines
- XENMEMF flags are indeed meant for xen tools. But, ballooning is completely xen specific too ... it is a xen tool, except that it resides in domain's kernel/tree.
That doesn't help you with the node ID issue: The tools can make meaningful use of Xen node IDs; if you want to do this in the kernel you'll have to establish a kernel<->Xen translation of node IDs.
For other guest domains, we will need translation (part of my next patches). But, for dom0, translation is implicit due to shared acpi tables.
Not really - just check setup_node() in Xen: The node ID is software assigned, what comes from SRAT is the pxm value.
Quoted 3 lines
I could work on a patch to make mappings fully consistent (by rigging the slit/srat values as seen by dom0), inertia being an interface acceptable to Linux folks. Do we need that ?
Jan
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Dulloor <[email protected]> 09.11.09 15:18 >>>
Quoted 12 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Dulloor <[email protected]> 09.11.09 11:35 >>>
- dom0 can read the numa tables (same as xen). Also, the memory map for dom0 is (currently) set in a way that the numa ranges are consistent. I don't see that changing, so I feel the assumption is valid.
Pseudo-consistent at best - there's no reason to believe that the node a physical page appears to live on (by looking up its address in the SRAT) has any relationship to the node it really lives on.
And even if that was the case, you could easily end up with many (up to all but one) nodes appearing unpopulated (due to dom0_mem=).
Quoted 6 lines
Quoted 1 line
Agreed pseudo-consistent (offseted by
alloc_spfn). But, even with the
alloc_spfn(or really the only instance I'm aware of that would matter here) is relevant only for the single big blob that contains kernel, initial page tables, and such; all other of Dom0's memory can be distributed randomly across the address space.
Offseted by alloc_spfn. (mfn = pfn+alloc_spfn) while setting the vphysmap. Did you mean when dom0_mem is set ?
Quoted 10 lines
Quoted 3 lines
dom0_memset,ou
the numa ranges are silently clipped, so the mappings are still (almost)consistent.Correct - but, as previously said, with certain (possibly all but one) nodes having no memory at all (possibly until ballooning). (Have you checked that a previously unpopulated node suddenly becoming populated is being handled properly in all respects in the kernel's memory management subsystem, and can you guarantee this will always be the case in the future?)
You mean the dom0 starts with low memory (few nodes unpopulated) and then ballooning adds more ? But, isn't the memory map (for dom0) set upto dom0-max-mem. And, ballooning can only increase/decrease reservations in dom0's address space. Maybe I didn't understand your point.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
- XENMEMF flags are indeed meant for xen tools. But, ballooning is completely xen specific too ... it is a xen tool, except that it resides in domain's kernel/tree.
That doesn't help you with the node ID issue: The tools can make meaningful use of Xen node IDs; if you want to do this in the kernel you'll have to establish a kernel<->Xen translation of node IDs.
Quoted 5 lines
Quoted 2 lines
For other guest domains, we will need translation (part of my next patches). But, for dom0, translation is implicit due to shared acpi tables.
Not really - just check
setup_node()in Xen: The node ID is software assigned, what comes from SRAT is the pxm value.
But, it is done the same way in Dom0 and xen, although I do agree that this is not guaranteed in future.
Quoted 7 lines
Quoted 4 lines
I could work on a patch to make mappings fully consistent (by rigging the slit/srat values as seen by dom0), inertia being an interface acceptable to Linux folks. Do we need that ?
Jan
In general, I agree there is work to be done (planned for in later patches). Please do let know any ideas you have.
But, as far as this patch is concerned, it tries only one thing that the node distribution of memory remains the same across ballooning, acknowledging that mappings can change underneath and making no other assumptions. It might help in some cases and is a no-op in others.
Whether the initial distribution is consistent or pseudo-consistent is a matter of more work.
Moreover, this is just best effort, since even if XENMEMF_node(n) is set, the allocation
inside xen could still be from other nodes' heaps.
If you/Jeremy don't find this (incremental) patch useful, we can drop it for now and that's fine with me ! :)
-dulloor
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Dulloor <[email protected]> 10.11.09 07:37 >>>
Quoted 4 lines · Jan Beulich
alloc_spfn(or really the only instance I'm aware of that would matter here) is relevant only for the single big blob that contains kernel, initial page tables, and such; all other of Dom0's memory can be distributed randomly across the address space.Offseted by
alloc_spfn. (mfn = pfn+alloc_spfn) while setting the vphysmap.
Again, you're only looking at the first chunk allocated for Dom0. Just look at the following 50 or so lines of code in domain_build.c.
Quoted 1 line
Did you mean when
dom0_memis set ?
That's independent.
Jan