fix(runtime): native poll(2) for guest stdio + event-driven kernel waits#192
Merged
Conversation
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.
net_poll(the patched libc's poll(2) backend) now reports readiness for every fd type — kernel-managed stdio/PTY fds via__kernel_poll, pipes, regular files, and POLLNVAL for closed fds — instead of host_net sockets only, and sleeps between iterations instead of hot-spinning. select()-based guests (vim) now see stdin readiness and no longer burn CPU while idle.__kernel_stdin_read/__kernel_pollwithout blocking the dispatch loop: a zero-timeout readiness probe answers immediately when possible, otherwise the RPC is parked (reply-by-token) and an off-loop waiter on the kernel's poll notifier re-enqueues it when poll state changes. Child processes park on the child-event pump with per-iteration rechecks.host_tty.read,readKernelStdinChunk,poll_oneoff,net_poll), so idle full-screen guests accrue ~zero active CPU.max_fuelonly). Runaway modules stay bounded by the default 30s active-CPU V8 watchdog, while idle interactive guests are no longer killed on wall time.PollWaitHandlefor waiting on poll-state changes off the kernel owner's thread.