Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riscv/riscv_addrenv.c: Allocate heap for default task stacksize #10346

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

pussuw
Copy link
Contributor

@pussuw pussuw commented Aug 22, 2023

Summary

1 page might not be enough, if the task has a bigger stack. Best effort is to allocate the default amount, however this won't work will all tasks either. See issue #5811 for more details.

Impact

Fixes system crash when not enough heap is allocated for new task's stack. Only affects builds with CONFIG_BUILD_KERNEL.

Testing

Target with processes whose stack size is > 1 page (4K)

1 page might not be enough, if the task has a bigger stack. Best effort
is to allocate the default amount, however this won't work will all
tasks either.
@pussuw
Copy link
Contributor Author

pussuw commented Aug 22, 2023

The risc-v CI seems to be broken, it cannot find the toolchain. Is this a known issue ?

    command: riscv64-unknown-elf-gcc -MT ./task_create.o  -M '-fno-common' '-Wall' '-Wstrict-prototypes' '-Wshadow' '-Wundef' '-Wno-attributes' '-Wno-unknown-pragmas' '-Wno-psabi' '-Os' '-fno-strict-aliasing' '-fomit-frame-pointer' '-ffunction-sections' '-fdata-sections' '-g' '-march=rv64imafdc' '-mabi=lp64d' '-mcmodel=medany' '-isystem' '/github/workspace/sources/nuttx/include' '-D__NuttX__' '-D__KERNEL__' '-Wno-cpp' '-Werror' '-pipe' '-I' '/github/workspace/sources/nuttx/sched' ./task/task_create.c

make[2]: *** [/github/workspace/sources/nuttx/tools/Config.mk:228: task_create.ddc] Error 1
sh: 1: riscv64-unknown-elf-gcc: not found
ERROR: riscv64-unknown-elf-gcc failed: 127

@xiaoxiang781216
Copy link
Contributor

Yes, I am looking the problem due to toolchain upgrade to 13.0.2 by #10306.

@xiaoxiang781216
Copy link
Contributor

Let's ignore riscv ci temp fail and merge this simple change directly.

@xiaoxiang781216 xiaoxiang781216 merged commit 8071a55 into apache:master Aug 22, 2023
11 of 26 checks passed
@pussuw pussuw deleted the rv_stackalloc_fix branch August 22, 2023 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CONFIG_BUILD_KERNEL: Allocating user stack fails if the initial heap size is too small
2 participants