Skip to content

Commit c6ee7a5

Browse files
davejiangKAGA-KOKO
authored andcommitted
x86/numa_emulation: Fix uniform-split numa emulation
The numa_emulation() routine in the 'uniform' case walks through all the physical 'memblk' instances and divides them into N emulated nodes with split_nodes_size_interleave_uniform(). As each physical node is consumed it is removed from the physical memblk array in the numa_remove_memblk_from() helper. Since split_nodes_size_interleave_uniform() handles advancing the array as the 'memblk' is consumed it is expected that the base of the array is always specified as the argument. Otherwise, on multi-socket (> 2) configurations the uniform-split capability can generate an invalid numa configuration leading to boot failures with signatures like the following: rcu: INFO: rcu_sched detected stalls on CPUs/tasks: Sending NMI from CPU 0 to CPUs 2: NMI backtrace for cpu 2 CPU: 2 PID: 1332 Comm: pgdatinit0 Not tainted 4.19.0-rc8-next-20181019-baseline torvalds#59 RIP: 0010:__init_single_page.isra.74+0x81/0x90 [..] Call Trace: deferred_init_pages+0xaa/0xe3 deferred_init_memmap+0x18f/0x318 kthread+0xf8/0x130 ? deferred_free_pages.isra.105+0xc9/0xc9 ? kthread_stop+0x110/0x110 ret_from_fork+0x35/0x40 Fixes: 1f6a2c6d9f121 ("x86/numa_emulation: Introduce uniform split capability") Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Alexander Duyck <alexander.h.duyck@linux.intel.com> Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: Borislav Petkov <bp@alien8.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/154049911459.2685845.9210186007479774286.stgit@dwillia2-desk3.amr.corp.intel.com
1 parent 7847c7b commit c6ee7a5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

arch/x86/mm/numa_emulation.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,17 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
400400
n = simple_strtoul(emu_cmdline, &emu_cmdline, 0);
401401
ret = -1;
402402
for_each_node_mask(i, physnode_mask) {
403+
/*
404+
* The reason we pass in blk[0] is due to
405+
* numa_remove_memblk_from() called by
406+
* emu_setup_memblk() will delete entry 0
407+
* and then move everything else up in the pi.blk
408+
* array. Therefore we should always be looking
409+
* at blk[0].
410+
*/
403411
ret = split_nodes_size_interleave_uniform(&ei, &pi,
404-
pi.blk[i].start, pi.blk[i].end, 0,
405-
n, &pi.blk[i], nid);
412+
pi.blk[0].start, pi.blk[0].end, 0,
413+
n, &pi.blk[0], nid);
406414
if (ret < 0)
407415
break;
408416
if (ret < n) {

0 commit comments

Comments
 (0)