Skip to content

Conversation

@cfriedt
Copy link
Member

@cfriedt cfriedt commented Oct 4, 2024

x86 architectures require a dynamic stack size that is a multiple of 4096 bytes due to mmu restrictions.

For example, this test would previously fail when using the default dynamic stack size of 1024 bytes for 32-bit platforms (because a specific board configuration file was not present).

west build -p auto -b qemu_x86/atom/nopae -t run tests/posix/common/ -- -DCONFIG_USERSPACE=y

It would pass with an additional argument

west build -p auto -b qemu_x86/atom/nopae -t run tests/posix/common/ -- -DCONFIG_USERSPACE=y -DCONFIG_DYNAMIC_THREAD_STACK_SIZE=4096

Add a special default for x86 when using dynamic thread stacks.

The x86 default removes the need for boards/qemu_x86*.conf, with the exception of qemu_x86_tiny.

qemu_x86_tiny did not have sufficient memory (or configuration) to run the non-userspace tests, so bump up the available ram from 256k to 512k for this test and clone the .conf from the demand paging tests.

Eventually, the common posix test should be split into more concise functional categories to reduce ram requirements.

@zephyrbot zephyrbot added area: Kernel area: POSIX POSIX API Library labels Oct 4, 2024
@cfriedt cfriedt added area: X86 x86 Architecture (32-bit) area: Tests Issues related to a particular existing or missing test Hotfix Fix for issues blocking development, i.e. upstream CI issues, tests failing in upstream CI , etc. area: X86_64 x86-64 Architecture (64-bit) and removed area: Kernel labels Oct 4, 2024
peter-mitsis
peter-mitsis previously approved these changes Oct 4, 2024
@cfriedt cfriedt force-pushed the use-4k-dynamic-thread-stack-sizes-to-silence-x86-problems branch from 382c39a to 816921c Compare October 5, 2024 00:21
@cfriedt
Copy link
Member Author

cfriedt commented Oct 5, 2024

  • adjusted default conditionals

@cfriedt cfriedt force-pushed the use-4k-dynamic-thread-stack-sizes-to-silence-x86-problems branch from 816921c to 8d8cb1f Compare October 5, 2024 02:13
@cfriedt
Copy link
Member Author

cfriedt commented Oct 5, 2024

Additional tuned configuration parameters for qemu_x86_tiny from @fgrandel 🙏

x86 architectures require a dynamic stack size that is a multiple
of 4096 bytes due to mmu restrictions.

For example, this test would previously fail when using the
default dynamic stack size of 1024 bytes for 32-bit
platforms.

```
west build -p auto -b qemu_x86/atom/nopae -t run \
  tests/posix/common/ -- -DCONFIG_USERSPACE=y
```

It would pass with an additional argument
```
west build -p auto -b qemu_x86/atom/nopae -t run \
  tests/posix/common/ -- -DCONFIG_USERSPACE=y \
  -DCONFIG_DYNAMIC_THREAD_STACK_SIZE=4096
```

Add a special default for x86 when using dynamic thread stacks.

The x86 default removes the need for `boards/qemu_x86*.conf`,
with the exception of `qemu_x86_tiny`.

qemu_x86_tiny did not have sufficient memory (or configuration)
to run the non-userspace tests, so bump up the available ram
from 256k to 512k for this test and clone the .conf from the
demand paging tests.

Eventually, the common posix test should be split into more
concise functional categories.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
@cfriedt cfriedt force-pushed the use-4k-dynamic-thread-stack-sizes-to-silence-x86-problems branch from 8d8cb1f to cc1b09d Compare October 5, 2024 02:17
@cfriedt cfriedt changed the title kernel: dynamic: use 4k stack size for x86 when userspace enabled kernel: dynamic: use 4k stack size for x86 when enabled Oct 5, 2024
@cfriedt cfriedt changed the title kernel: dynamic: use 4k stack size for x86 when enabled kernel: dynamic: use 4k stack size for x86 Oct 5, 2024
Copy link
Member

@ycsin ycsin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if having a BUILD_ASSERT somewhere to make sure that it is always the multiple of 4096 would help?

@cfriedt
Copy link
Member Author

cfriedt commented Oct 5, 2024

I wonder if having a BUILD_ASSERT somewhere to make sure that it is always the multiple of 4096 would help?

Actually, there are per-arch macros that should round / pad stacks. It's confusing to me why they don't seem to work for x86. The extra .conf is required for for tiny as well.

@nashif nashif merged commit b6aed5c into zephyrproject-rtos:main Oct 5, 2024
@cfriedt cfriedt deleted the use-4k-dynamic-thread-stack-sizes-to-silence-x86-problems branch October 7, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Kernel area: POSIX POSIX API Library area: Tests Issues related to a particular existing or missing test area: X86 x86 Architecture (32-bit) area: X86_64 x86-64 Architecture (64-bit) Hotfix Fix for issues blocking development, i.e. upstream CI issues, tests failing in upstream CI , etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants