Skip to content

Commit b6aed5c

Browse files
cfriedtnashif
authored andcommitted
kernel: dynamic: use 4k stack size for x86
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>
1 parent 82ec1d7 commit b6aed5c

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

kernel/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,9 @@ if DYNAMIC_THREAD
245245

246246
config DYNAMIC_THREAD_STACK_SIZE
247247
int "Size of each pre-allocated thread stack"
248-
default 1024 if !64BIT
249-
default 2048 if 64BIT
248+
default 4096 if X86
249+
default 1024 if !X86 && !64BIT
250+
default 2048 if !X86 && 64BIT
250251
help
251252
Default stack size (in bytes) for dynamic threads.
252253

tests/posix/common/boards/qemu_x86.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/posix/common/boards/qemu_x86_64.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2021 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# The test is highly sensitive to size of kernel image.
5+
# However, specifying how many pages used by
6+
# the backing store must be done in build time.
7+
# So here we are, tuning this manually.
8+
CONFIG_BACKING_STORE_RAM_PAGES=12
9+
10+
# The following is needed so that .text and following
11+
# sections are present in physical memory to test
12+
# using backing store for anonymous memory.
13+
CONFIG_KERNEL_VM_BASE=0x0
14+
CONFIG_LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT=y
15+
CONFIG_BACKING_STORE_RAM=y
16+
CONFIG_BACKING_STORE_QEMU_X86_TINY_FLASH=n
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright (c) 2024, Tenstorrent AI ULC
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
dram0: memory@0 {
9+
reg = <0x100000 0x80000>;
10+
};
11+
};

0 commit comments

Comments
 (0)