[PATCH] include: sbi_platform: Increase default stack size

Anup Patel apatel at ventanamicro.com
Sat Jun 13 06:20:38 PDT 2026


On Sun, May 24, 2026 at 11:28 AM Vivian Wang <wangruikang at iscas.ac.cn> wrote:
>
> sbi_misaligned_v_ld_emulator() has a local buffer (namely mask) which is
> 8192 bytes in size, so the default stack size is not enough. Double it
> to 16384.

Increasing the stack size in only a temporary fix and only deferring
the problem to some other day.

We are preferring large data to be allocated from heap space and
use scratch space only for small / per-hart data. The per-hart stack
is also limited in size so stack can't be used for large data.

My recomendation is to allocate mask[] from heap space on-demand
for each hart and store the pointer in the scratch space. This on-demand
allocation can be done by  sbi_misaligned_v_ld_emulator() or
sbi_misaligned_v_st_emulator() but the scratch offset is allocated
once in cold boot path.

If we run-out heap space then we keep adjusting the heap size estimate
for generic platform.
(Refer, fw_platform_calculate_heap_size() in generic platform)

I will try to send-out a small untested series soon.

Regards,
Anup



More information about the opensbi mailing list