Skip to content

Commit 768a20f

Browse files
committed
spapr: Include "pre-plugged" DIMMS in ram size calculation at reset
At guest reset time, we allocate a hash page table (HPT) for the guest based on the guest's RAM size. If dynamic HPT resizing is not available we use the maximum RAM size, if it is we use the current RAM size. But the "current RAM size" calculation is incorrect - we just use the "base" ram_size from the machine structure. This doesn't include any pluggable DIMMs that are already plugged at reset time. This means that if you try to start a 'pseries' machine with a DIMM specified on the command line that's much larger than the "base" RAM size, then the guest will get a woefully inadequate HPT. This can lead to a guest freeze during boot as it runs out of HPT space during initial MMU setup. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Greg Kurz <groug@kaod.org> Tested-by: Greg Kurz <groug@kaod.org>
1 parent be1b21e commit 768a20f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hw/ppc/spapr.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,10 @@ void spapr_setup_hpt_and_vrma(sPAPRMachineState *spapr)
13861386
&& !spapr_ovec_test(spapr->ov5_cas, OV5_HPT_RESIZE))) {
13871387
hpt_shift = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->maxram_size);
13881388
} else {
1389-
hpt_shift = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->ram_size);
1389+
uint64_t current_ram_size;
1390+
1391+
current_ram_size = MACHINE(spapr)->ram_size + get_plugged_memory_size();
1392+
hpt_shift = spapr_hpt_shift_for_ramsize(current_ram_size);
13901393
}
13911394
spapr_reallocate_hpt(spapr, hpt_shift, &error_fatal);
13921395

0 commit comments

Comments
 (0)