-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
samples: bluetooth: Increase nRF54H20 stack for hci_ipc #82255
base: main
Are you sure you want to change the base?
Conversation
Increase the stack size for hci_ipc on nRF54H20 since the IPC communication increases stack usage. Signed-off-by: Georgios Vasilakis <[email protected]>
Wouldn't IPC usage increase stack usage for any board, i.e. why not put this into prj.conf instead since this app is all about IPC? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't IPC usage increase stack usage for any board, i.e. why not put this into prj.conf instead since this app is all about IPC?
Actually, 1024 is the default main stack size, so why do you even need this change to begin with? Does the board override the default somewhere and then you need to override the override? Doesn't sound like a very nice solution.
Lines 156 to 160 in 2f583a8
config MAIN_STACK_SIZE | |
int "Size of stack for initialization and main thread" | |
default 2048 if COVERAGE_GCOV | |
default 512 if ZTEST && !(RISCV || X86 || ARM || ARC || NIOS2) | |
default 1024 |
Requesting changes until we get some clarity on the above
In the prj.conf this sample sets the main stack to 512:
I see no reason to affect the nrf5340 for this since it seems to work with a reduced stack. |
"Seems to work" could mean that it's very close to the limit or even slightly over it and you just get lucky that it doesn't trigger a stack overflow/panic. I'd advise to at least do some profiling of exactly how much is consumed there. If there's any chance that other platforms (even non-Nordic ones) using hci_ipc might be close to the limits, I think it's safer to update |
Agreed. It's unclear why this specific board would need additional stack |
With "seems to work" I meant that there are CI plans which run this sample and pass. I don't work closely with bluetooth, maybe the original author of this stack size can give us a comment here. @kapi-no can you give your opinion about increasing the stack size globally here? The reason that I made this change is that I enabled in our SDK the IPC communication for this device and I realized that this image cannot run anymore because of stack overflow. So I am afraid that I don't have a very detailed description why this stack increase is needed. @Thalley could you be more specific on what type of explanation do you need for increasing the stack? |
Is there some reason why we can't just drop all references to MAIN_STACK_SIZE in this app? Then the option would just get the default value from |
Maybe there is but I don't know why they reduced the stack size in the first place. I mentioned in my previous message the author of the line which reduces the stack size, hopefully we can get some more information about this. |
I think this stack setting was selected to optimize RAM usage as it was a bit hard to fit the default configuration in the |
Basically, why does the nRF54H20 need more stack than e.g. the nRF5340? |
I am okay with the stack size increase as long as the Zephyr CI and NCS CI do not expose any RAM overflow issues. |
CI may not catch all RAM overflows: #81044 |
Unfortunately I cannot provide these details myself. I am not aware of stack profiling reports for the IPC mechanisms and it is not my domain as well. I am a user of IPC, I am not developing/testing it. So I chose 1024 because it the default in Zephyr and I saw in practice that it passes CI tests. The reason that this got noticed now is that in our sdk its the first time that IPC is enabled by default and thus some tests failed because of this. |
But it isn't failing on the nRF5340? I think it's worth figuring out why, and if there's something that requires additional stack space on the nRF54H20 that shouldn't do that, or if the nRF5340 is also at or near the limit |
Since there is CI testing this for nRF5340 I (hope that I) can safely assume that indeed it doesn't fail. |
Increase the stack size for hci_ipc on nRF54H20 since the IPC communication increases stack usage.