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

lib/libc: Enable picolibc on qemu_x86_tiny #54186

Merged

Conversation

keith-packard
Copy link
Collaborator

@keith-packard keith-packard commented Jan 27, 2023

This series resolves the small number of failures when running the test suite using picolibc by default. All of them are pretty straightforward except for the change to the kernel.memory_protection test -- that test generates double fault errors on this board during nearly every run, even with the minimal C library, although in that case the error usually occurs after the test completes, during the cleanup code. I spent some quality time digging into it and it looks like whatever memory protection changes are made cause troubles when faulting in text pages for the main thread. I'm afraid I gave up attempting to find the actual problem and just switched to forcing that test to use the minimal C library.

Fixes #54148

Use the existing bits for newlib to make sure the picolibc files are also
placed in pinned memory.

Signed-off-by: Keith Packard <[email protected]>
When there's no malloc heap needed for picolibc, don't reserve
the page frames that would be needed. This makes sure
the kernel.demand_paging tests provoke the page faults as
expected.

Signed-off-by: Keith Packard <[email protected]>
Add another clause in the test_ram_perms code to verify that any pinned
regions have the correct flags.

Signed-off-by: Keith Packard <[email protected]>
These tests don't need any libc heap and currently fail when one is
available.

Signed-off-by: Keith Packard <[email protected]>
This test has trouble on qemu_x86_tiny and randomly generates a Double
Fault error. I couldn't get it to reliably run with picolibc as a Double
Fault usually occured before the test completed.

I spent a couple of hours attempting to track this down and found that it
happens when code pages for the main thread get unmapped because the
qemu_x86_tiny intentionally offers very few available PTEs.

Work around this by just using the minimal libc for this test.

Signed-off-by: Keith Packard <[email protected]>
With all of the test suite issues on this board fixed, qemu_x86_tiny should
now be usable with picolibc.

Signed-off-by: Keith Packard <[email protected]>
@fabiobaltieri fabiobaltieri merged commit 9a0aebc into zephyrproject-rtos:main Jan 30, 2023
@keith-packard keith-packard deleted the picolibc-qemu-86-tiny branch January 31, 2023 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: C Library C Standard Library area: picolibc Picolibc C Standard Library area: Userspace Userspace area: X86 x86 Architecture (32-bit) platform: X86 x86 and x86-64
Projects
None yet
Development

Successfully merging this pull request may close these issues.

qemu_x86_tiny places picolibc text outside of pinned.text
5 participants