Conversation
…render thread competing with BWM
Three categories of fixes for ARM64 interactive mode lockups:
1. **Null-terminated paths for kernel syscalls** (libs/libbreenix/src/fs.rs)
Add CPath struct that ensures all path strings passed to kernel syscalls
are properly null-terminated with write_volatile. Rust &str is NOT null-
terminated, and the compiler can optimize away zero bytes after the string
data. Applied to all 11 path-taking functions: open, open_with_mode,
access, unlink, mkdir, rmdir, rename, link, symlink, readlink, mkfifo.
2. **Drop PROCESS_MANAGER before I/O in sys_poll and sys_select**
(kernel/src/syscall/handlers.rs)
On ARM64, process::manager() disables ALL interrupts (DAIF mask 0xF).
Previously sys_poll/sys_select held PM across the entire poll loop
including PTY buffer locks, TCP connection locks, etc. Now they snapshot
fd entries under PM (cheap Arc::clone), drop PM, then iterate. This
follows the same extract-then-drop pattern used by sys_read/sys_write.
3. **Render thread stops competing with BWM for GPU** (render_task.rs,
graphics.rs, handlers.rs)
- Add DISPLAY_TAKEN flag set by sys_take_over_display(). Render thread
skips framebuffer flush and cursor updates when BWM owns the display
(standard pattern — same as Linux fbcon KD_GRAPHICS mode).
- Move PROCESS_MANAGER acquisition in sys_fbdraw BEFORE the
SHELL_FRAMEBUFFER lock. Previously PM (interrupts disabled) was
acquired nested inside the framebuffer lock during GPU busy-waits.
- Remove all diagnostic serial_println/print! from previous debugging.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
write_volatileto ensure null-terminated paths. Rust&stris NOT null-terminated and the compiler can optimize away trailing zeroes, causing the kernel'scopy_cstr_from_user()to read garbage.DISPLAY_TAKENflag (standard fbcon/KD_GRAPHICS pattern) so the render thread stops competing with BWM forSHELL_FRAMEBUFFERduring GPU busy-waits. Also move PM acquisition before FB lock insys_fbdrawto prevent nested interrupt-masking inside long-held spinlocks.serial_println!/print!from previous debugging sessions.Test plan
run-aarch64-boot-test-native.sh)run-boot-parallel.sh 1)🤖 Generated with Claude Code