open-power / skiboot

OPAL boot and runtime firmware for POWER
Apache License 2.0
100 stars 134 forks source link

Smarter memory allocation in fdt creation #272

Open npiggin opened 2 years ago

npiggin commented 2 years ago

Currently fdt creation just loops on ENOSPC, doubling the malloc size and trying again.

4 node Denali (d5) the device tree has just exceeded the 512k initial malloc size. This causes a scary looking error message and throws out all the fdt work to start again.

Might be better to instead allow size failures to realloc the fdt (except in the opal call case) and continue. This may cost a memcpy but it should be much cheaper than rebuilding the whole tree each time. Initial allocation and increment sizes could be more conservative to save memory too.