Repository navigation
Conversation
A read wrote each CPU's record with its own `write_at`, and each copy takes the caller's space lock to reach and pin the page. A round's readers all wake together when it completes, so with sixteen readers on eight CPUs every round queued 128 takes of one process's space lock back to back, on top of each read's window check. That queue is what silences `test_rs_counters_read` on loaded hosts. Captured over the gdbstub of silent 8-CPU `virt` guests on main's kernel, under TCG and HVF: every vCPU is in `Lock<AddressSpace>::lock` from `counters::read` -> `View::pieces`. The lock's `now` advances about 180 handovers a second through the silence, and `ticket - now` stays 8. Nothing is deadlocked. A ticket lock hands over to one particular waiter, and when the host starves that waiter's vCPU every CPU waits for the host to schedule it. Encoding the records first and copying once takes the space lock twice per read instead of nine times. Beside other guests at host load 18 to 51, six interleaved rounds of the four `virtsmpcase` rows: main went silent 8 of 24, this 2 of 24. A scratch test-and-test-and-set lock went silent 0 of 24, which leaves the remaining convoy to a lock-policy decision that the issue records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ess's Ticket locks are kept, as decided on 2026-11-04: their FIFO fairness is what metal gets. The record now names the exit where the silence lives: the harness admits a guest only where the host has a CPU for each of its vCPUs, and the four virtsmpcase rows then pass under the load that silenced them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
Review of #1160 at
|
… comment names whose lock The eleven sightings all fall between 2026-10-04 and 2026-10-10; the 2026-11-02 reading of #1150's scratch kernel was not one of them. The copy's comment names the readers that want the lock: the caller's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Japabu
marked this pull request as ready for review
November 4, 2026 05:34
Japabu
enabled auto-merge
November 4, 2026 05:34
Japabu
added a commit
that referenced
this pull request
Nov 4, 2026
…aves out is recorded `a-counters-read-under-host-load-can-go-silent-for-15-s` asked for the harness to admit a guest only where the host has a CPU for each of its vCPUs, and for the four virtsmpcase rows to pass under the parallel load that silenced them. Two harness invocations of the four rows ran at once, beside other worktrees' work at host load 19 to 53, over four interleaved rounds. Main (with #1160) went silent in 5 of 32 rows, and its reads took up to 15.6 s. With the budget, no row of 32 went silent and 28 reads of 32 took under 2.4 s. One budgeted read still took 14.22 s with only its own guest admitted: the budget counts guests, and builds and other non-guest work are not in it. `the-guest-cpu-budget-counts-guests-and-not-builds` records that. Co-Authored-By: Claude Opus 5.5 <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.
Problem
On loaded hosts
test_rs_counters_read(tests/images/virtsmpcase.toml) goes quiet past the harness's15 s
GUEST_QUIET.virt_smp,virt_el1_smp,virt_mask_windowsandvirt_off_names_the_cpus_left_onthen red asSTALLED(
issues/a-counters-read-under-host-load-can-go-silent-for-15-s.md).What a silent guest is doing
I captured silent guests over QEMU's gdbstub while the harness watched the silence, using a scratch
harness hook that is not committed. The kernel was main's, on TCG (
virt_smp) and HVF(
virt_el1_smp):Lock<AddressSpace>::lock, called fromcounters::read→View::pieceswhile writing the records out.
now, read a few seconds apart during the silence, advanced about 180handovers a second.
ticket − nowstayed 8, so every vCPU was queued.last probe because the process had ended and its space was freed.
This is a convoy, not a deadlock. A ticket lock hands over to one particular waiter. When the host
has that waiter's vCPU descheduled, every vCPU waits for the host to schedule it. A round's sixteen
readers wake together, and each read took the process's space lock nine times: one window check
and one
write_atper CPU record.#1150's scratch capture was read as "a holder on no CPU", but it does not establish that. Tickets
are taken in time order, and its context table was printed after
nowhad passed the tickets itnamed.
Change
counters::readencodes every record and copies them out once. A read now takes the space locktwice instead of nine times. The bytes written are the same.
Evidence
The results below and the complete capture logs are in the evidence branch:
pr-1160/r0.Unclamped, beside other guests. Six interleaved rounds of the four rows ran at host load 18 to 51 from other
worktrees on the 14-core Apple-silicon dev host. Spans are guest clock from
counters_read'sTEST_STARTto itsTEST_END.e3a421563(the control: this change reverted)sync::LockThe third arm changes only how the lock hands over, which makes the FIFO handover the cause. This
change makes the queue shorter, but the queue remains.
A starvation instrument. Running QEMU under
taskpolicy -c backgroundstages the silencedeterministically while ambient load stays low. With the harness and QEMU clamped, main went silent in
15 of 15 valid rows. This change went silent 2 of 8, and its finished reads took 6.5 to 13.7 s. One main
boot is excluded: the clamped firmware passed its 60 s UEFI watchdog and reset. At ambient load above 45
the clamp is too harsh, and boots time out before the kernel starts. Those rounds were discarded.
What remains, and where it is fixed
The convoy itself stays: ticket locks are kept, as decided on 2026-11-04 (FIFO fairness is what
metal gets, and QEMU must never reduce it). The silence is fixed where it really lives, in the
harness, which runs an 8-vCPU guest beside others on a host that cannot give it eight cores. That
is a follow-up PR: guests admitted by host CPUs, and
GUEST_QUIET's stale doc comment fixed, withthe bound itself still unscaled. The issue record states that exit.
Checks
cargo run -- --ci hoston51160f934's tree: exit 0, 109 steps green (host-ci.log.gz). The later commitedits only the issue record's prose, so it changes nothing those steps built.
cargo test --test toyos-build -- virt_smp virt_el1_smp virt_mask_windows virt_off_names_the_cpus_left_on --nocapture, each round's log with its exit code inab-unclamped/. The"this change" arm is
fix-one-copy.patch, which differs from the commit only in a comment's wording anda blank line between
usegroups.Metal: none. The change alters only how the same bytes are copied, and
counters_readassertsevery record on the guest.
🤖 Generated with Claude Code