mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/numa: fix setup of non-aligned memory affinity ranges
The logic to populate memnodemap in populate_memnodemap() assumes that all ranges are aligned to the hash shift, this however is only true for the first address in a memory affinity node. Any subsequent ranges belonging to the same node might not be aligned to the hash shift value. Such lack of alignment causes issues to the logic in populate_memnodemap(), as then the tail of the range might not be properly accounted for and setup in memnodemap. Fix this by forcing the start address of all regions to be aligned to the hash shift; if such alignment causes a region overlap it would always be between regions on the same node, and hence will never cause setup issues of the memnodemap array. Fixes:1666086b00("x86/NUMA: improve memnode_shift calculation for multi node system") Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> master commit:188d530529master date: 2026-06-05 19:13:47 +0200
This commit is contained in:
1 parent
137827d858
commit
94fa7e1626
1 file changed
+6
@@ -403,6 +403,12 @@ static int __init populate_memnodemap(const struct node *nodes,
|
||||
if ( (epdx >> shift) >= memnodemapsize )
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Round down start address: if start is not aligned to the memnodemap
|
||||
* chunk size the tail remainder might not be added. Overlaps created
|
||||
* by rounding will fall into the same NUMA region.
|
||||
*/
|
||||
spdx = ROUNDDOWN(spdx, 1UL << shift);
|
||||
do {
|
||||
if ( memnodemap[spdx >> shift] != NUMA_NO_NODE &&
|
||||
(!nodeids || memnodemap[spdx >> shift] != nodeids[i]) )
|
||||
|
||||