Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ members = [
"tests/guest/kernelprobe",
"tests/guest/metalprobe",
"tests/guest/osbench",
"tests/guest/osbench/lan",
"tests/guest/osbench/rules",
"tests/guest/pciholder",
"tests/guest/test-runner",
"tests/metal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ The CPU readings this issue owed went with `toyos-cpuvuln` (#915); the
track's pin is in
`issues/the-kernel-is-at-least-as-secure-as-linux-on-every-machine-toyos-supports.md`.
Ubuntu leaves the T14 only after this issue and
`issues/no-program-measures-toyos-against-linux-on-one-machine.md`
`issues/no-published-run-compares-toyos-with-linux-on-one-machine.md`
close.

**Exit**: the Linux readings on the T14 that
`issues/toyos-explains-itself.md` (each counter ToyOS reads there) and
`issues/no-program-measures-toyos-against-linux-on-one-machine.md` (that
`issues/no-published-run-compares-toyos-with-linux-on-one-machine.md` (that
program's outputs under Ubuntu) compare against are taken before the wipe and
published in evidence.

Expand Down
33 changes: 0 additions & 33 deletions issues/no-program-measures-toyos-against-linux-on-one-machine.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
status: open
kind: tooling
opened: 2026-09-29
---

# No published run compares ToyOS with Linux on one machine

`tests/guest/osbench` is the one program, built for `x86_64-unknown-toyos`
and `x86_64-unknown-linux-musl`, that measures each bench under its Ubuntu
24.04 and under the shipped ToyOS kernel. The rows this issue asks for are
its groups:

- memcpy from 64 B to 64 MiB: `mem.memcpy.*`;
- pipe round trips, and throughput at 64 B to 64 KiB: `pingpong.pipe.*`,
`pipe.throughput.*`;
- munmaps per second of a page a sibling on another core touched:
`mem.munmap_touched_remote.4k`. Each side reads its APIC ID from
CPUID.0BH:EDX (01H:EBX where 0BH enumerates nothing) before and after each
window, and `osbench_rules::pair::admit` refuses the window when the two
sides' IDs match or either side's changed across it;
- lateness past a 1 ms timer: `time.timer_1ms.late`;
- NVMe reads, read-only: `nvme.read.*`;
- an idle minute's package energy: `energy.idle_60s.package`;
- the machine's PCI, USB, NVMe and cpuidle identity: `identity`, with no
serial number or network identifier;
- the wired LAN's TCP round trip and throughput, and Wi-Fi's under Linux:
`lan.wired.*`, `lan.wifi.*`, against `osbench-peer` on another machine;
- a short CPU crunch, one thread then all, that stops at TjMax less 15 C
where the package's temperature can be read: `crunch.*`.

The cryptographic rows are not osbench's. AES-GCM, ChaCha20-Poly1305,
SHA-256 and the rest were measured under Linux on both benches against ring,
OpenSSL and AWS-LC by the crypto oracle probe, and that table is the
evidence: `ToyOSOrg/evidence` at `bed0b00efac82546b995f0841da54aea11c45694`,
`r2/table.md`.

What ToyOS cannot measure is reported `unsupported` by name, and is not a
comparison until it can:

- **NVMe reads**: a program reaches a disk's blocks only through a grant the
supervisor mints for a file server's role or the idle slot, and the bench's
NVMe holds another system.
- **Package energy and temperature**: no counter carries either
(`toyos_abi::counters::Counter`), so the ToyOS crunch runs its one-thread
phase alone and reports every all-core row `unmeasured`, with nothing to
stop it at. The kernel's sampler of `IA32_PACKAGE_THERM_STATUS`,
`MSR_TEMPERATURE_TARGET` and `MSR_PKG_ENERGY_STATUS` in
`issues/the-kernel-owns-cpu-performance-state.md` is what closes both. The
first ToyOS crunch on the T14 held 3,788 MHz all-core where Linux fell to
1.7-1.9 GHz, which
`issues/the-t14s-thermal-modes-do-not-move-its-package-power-limits.md`
would explain: ToyOS refuses the firmware's PL1 and PL2 writes.
- **Wi-Fi**: `issues/there-is-no-wifi.md`.
- **USB, NVMe and cpuidle identity**: their owners serve no program that
reads them.
- **Loopback** (`net.*`): netstack refuses 127/8 as a destination.

**Exit**: both systems' outputs on the T14 and the AMD bench published in
evidence, Linux's run before the T14's wipe. Linux's outputs are a goal
ToyOS's are compared against in evidence, never a fixture a test reads.
17 changes: 0 additions & 17 deletions issues/std-udp-socket-ignores-its-timeouts.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ and once to stop; on the AMD bench both sit at its TSC's floor.
**Next: a TSC-deadline twin on the T14**, `main` plus the scout with the
one-shot armed and stopped through `IA32_TSC_DEADLINE`, beside `main` plus
the scout in the same session. Each arm reads the 1 ms timer lateness of
`issues/no-program-measures-toyos-against-linux-on-one-machine.md` and the
`issues/no-published-run-compares-toyos-with-linux-on-one-machine.md` and the
split above, its re-arm segment opening at `set_timer` (`kernel/src/hw.rs:49`)
in both. Each arm runs 11 times; a run's figure is the median lateness of
its 1 ms timers, and an arm's is the median of its 11 with their spread,
Expand Down
2 changes: 1 addition & 1 deletion issues/toyos-beats-linuxs-latency-on-the-t14.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ and of the thread it wakes under Linux's loaded longest on those seven CPUs,
masked windows. Two files owe it: step 2 of
`issues/the-diary-computes-no-lateness-and-records-no-slow-system-call.md`, a
reader that computes timer and thread lateness from the ring, and
`issues/no-program-measures-toyos-against-linux-on-one-machine.md`,
`issues/no-published-run-compares-toyos-with-linux-on-one-machine.md`,
one program that reads lateness past a 1 ms timer under both systems.
4 changes: 2 additions & 2 deletions issues/toyos-uses-what-modern-hardware-offers-for-speed.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ model 60h) and AMD EPYC KVM guests, and a stage's correctness test runs on
each that has its feature. A figure is the T14's, and the AMD bench's too
where the stage's path differs there, since the EPYC guests are shared CI
runners: the median of 11 runs with its spread, taken by the program of
`issues/no-program-measures-toyos-against-linux-on-one-machine.md`.
`issues/no-published-run-compares-toyos-with-linux-on-one-machine.md`.
A stage that its hardware's manufacturers or the published state of the art
back follows and cites them, and its figure is reported and never blocks it: a
slowdown is filed as a defect carrying both figures and investigated. A stage nothing published covers is
Expand Down Expand Up @@ -82,7 +82,7 @@ taken: the instruments, then what is measured, then the design rounds not
yet measured.

- `issues/no-test-can-hold-a-thread-on-a-named-cpu.md`
- `issues/no-program-measures-toyos-against-linux-on-one-machine.md`
- `issues/no-published-run-compares-toyos-with-linux-on-one-machine.md`
- `issues/no-row-holds-a-wake-beside-seven-spinners-to-100-us.md`
- `issues/per-cpu-scheduler-and-pmm-state-shares-lines-every-cpu-writes.md`
- `issues/a-wake-storm-costs-the-t14-twice-the-amd-benchs-time-per-waiter-and-nothing-says-why.md`
Expand Down
20 changes: 12 additions & 8 deletions sdk/std/sys/net/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ fn addr_to_v4(addr: &SocketAddr) -> io::Result<([u8; 4], u16)> {
}
}

fn duration_to_ms(d: Option<Duration>) -> u32 {
/// A timeout as the protocol's milliseconds, where 0 is no bound: a zero
/// timeout is refused, as std's contract has it, and one under a millisecond
/// waits one, not forever.
fn timeout_ms(d: Option<Duration>) -> io::Result<u32> {
match d {
Some(d) => d.as_millis().min(u32::MAX as u128) as u32,
None => 0,
Some(Duration::ZERO) => Err(io::Error::ZERO_TIMEOUT),
Some(d) => Ok(d.as_millis().clamp(1, u32::MAX as u128) as u32),
None => Ok(0),
}
}

Expand Down Expand Up @@ -136,7 +140,7 @@ impl TcpStream {

pub fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpStream> {
let (ip, port) = addr_to_v4(addr)?;
let connected = stream::connect(ip, port, duration_to_ms(Some(timeout)), false).map_err(net_err_to_io)?;
let connected = stream::connect(ip, port, timeout_ms(Some(timeout))?, false).map_err(net_err_to_io)?;
Ok(TcpStream::from_fd(stream_fd(connected.handle)?))
}

Expand All @@ -145,12 +149,12 @@ impl TcpStream {
}

pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
self.read_timeout_ms.store(duration_to_ms(dur), Relaxed);
self.read_timeout_ms.store(timeout_ms(dur)?, Relaxed);
Ok(())
}

pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
self.write_timeout_ms.store(duration_to_ms(dur), Relaxed);
self.write_timeout_ms.store(timeout_ms(dur)?, Relaxed);
Ok(())
}

Expand Down Expand Up @@ -479,12 +483,12 @@ impl UdpSocket {
}

pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
self.read_timeout_ms.store(duration_to_ms(dur), Relaxed);
self.read_timeout_ms.store(timeout_ms(dur)?, Relaxed);
Ok(())
}

pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
self.write_timeout_ms.store(duration_to_ms(dur), Relaxed);
self.write_timeout_ms.store(timeout_ms(dur)?, Relaxed);
Ok(())
}

Expand Down
9 changes: 8 additions & 1 deletion tests/guest/osbench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
# The work group's compression, pure Rust and the same code on both systems.
# The work and crunch groups' compression, pure Rust and the same code on both systems.
miniz_oxide = "0.9"
# The crunch group's hashing: ToyOS's own SHA-256, which its ssh server runs.
toyos-crypto = { path = "../../../lib/crypto" }
# The crunch group's compile-like task: parsing Rust, with no compiler to load.
syn = { version = "2", default-features = false, features = ["full", "parsing"] }
# The LAN group's two ends, and the rules readings are judged by.
osbench-lan = { path = "lan" }
osbench-rules = { path = "rules" }

[target.'cfg(target_os = "toyos")'.dependencies]
toyos-abi = { path = "../../../sdk/abi" }
Expand Down
17 changes: 17 additions & 0 deletions tests/guest/osbench/lan/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "osbench-lan"
description = "osbench's LAN measurement, both ends: a bench finds its peer by broadcast and times TCP to it; the peer, `osbench-peer`, echoes, sinks and sources for it on any host."
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false

# A package of its own because osbench builds for ToyOS and Linux alone, and
# the peer runs on whatever machine stands on the other end of the link.

[lib]
doctest = false

[[bin]]
name = "osbench-peer"
path = "src/main.rs"
Loading