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

[fiber] Add stack overflow check in every yield #1219

Merged
merged 7 commits into from
Nov 10, 2024

Conversation

salkinium
Copy link
Member

@salkinium salkinium commented Nov 3, 2024

The weakness of fibers is their stack usage, and the main issue is stack overflows. With the current lack of stack overflow checking, it is extremely easy to write code that silently overflows the stack and causes all sorts of issues. Particularly when the overflow only happens in occasionally, this can lead to a horrible debug experience.
Sadly this will increase switching times a bit, but there's really no point to not checking stack overflows, it's the core problem with stackful scheduling.

After this feature, I would consider fibers to be ready for prime time, and I would deprecate protothreads/resumables not running in fiber mode (in a separate PR). Otherwise we'll never get past GCC12.

  • Add overflow detection in modm_context_jump
    • AVR
    • ARMv6-M
    • ARMv7-M
    • ARMv8-M
    • ARM64
    • x86
  • Update documentation
  • Update examples
    • AVR
    • Cortex-M
  • Testing
    • AVR
    • ARM64
    • STM32G0 (ARMv6-M)
    • STM32L4 (ARMv7-M)
    • STM32U5 (ARMv8-M)

@salkinium salkinium force-pushed the feature/stkof branch 7 times, most recently from 57170b1 to d4908da Compare November 9, 2024 17:56
@salkinium salkinium added this to the 2024q4 milestone Nov 9, 2024
@salkinium salkinium marked this pull request as ready for review November 9, 2024 19:24
@salkinium salkinium force-pushed the feature/stkof branch 8 times, most recently from 0a2cd26 to f2526cf Compare November 10, 2024 13:38
@salkinium salkinium merged commit f0d4534 into modm-io:develop Nov 10, 2024
12 checks passed
@salkinium salkinium deleted the feature/stkof branch November 10, 2024 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant