Skip to content

Commit cd429ce

Browse files
Pavel Tatashindavem330
authored andcommitted
sparc64: memblock resizes are not handled properly
In add_node_ranges() when memblock resize happens, the iterator keeps using the previous freed array. This bug cause hangs on machine where there are over 128 memory blocks during boot. For example, on machines where memory interleaving is small. The problem is seen on T4-4 because it cant have 2T of memory, and memory is interleaved at 8G. So we have 2T/8G = 256 regions to set node IDs. The starting size of regions array is 128. Thus, we have to double at least one time (actually we have to double twice because some memory is already reserved and thus we need more than 256 regions). We start using an incorrect pointer to the array after the first doubling. Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com> Signed-off-by: Babu Moger <babu.moger@oracle.com> Reviewed-by: Babu Moger <babu.moger@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1537b26 commit cd429ce

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/sparc/mm/init_64.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,10 @@ int of_node_to_nid(struct device_node *dp)
11261126
static void __init add_node_ranges(void)
11271127
{
11281128
struct memblock_region *reg;
1129+
unsigned long prev_max;
1130+
1131+
memblock_resized:
1132+
prev_max = memblock.memory.max;
11291133

11301134
for_each_memblock(memory, reg) {
11311135
unsigned long size = reg->size;
@@ -1145,6 +1149,8 @@ static void __init add_node_ranges(void)
11451149

11461150
memblock_set_node(start, this_end - start,
11471151
&memblock.memory, nid);
1152+
if (memblock.memory.max != prev_max)
1153+
goto memblock_resized;
11481154
start = this_end;
11491155
}
11501156
}

0 commit comments

Comments
 (0)