fix(kernel): stabilize apt update under sustained I/O#2157
Conversation
Rework NAPI scheduling around an exact-once SCHED/MISSED state machine with bounded, fair polling. Move virtio-net to deeper raw queues with preallocated DMA buffers, asynchronous TX completion, and race-closing EVENT_IDX callback handling. Track actual cross-CPU task ownership independently from runqueue placement and serialize stop wakeups, affinity changes, and migration tails so a task cannot execute or enqueue twice during network wakeups. Batch ext4 sequential range allocation and orphan extent reclamation, preserve journal credit and checksum invariants, and avoid read-before-write for complete blocks. This prevents apt package-store writes and interrupted-download cleanup from synchronously amplifying metadata I/O. Treat disappearing proc fd and fdinfo tables as normal exit races, refresh the pinned virtio-drivers revision, and add host-testable NAPI transition coverage. Validated with cargo test -p napi-state, cargo test -p another_ext4, and make kernel. Signed-off-by: longjin <longjin@dragonos.org>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 732d525c08
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Refresh whole-disk capacity from the backing block device so loop devices expose their configured size after LOOP_SET_FD. Keep the static start LBA on I/O hot paths, safely fall back after device teardown, and report only complete loop sectors. Revalidate cached proc fd and fdinfo entries against the live descriptor table. Return ENOENT across zombie and reaped-task paths, including reads from an already-open fdinfo file, matching Linux 6.6 semantics. Add a dunitest covering cached fd entries across process exit. Signed-off-by: longjin <longjin@dragonos.org>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c285a71b9c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Consume completed RX buffers independently of TX queue availability so NAPI can continue making receive progress under transmit pressure. Use a lazy response token for receive-side replies and reserve DMA capacity only when smoltcp actually emits a frame. Keep explicitly reserved tokens for standalone transmit calls and split RX/TX token types to preserve their ownership invariants. Signed-off-by: longjin <longjin@dragonos.org>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d65ff73d07
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Keep the smoltcp Ethernet frame limit separate from the user-visible IP MTU so rtnetlink reports 1500 bytes instead of 1514. Run the existing DHCP acquisition window in a kernel worker, allowing SystemState::Running and userspace startup to proceed when no DHCP server is available. Add a strict rtnetlink MTU regression and teach dunitest to parse singular GoogleTest summaries so the one-case suite is enforced by CI. Signed-off-by: longjin <longjin@dragonos.org>
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
|
Root cause confirmed: FAT cluster allocation and release were not serialized across different inodes. Concurrent page-cache writeback could select the same free FAT entry, corrupt a cluster chain, and eventually make The fix adds a filesystem-wide FAT metadata lock, aligned with Linux 6.6 Validation: |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36c3be8b74
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: longjin <longjin@dragonos.org>
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
SCHED/MISSEDstate machine and bounded, fair pollingRoot cause
The observed
apt updatestalls were produced by several interacting bottlenecks and correctness gaps:Together these issues amplified interrupt, scheduler, and synchronous metadata costs into low throughput, long cleanup delays, and occasional kernel instability.
Implementation
Network data path
Scheduler
Filesystem and procfs
Validation
cargo test -p napi-state: 7 passedcargo test -p another_ext4: 131 passedmake kernel: passed against the pinned mirror revisionapt update: completed a 31.6 MB refresh without a hash mismatchRemaining scope
This change removes the confirmed correctness failures and synchronous-I/O amplification. Full Linux-style ext4 delayed allocation and writeback-time allocation remain separate future performance work.