diff --git a/build/buildlock.rs b/build/buildlock.rs index e6f8e179ad5..bcd99e2fd5f 100644 --- a/build/buildlock.rs +++ b/build/buildlock.rs @@ -910,8 +910,20 @@ pub(crate) mod tests { one.send(()).unwrap(); } + /// Alone in a process ([`rerun`]): a sibling test's fork holds every lock + /// description this process has locked until it execs, so a queue left + /// held by the first guest's dropped handle would read as the wide one + /// queued. #[test] fn a_narrow_guest_does_not_overtake_a_wide_one_waiting() { + let out = rerun("buildlock::tests::a_narrow_guest_behind_a_wide_one").output().expect("run the scenario alone"); + let said = String::from_utf8_lossy(&out.stdout).into_owned() + &String::from_utf8_lossy(&out.stderr); + assert!(out.status.success() && said.contains("test result: ok. 1 passed"), "{said}"); + } + + #[test] + #[ignore = "the scenario of the test above, alone in its process; never runs on its own"] + fn a_narrow_guest_behind_a_wide_one() { let store = scratch("guest-cpus-queue"); let (tx, done) = std::sync::mpsc::channel(); let first = guest(&store, 3, 4, "first", tx.clone()); diff --git a/issues/a-lane-reader-counted-one-refusal-fewer-than-its-writer-made.md b/issues/a-lane-reader-counted-one-refusal-fewer-than-its-writer-made.md deleted file mode 100644 index ce986c6a254..00000000000 --- a/issues/a-lane-reader-counted-one-refusal-fewer-than-its-writer-made.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -status: open -kind: defect -opened: 2026-10-10 ---- - -# A lane's reader counted one refusal fewer than its writer made - -`sdk/toyos/src/log/proof.rs`'s -`a_lane_gives_its_reader_every_record_in_order_or_counts_it_refused` went red -once in `cargo run -- --ci host`'s `the toyos SDK` step, on the branch -that brings up the GICv3 ITS, which touches nothing under `sdk/toyos/`: - -``` -panicked at toyos/src/log/proof.rs:161:5: -assertion `left == right` failed - left: 49999 - right: 50000 -``` - -The reader's `Reader::refused` total was one short of the refusals the -writer thread counted from `push_lane`. The host's load average was 44.31 -on 14 cores when it was read; the same step was green an hour earlier on -a tree whose `sdk/toyos/` was the same. Either the lane loses a refusal between -the writer's count and the reader's last read after `writer.is_finished()`, -or the test reads the count before the last refusal is published: which one -is not determined. - -**Exit**: the cause is named, and the test reds on it without load, or the -lane's refusal count is fixed and the test holds under the load above. diff --git a/issues/a-narrow-guest-test-reads-any-queue-holder-as-the-wide-waiter.md b/issues/a-narrow-guest-test-reads-any-queue-holder-as-the-wide-waiter.md deleted file mode 100644 index d1bd67a84c4..00000000000 --- a/issues/a-narrow-guest-test-reads-any-queue-holder-as-the-wide-waiter.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -status: open -kind: tooling -opened: 2026-11-04 ---- - -# `a_narrow_guest_does_not_overtake_a_wide_one_waiting` reads any holder of the queue as the wide guest waiting - -`build/buildlock.rs`'s test starts the wide guest, then polls `guest-cpus/queue` -and starts the narrow guest once a `try_lock` of it fails, taking that as the -wide guest holding the queue while it waits. Under host load it failed with -`a narrow guest took the CPU a queued wide one waits for`. Its log shows both -guests *waiting for* the queue, the narrow one acquiring it first and the wide -one after, so the probe's failed `try_lock` was not the wide guest queued. -The run was `cargo run -- --ci host` at `2d29d98db` (#1173, a change that does not -touch `buildlock.rs`), host load average 22 to 28; the test passed alone three -times on the same tree: evidence `pr-1173/r1/r1-host-ci.log` and -`isolated-*.log` at ToyOSOrg/evidence `067de8d244ac7e8c517cf1039ec692f5241c097f`. - -**Exit**: the test starts the narrow guest only once the wide guest itself -reports that it holds the queue, and stays green under load. diff --git a/sdk/toyos/src/log/proof.rs b/sdk/toyos/src/log/proof.rs index eeaef169893..10f251c19b6 100644 --- a/sdk/toyos/src/log/proof.rs +++ b/sdk/toyos/src/log/proof.rs @@ -146,17 +146,19 @@ fn a_lane_gives_its_reader_every_record_in_order_or_counts_it_refused() { let mut reader = Reader::new(); let mut got = Vec::new(); let mut counted = 0; - loop { - let finished = writer.is_finished(); + let mut read = || { while let Some((_, seq)) = reader.next_lane(&*lane) { got.push(seq); } counted += reader.refused(&*lane); - if finished { - break; - } + }; + while !writer.is_finished() { + read(); } + // The join orders the writer's last push before the last read; + // `is_finished` orders nothing. let refused = writer.join().unwrap() as u64; + read(); assert_eq!(counted, refused); assert_eq!(got.len() as u64 + counted, EACH); assert!(got.windows(2).all(|w| w[0] < w[1]), "a lane reordered its records");