-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
ARM: initialization sequence might be not using all of interrupt stack #16210
Comments
The reset.S code in the other ARCHes is pretty similar, but we won't see a bug as long as K_THREAD_STACK_DEFINE does not reserve any extra space besides what is requested by CONFIG_ISR_STACK_SIZE |
FYI @andrewboie |
Affects x86 as well since privilege mode stacks are part of the array created by K_THREAD_STACK_DEFINE(), we could save 4K. Need to check on ARM but likely wasting both guard area and privileged stack. |
Don't know how much of an issue it is (might only affect boot code). But it's certainly something we might want to work on |
@andrewboie I was thinking to pick this up. Isn't the solution as simple as not using KThread Stack Define macro to define the interrupt stack? |
Adding information from #23268 per request. Describe the bug To Reproduce ~/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-nm build/zephyr/zephyr.elf |grep -e "priv_stack_[0-9]+" ~/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-nm build/zephyr/zephyr.elf |grep -e _interrupt_stack -e z_main_stack -e z_idle_stack |
This should not be an issue, any more, since we merged #24714 , and so the interrupt stack is defined using k_kernel_stack_define. |
So, the only remaining issue, here, is the fact that during initialization not all interrupt stack area gets used by the boot process. After boot, the interrupt stack gets initialized to the upper boundary, anyway. |
Hmm, do we even need to fix it? We need the space anyway during normal kernel execution right? Suggest closing this |
The interrupt stack is defined using the
K_THREAD_STACK_DEFINE(<requested size>)
kernel macro. In some architectures, for example the ARM architecture without requirement for stack start alignment, the size of the stack, defined withK_THREAD_STACK_DEFINE()
is larger than<requested size>
due to possibly a stack guard.First, of, all, this is not yet needed - we do not support MPU-based stack-overflow protection in the ISR stack at the moment.
Then, the possible guard area is not taken into account in
reset.S
, so we do not use this area we have reserved for the interrupt stack. It's a (minor) memory wasting.There are some straightforward ways to fix this issue;
The text was updated successfully, but these errors were encountered: