All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/numa: Make numa_fill_memblks() @end parameter exclusive
@ 2024-01-02 21:32 alison.schofield
  2024-01-02 23:42 ` Dan Williams
  0 siblings, 1 reply; 6+ messages in thread
From: alison.schofield @ 2024-01-02 21:32 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Andy Lutomirski, Peter Zijlstra, Dan Williams,
	Mike Rapoport, Huang, Ying
  Cc: Alison Schofield, x86, linux-cxl

From: Alison Schofield <alison.schofield@intel.com>

numa_fill_memblks() expects inclusive [start, end] parameters but
it's only caller, acpi_parse_cfmws(), is sending an exclusive end
parameter. This means that numa_fill_memblks() can create an overlap
between different NUMA nodes with adjacent memblks. That overlap is
discovered in numa_cleanup_meminfo() and numa initialization fails
like this:

[] ACPI: SRAT: Node 0 PXM 0 [mem 0x100000000-0xffffffffff]
[] ACPI: SRAT: Node 1 PXM 1 [mem 0x10000000000-0x1ffffffffff]
[] node 0 [mem 0x100000000-0xffffffffff] overlaps with node 1 [mem 0x100000000-0x1ffffffffff]

Changing the call site to send the expected inclusive @end parameter
was considered and rejected. Rather numa_fill_memblks() is made to
handle the exclusive @end, thereby making it the same as its neighbor
numa_add_memblks().

Fixes: 8f012db27c95 ("x86/numa: Introduce numa_fill_memblks()")
Suggested by: "Huang, Ying" <ying.huang@intel.com>
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
 arch/x86/mm/numa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index b29ceb19e46e..4f81f75e4328 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -974,9 +974,9 @@ static struct numa_memblk *numa_memblk_list[NR_NODE_MEMBLKS] __initdata;
  * @start: address to begin fill
  * @end: address to end fill
  *
- * Find and extend numa_meminfo memblks to cover the @start-@end
+ * Find and extend numa_meminfo memblks to cover the [start, end)
  * physical address range, such that the first memblk includes
- * @start, the last memblk includes @end, and any gaps in between
+ * @start, the last memblk excludes @end, and any gaps in between
  * are filled.
  *
  * RETURNS:
@@ -1003,7 +1003,7 @@ int __init numa_fill_memblks(u64 start, u64 end)
 	for (int i = 0; i < mi->nr_blks; i++) {
 		struct numa_memblk *bi = &mi->blk[i];
 
-		if (start < bi->end && end >= bi->start) {
+		if (start < bi->end && end > bi->start) {
 			blk[count] = &mi->blk[i];
 			count++;
 		}

base-commit: 659c07b7699a6e50af05a3bdcc201ff000fbcada
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-08 17:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02 21:32 [PATCH] x86/numa: Make numa_fill_memblks() @end parameter exclusive alison.schofield
2024-01-02 23:42 ` Dan Williams
2024-01-03 18:49   ` Alison Schofield
2024-01-03 20:18     ` Dan Williams
2024-01-08 17:41       ` Alison Schofield
2024-01-08 17:59         ` Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.