From f9c162890fdaaa30de23f451398afde3fa57aad4 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Mon, 5 Oct 2026 07:57:20 -0500 Subject: [PATCH] qualification harness: R11 runs inside its own quiet hold; R15 preflight counts CPU cycles only Two harness defects found in the 2026-10-05 12:53Z CAND-1 quiet window (neither touches runtime sources): - tests/runtime/rx_r11_aien.c refused the living run whenever ~/workspace/.spark-quiet existed, including the quietlock hold taken for R11 itself, so R11 could never run inside an exclusive window. It now treats the flag as its own only when the flag line carries hold= and QUIETLOCK_HOLD= is set (exact token). Any other flag still refuses. Test: tests/runtime/r11_own_hold_test.sh (make test-r11-own-hold): no hold, prefix and extension refuse; exact id runs. Red on the CAND-1 binary (exact id refused), green here. - tools/r15_machine_state.sh preflight matched every "cycles" line. This kernel also lists smmuv3_pmcg_*/cycles/ in each interval, so the per-second divisor became 0 (awk: division by zero) and the run stopped before any trial although CPU7 held ~3.9 GHz. The parser now counts only the CPU PMU event (cycles or armv8_pmuv3[_N]/cycles/), lives in preflight_ghz, and is testable via `preflight-parse `. Test: tests/r15_preflight_test.sh (make test-r15-preflight) with the real failing file, the 2026-09-29 PASS file, a 3 GHz core (exit 3) and a file without CPU cycles (exit 4). Cut-off 3.75 GHz unchanged. Co-Authored-By: Claude Opus 5.5 --- .crumb | 20 ++--- Makefile | 11 +++ tests/.crumb | 12 +-- tests/r15_preflight/cpu-pmu-only.csv | 22 +++++ tests/r15_preflight/kernel-with-smmu-pmus.csv | 82 +++++++++++++++++++ tests/r15_preflight/no-cpu-cycles.csv | 22 +++++ tests/r15_preflight/slow-core-3ghz.csv | 39 +++++++++ tests/r15_preflight_test.sh | 19 +++++ tests/runtime/.crumb | 8 +- tests/runtime/r11_own_hold_test.sh | 18 ++++ tests/runtime/rx_r11_aien.c | 21 ++++- tools/.crumb | 10 +-- tools/r15_machine_state.sh | 34 +++++--- 13 files changed, 281 insertions(+), 37 deletions(-) create mode 100644 tests/r15_preflight/cpu-pmu-only.csv create mode 100644 tests/r15_preflight/kernel-with-smmu-pmus.csv create mode 100644 tests/r15_preflight/no-cpu-cycles.csv create mode 100644 tests/r15_preflight/slow-core-3ghz.csv create mode 100755 tests/r15_preflight_test.sh create mode 100755 tests/runtime/r11_own_hold_test.sh diff --git a/.crumb b/.crumb index d1bf8f588..b6c153113 100644 --- a/.crumb +++ b/.crumb @@ -52,7 +52,7 @@ }, { "digest": "a8a6ffb506990abae94d79c8e37d12a40e5989e791f9133dd71e3002d2d24661", - "last_commit": "815cd31", + "last_commit": "30c65a3", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -64,7 +64,7 @@ }, { "digest": "052b73debc780209673d2f422317d17cd85a45084ea9e97bd11900d2c633bf7f", - "last_commit": "85a3fc2", + "last_commit": "30c65a3", "name": "mk", "purpose": "Directory mk. Purpose not yet described by a human." }, @@ -93,27 +93,27 @@ "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "dcc9bbb8d307509f8731fa57c75b31adb93b38d18c51f1c09a0fcd68b0acba1c", + "digest": "3748d8a47daad04a5d7f35ca7c84ddec4538bb06db72325c36da8f599d487424", "last_commit": "ddf200d", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, { - "digest": "58b5c63f4c60baa5317f02058e05faf6e5880a4b934a5322ce4ba0e78c286da6", - "last_commit": "85a3fc2", + "digest": "a73d0d57e85ad3212a677ae5bfca5b7ff187e871e01f198039a7b4cb275a3a83", + "last_commit": "30c65a3", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:c0354c713bff0f7a743a9473aca4bb3065b526ae590e3affc54193002ce9f17c", - "compiled_at": "2026-10-05T12:22:26Z", + "children_root": "sha256:4e75c0870cb017a2ee464cf88cb7d590c917a5313724881fba330d23e5eabc65", + "compiled_at": "2026-10-05T12:57:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:ba622665f7e3f32bdbc50a6e9c4edfc419300c5ae6408bea02054b54a403eb12", + "digest": "sha256:fcc5817eb19e390276f6892c001bbb1e1ec8e8568b8342fdae2d627e2f8256d1", "evidence_files": 1758, "evidence_root": "sha256:46d495732e1625f6b9056433620a2da0fdc40ff88dfcf67fce42761b3f2c8556", "files": 3532, - "generated_at_commit": "815cd313740e1d763e9aaf093876588d9ede97d5", - "source_tree": "sha256:8ff46d871179f0b06654b1eb59f5834682c287913a653caf3dd43aa3ad65a2cf" + "generated_at_commit": "30c65a33c8f7523fa1e0dbe752cb47667d6bf9b2", + "source_tree": "sha256:4eef42ea4e4647fb8eb0df752b8a5351463d2d5175aff839f5b912eb0d7b5660" }, "owner_lane": "", "provenance": { diff --git a/Makefile b/Makefile index b2c4695d2..4c4d51fcd 100644 --- a/Makefile +++ b/Makefile @@ -503,6 +503,11 @@ $(RX_R11_TEST): $(RX_R11_SRCS) $(RX_AIEN_OBJ) src/runtime/rx_omega.h src/runtime test-r11: $(RX_R11_TEST) ./$(RX_R11_TEST) +# R11 living run allowed inside its own quietlock hold, refused under any other. +.PHONY: test-r11-own-hold +test-r11-own-hold: $(RX_R11_TEST) + sh tests/runtime/r11_own_hold_test.sh ./$(RX_R11_TEST) + # OMEGA_STATE_PROJECTION: cognition gets a compiled state projection from # Cortex, not everything Cortex knows. Part B drives the real R11 AIEN faculty # under the native AIENOS authority. The projection objects are built alone @@ -808,6 +813,12 @@ r15-receipt: test-r15-receipt: tests/r15_receipt_test.sh +# R15 preflight parser: counts only the CPU PMU cycles event (SMMU PMUs list +# "cycles" too on newer kernels). Host-only, fixtures, seconds. +.PHONY: test-r15-preflight +test-r15-preflight: + sh tests/r15_preflight_test.sh + # R16-G2 code-search gate (spec/r16-orchestrator-retirement.md). Host-only C tool, # seconds, no network. Scans the five repos (paths from R16_REPO_OMEGA, # R16_REPO_SOVEREIGN_CORE, R16_REPO_AEGIS_RUNTIME, R16_REPO_AIENOS, diff --git a/tests/.crumb b/tests/.crumb index c531ae746..f7fdc7bc0 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -253,7 +253,7 @@ "purpose": "Directory tests/relations. Purpose not yet described by a human." }, { - "digest": "35716e4886e855c8dd0aa92bdb95d3c12b9fa7c3f0427293531e0c6f39c10dea", + "digest": "1a83ea5132a39ab01521819c06af3301ad3a334dd8a0879d93288f35afe74de7", "last_commit": "a2b8ccd", "name": "runtime", "purpose": "Directory tests/runtime. Purpose not yet described by a human." @@ -283,15 +283,15 @@ "purpose": "Directory tests/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:f41a548c1ae9abe8a9e71e6609852343b4f435a229a0cb9ad2765fe189c08275", - "compiled_at": "2026-10-05T04:30:49Z", + "children_root": "sha256:a13a167053cc89a288ed0fd763fdcc40878863a7a699e03552cdcfae05e84a5d", + "compiled_at": "2026-10-05T12:57:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:dcc9bbb8d307509f8731fa57c75b31adb93b38d18c51f1c09a0fcd68b0acba1c", + "digest": "sha256:3748d8a47daad04a5d7f35ca7c84ddec4538bb06db72325c36da8f599d487424", "evidence_files": 11, "evidence_root": "sha256:d5c1bceb4d57ef0eb42797c58801b5926509711614c3e38bb7105b6efa3942f2", "files": 791, - "generated_at_commit": "93191b4138e4b5df8fe72ac357816870d3a1f495", - "source_tree": "sha256:c29dea40c16fcff6d95ead6902e10826ba8577a10353890498ce2b6df9c60be2" + "generated_at_commit": "30c65a33c8f7523fa1e0dbe752cb47667d6bf9b2", + "source_tree": "sha256:216cf1c3f19f01eaf245e99ef207c4e0eec9ad1d0ca15927eaff23b1703c464e" }, "owner_lane": "", "provenance": { diff --git a/tests/r15_preflight/cpu-pmu-only.csv b/tests/r15_preflight/cpu-pmu-only.csv new file mode 100644 index 000000000..63098fff6 --- /dev/null +++ b/tests/r15_preflight/cpu-pmu-only.csv @@ -0,0 +1,22 @@ +# started on Mon Sep 28 21:57:35 2026 + +1.005025630,CPU7,3909410147,,armv8_pmuv3_1/cycles/,1005041760,100.00,, +2.010579838,CPU7,3918518224,,armv8_pmuv3_1/cycles/,1005548512,100.00,, +3.015652043,CPU7,3916591344,,armv8_pmuv3_1/cycles/,1005068192,100.00,, +4.020781512,CPU7,3916469592,,armv8_pmuv3_1/cycles/,1005125520,100.00,, +5.026200678,CPU7,3917969850,,armv8_pmuv3_1/cycles/,1005414304,100.00,, +6.031617668,CPU7,3917369558,,armv8_pmuv3_1/cycles/,1005412512,100.00,, +7.033284912,CPU7,3903076384,,armv8_pmuv3_1/cycles/,1001662032,100.00,, +8.038717613,CPU7,3917888204,,armv8_pmuv3_1/cycles/,1005428224,100.00,, +9.043902809,CPU7,3918188315,,armv8_pmuv3_1/cycles/,1005181104,100.00,, +10.049076501,CPU7,3916911514,,armv8_pmuv3_1/cycles/,1005167984,100.00,, +11.054173231,CPU7,3916211293,,armv8_pmuv3_1/cycles/,1005092240,100.00,, +12.059622380,CPU7,3917880599,,armv8_pmuv3_1/cycles/,1005444128,100.00,, +13.065041111,CPU7,3917461816,,armv8_pmuv3_1/cycles/,1005413888,100.00,, +14.070472515,CPU7,3917812913,,armv8_pmuv3_1/cycles/,1005425952,100.00,, +15.075647405,CPU7,3917000423,,armv8_pmuv3_1/cycles/,1005170464,100.00,, +16.081064744,CPU7,3917347777,,armv8_pmuv3_1/cycles/,1005413200,100.00,, +17.086485139,CPU7,3917410046,,armv8_pmuv3_1/cycles/,1005415216,100.00,, +18.091902637,CPU7,3917110016,,armv8_pmuv3_1/cycles/,1005412080,100.00,, +19.097150934,CPU7,3917234240,,armv8_pmuv3_1/cycles/,1005243568,100.00,, +20.002155003,CPU7,3525687277,,armv8_pmuv3_1/cycles/,905000352,100.00,, diff --git a/tests/r15_preflight/kernel-with-smmu-pmus.csv b/tests/r15_preflight/kernel-with-smmu-pmus.csv new file mode 100644 index 000000000..272320138 --- /dev/null +++ b/tests/r15_preflight/kernel-with-smmu-pmus.csv @@ -0,0 +1,82 @@ +# started on Mon Oct 5 07:53:58 2026 + +1.004338557,CPU7,3909761433,,armv8_pmuv3_1/cycles/,1005275344,100.00,, +1.004338557,CPU7,6574,,smmuv3_pmcg_13002/cycles/,1005273248,100.00,, +1.004338557,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005270576,100.00,, +1.004338557,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005267472,100.00,, +2.010329285,CPU7,3920135222,,armv8_pmuv3_1/cycles/,1005982640,100.00,, +2.010329285,CPU7,120071,,smmuv3_pmcg_13002/cycles/,1005981296,100.00,, +2.010329285,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005979744,100.00,, +2.010329285,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005978528,100.00,, +3.016424654,CPU7,3919914333,,armv8_pmuv3_1/cycles/,1005993392,100.00,, +3.016424654,CPU7,6300,,smmuv3_pmcg_13002/cycles/,1005993440,100.00,, +3.016424654,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005993520,100.00,, +3.016424654,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005993440,100.00,, +4.022333812,CPU7,3919345887,,armv8_pmuv3_1/cycles/,1005992960,100.00,, +4.022333812,CPU7,6533,,smmuv3_pmcg_13002/cycles/,1005992656,100.00,, +4.022333812,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005992464,100.00,, +4.022333812,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005992384,100.00,, +5.028252715,CPU7,3921122194,,armv8_pmuv3_1/cycles/,1005996432,100.00,, +5.028252715,CPU7,6293,,smmuv3_pmcg_13002/cycles/,1005997200,100.00,, +5.028252715,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005997840,100.00,, +5.028252715,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005998176,100.00,, +6.034447683,CPU7,3919338243,,armv8_pmuv3_1/cycles/,1005989328,100.00,, +6.034447683,CPU7,6232,,smmuv3_pmcg_13002/cycles/,1005988736,100.00,, +6.034447683,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005988176,100.00,, +6.034447683,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005987840,100.00,, +7.040245064,CPU7,3919272100,,armv8_pmuv3_1/cycles/,1005994432,100.00,, +7.040245064,CPU7,6286,,smmuv3_pmcg_13002/cycles/,1005993984,100.00,, +7.040245064,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005993776,100.00,, +7.040245064,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005993680,100.00,, +8.046329663,CPU7,3919190820,,armv8_pmuv3_1/cycles/,1005991456,100.00,, +8.046329663,CPU7,6273,,smmuv3_pmcg_13002/cycles/,1005991312,100.00,, +8.046329663,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005991216,100.00,, +8.046329663,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005991184,100.00,, +9.052323668,CPU7,3919760621,,armv8_pmuv3_1/cycles/,1005992880,100.00,, +9.052323668,CPU7,6280,,smmuv3_pmcg_13002/cycles/,1005992848,100.00,, +9.052323668,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005992928,100.00,, +9.052323668,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005992832,100.00,, +10.058338586,CPU7,3918944475,,armv8_pmuv3_1/cycles/,1005994960,100.00,, +10.058338586,CPU7,6273,,smmuv3_pmcg_13002/cycles/,1005995376,100.00,, +10.058338586,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005995456,100.00,, +10.058338586,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005995632,100.00,, +11.064330399,CPU7,3919255127,,armv8_pmuv3_1/cycles/,1005993648,100.00,, +11.064330399,CPU7,6410,,smmuv3_pmcg_13002/cycles/,1005993440,100.00,, +11.064330399,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005993440,100.00,, +11.064330399,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005993264,100.00,, +12.070332851,CPU7,3920190756,,armv8_pmuv3_1/cycles/,1005993264,100.00,, +12.070332851,CPU7,6265,,smmuv3_pmcg_13002/cycles/,1005993136,100.00,, +12.070332851,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005992944,100.00,, +12.070332851,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005992912,100.00,, +13.076604329,CPU7,3919345338,,armv8_pmuv3_1/cycles/,1005991584,100.00,, +13.076604329,CPU7,6407,,smmuv3_pmcg_13002/cycles/,1005991472,100.00,, +13.076604329,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005991568,100.00,, +13.076604329,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005991600,100.00,, +14.082245035,CPU7,3920930765,,armv8_pmuv3_1/cycles/,1005992816,100.00,, +14.082245035,CPU7,6433,,smmuv3_pmcg_13002/cycles/,1005992928,100.00,, +14.082245035,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005992896,100.00,, +14.082245035,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005992976,100.00,, +15.088328687,CPU7,3919409260,,armv8_pmuv3_1/cycles/,1005993328,100.00,, +15.088328687,CPU7,6421,,smmuv3_pmcg_13002/cycles/,1005993312,100.00,, +15.088328687,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005993264,100.00,, +15.088328687,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005993168,100.00,, +16.094323602,CPU7,3919146674,,armv8_pmuv3_1/cycles/,1005994304,100.00,, +16.094323602,CPU7,6236,,smmuv3_pmcg_13002/cycles/,1005994320,100.00,, +16.094323602,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005994336,100.00,, +16.094323602,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005994912,100.00,, +17.100334981,CPU7,3919805981,,armv8_pmuv3_1/cycles/,1005992592,100.00,, +17.100334981,CPU7,6445,,smmuv3_pmcg_13002/cycles/,1005992560,100.00,, +17.100334981,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005992528,100.00,, +17.100334981,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005991952,100.00,, +18.106330999,CPU7,3921042050,,armv8_pmuv3_1/cycles/,1005996720,100.00,, +18.106330999,CPU7,123914,,smmuv3_pmcg_13002/cycles/,1005997712,100.00,, +18.106330999,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005998048,100.00,, +18.106330999,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005998496,100.00,, +19.112326441,CPU7,3920211620,,armv8_pmuv3_1/cycles/,1005991072,100.00,, +19.112326441,CPU7,6549,,smmuv3_pmcg_13002/cycles/,1005990160,100.00,, +19.112326441,CPU7,6,,smmuv3_pmcg_13042/cycles/,1005990144,100.00,, +19.112326441,CPU7,6,,smmuv3_pmcg_13062/cycles/,1005990144,100.00,, +20.003569082,CPU7,3469533757,,armv8_pmuv3_1/cycles/,890345088,100.00,, +20.003569082,CPU7,6285,,smmuv3_pmcg_13002/cycles/,890345152,100.00,, +20.003569082,CPU7,6,,smmuv3_pmcg_13042/cycles/,890344928,100.00,, +20.003569082,CPU7,6,,smmuv3_pmcg_13062/cycles/,890344672,100.00,, diff --git a/tests/r15_preflight/no-cpu-cycles.csv b/tests/r15_preflight/no-cpu-cycles.csv new file mode 100644 index 000000000..1ef8d6ee9 --- /dev/null +++ b/tests/r15_preflight/no-cpu-cycles.csv @@ -0,0 +1,22 @@ +# started on test + +1.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +2.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +3.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +4.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +5.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +6.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +7.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +8.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +9.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +10.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +11.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +12.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +13.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +14.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +15.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +16.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +17.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +18.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +19.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, +20.0,CPU7,9,,smmuv3_pmcg_13002/cycles/,1,100.00,, diff --git a/tests/r15_preflight/slow-core-3ghz.csv b/tests/r15_preflight/slow-core-3ghz.csv new file mode 100644 index 000000000..576767974 --- /dev/null +++ b/tests/r15_preflight/slow-core-3ghz.csv @@ -0,0 +1,39 @@ +1.0,CPU7,3000000000,,cycles,1,100.00,, +2.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +2.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +3.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +3.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +4.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +4.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +5.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +5.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +6.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +6.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +7.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +7.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +8.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +8.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +9.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +9.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +10.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +10.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +11.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +11.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +12.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +12.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +13.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +13.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +14.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +14.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +15.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +15.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +16.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +16.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +17.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +17.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +18.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +18.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +19.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +19.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, +20.0,CPU7,3000000000,,armv8_pmuv3_1/cycles/,1,100.00,, +20.0,CPU7,9,,smmuv3_pmcg_1/cycles/,1,100.00,, diff --git a/tests/r15_preflight_test.sh b/tests/r15_preflight_test.sh new file mode 100755 index 000000000..03803e4b5 --- /dev/null +++ b/tests/r15_preflight_test.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# R15 preflight parser regression (tools/r15_machine_state.sh preflight-parse). +# kernel-with-smmu-pmus.csv is the 2026-10-05 12:53Z preflight file whose SMMU +# PMU "cycles" lines made the old parser divide by zero; cpu-pmu-only.csv is the +# 2026-09-29 PASS run's file. Both must read the X925 at ~3.9 GHz (exit 0); a +# 3 GHz core must fail the 3.75 GHz cut (exit 3); a file with no CPU cycles +# event must report no samples (exit 4), never a clock. +cd "$(dirname "$0")/.." || exit 1 +T=tools/r15_machine_state.sh; D=tests/r15_preflight; fail=0 +check() { # file expected-exit expected-text + out=$("$T" preflight-parse "$D/$1" 2>&1); rc=$? + if [ "$rc" = "$2" ] && printf '%s\n' "$out" | grep -Fq -- "$3"; then echo "[+] $1: exit $rc" + else echo "[-] $1: exit $rc (want $2), output: $(printf '%s' "$out" | tail -1)"; fail=$((fail + 1)); fi +} +check kernel-with-smmu-pmus.csv 0 "median seconds 13-20: 3.896 GHz" +check cpu-pmu-only.csv 0 "median seconds 13-20: 3.896 GHz" +check slow-core-3ghz.csv 3 "median seconds 13-20: 3.000 GHz" +check no-cpu-cycles.csv 4 "preflight: no samples" +echo "failures $fail"; [ "$fail" = 0 ] diff --git a/tests/runtime/.crumb b/tests/runtime/.crumb index a24aeb96e..a8eb285ea 100644 --- a/tests/runtime/.crumb +++ b/tests/runtime/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-05T04:03:03Z", + "compiled_at": "2026-10-05T12:57:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:35716e4886e855c8dd0aa92bdb95d3c12b9fa7c3f0427293531e0c6f39c10dea", + "digest": "sha256:1a83ea5132a39ab01521819c06af3301ad3a334dd8a0879d93288f35afe74de7", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 52, - "generated_at_commit": "e5593ae488fcb9038557a4317a07faa7625649a3", - "source_tree": "sha256:3d30b46c9f76993c8e7ce621a230484c23179800c3433c2a59fb737788addf54" + "generated_at_commit": "30c65a33c8f7523fa1e0dbe752cb47667d6bf9b2", + "source_tree": "sha256:92b474546d23661a1232bc2f7ebce5bd7ab3c6aae1f8cb6137c82c523446cccc" }, "owner_lane": "", "provenance": { diff --git a/tests/runtime/r11_own_hold_test.sh b/tests/runtime/r11_own_hold_test.sh new file mode 100755 index 000000000..d16128cc1 --- /dev/null +++ b/tests/runtime/r11_own_hold_test.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# R11 living run inside its own quiet hold (tests/runtime/rx_r11_aien.c +# quiet_flag_is_mine). With a fake HOME whose ~/workspace/.spark-quiet carries +# hold=q1-abc: no QUIETLOCK_HOLD, a prefix and an extension of the id must all +# refuse the living run (someone else's measurement); QUIETLOCK_HOLD=q1-abc +# must run it. usage: r11_own_hold_test.sh +B=${1:?rx_r11_aien_test binary}; H=$(mktemp -d); fail=0 +trap 'rm -rf "$H"' EXIT +mkdir -p "$H/workspace" +echo "other quietlock X start=2026-10-05T00:00:00Z expected_end=2099-01-01T00:00:00Z pid=1 hold=q1-abc" > "$H/workspace/.spark-quiet" +for hold in "" q1-ab q1-abcd q1-abc; do + out=$(HOME=$H QUIETLOCK_HOLD=$hold "$B" 2>&1) + if printf '%s\n' "$out" | grep -Fq "living run not exercised"; then got=refused; else got=ran; fi + if [ "$hold" = q1-abc ]; then want=ran; else want=refused; fi + printf '%s\n' "$out" | grep -Eq '^checks [0-9]+ failures 0$' || { got="$got+failures"; } + if [ "$got" = "$want" ]; then echo "[+] hold='$hold': $got"; else echo "[-] hold='$hold': $got, want $want"; fail=$((fail + 1)); fi +done +echo "failures $fail"; [ "$fail" = 0 ] diff --git a/tests/runtime/rx_r11_aien.c b/tests/runtime/rx_r11_aien.c index 5e3801fa1..e1df1fdc5 100644 --- a/tests/runtime/rx_r11_aien.c +++ b/tests/runtime/rx_r11_aien.c @@ -649,6 +649,25 @@ static int envB_start(Env *e, int with_aien) { } +/* The quiet flag belongs to this run when quietlock started it under that + * hold: the flag line carries hold= and QUIETLOCK_HOLD= is set in this + * process (tools/quietlock). Any other flag is someone else's measurement. */ +static int quiet_flag_is_mine(const char *flag) { + const char *mine = getenv("QUIETLOCK_HOLD"); + if (!mine || !mine[0]) return 0; + FILE *f = fopen(flag, "r"); + if (!f) return 0; + char line[1024] = { 0 }, tok[300]; + int ok = fgets(line, sizeof line, f) != NULL; + fclose(f); + if (!ok) return 0; + snprintf(tok, sizeof tok, "hold=%s", mine); + size_t tn = strlen(tok); + for (char *p = strstr(line, tok); p; p = strstr(p + 1, tok)) + if ((p == line || p[-1] == ' ') && (p[tn] == ' ' || p[tn] == '\n' || p[tn] == '\0')) return 1; + return 0; +} + /* A timed phase measures this host. When an R15 timed measurement is * running (its quiet flag exists or an R15 program is alive) or the machine * is already loaded, the numbers would describe the other work, so the @@ -657,7 +676,7 @@ static int other_load(char *why, size_t n) { const char *home = getenv("HOME"); char flag[512]; snprintf(flag, sizeof flag, "%s/workspace/.spark-quiet", home ? home : ""); - if (access(flag, F_OK) == 0) { + if (access(flag, F_OK) == 0 && !quiet_flag_is_mine(flag)) { snprintf(why, n, "an R15 timed measurement holds ~/workspace/.spark-quiet"); return 1; } diff --git a/tools/.crumb b/tools/.crumb index b85ac0a7d..a8f818467 100644 --- a/tools/.crumb +++ b/tools/.crumb @@ -44,7 +44,7 @@ }, { "digest": "5bf3209bf3f715b5a3059c845b62bbe74e24b04968d3de4ae5ef35ff493a83b2", - "last_commit": "b37e34b", + "last_commit": "30c65a3", "name": "estimation", "purpose": "Directory tools/estimation. Purpose not yet described by a human." }, @@ -56,14 +56,14 @@ } ], "children_root": "sha256:6ed09e33b610372de30ea2d6372b94240127e9acb4d178879cbd5448faab6909", - "compiled_at": "2026-10-05T12:20:02Z", + "compiled_at": "2026-10-05T12:57:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:58b5c63f4c60baa5317f02058e05faf6e5880a4b934a5322ce4ba0e78c286da6", + "digest": "sha256:a73d0d57e85ad3212a677ae5bfca5b7ff187e871e01f198039a7b4cb275a3a83", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 127, - "generated_at_commit": "85a3fc2488650bde3cebfc67ed71cb87fcbc3163", - "source_tree": "sha256:f72d9a96e4f83ec3c9ccf8be060917a415dc126cef7de62b4de7c95457c9502e" + "generated_at_commit": "30c65a33c8f7523fa1e0dbe752cb47667d6bf9b2", + "source_tree": "sha256:3867d4b3de9dbfe7a8bf2906b03e78e2633a11054860a385d1c0178907f5eece" }, "owner_lane": "", "provenance": { diff --git a/tools/r15_machine_state.sh b/tools/r15_machine_state.sh index 5aeaff0e2..7ae308c03 100755 --- a/tools/r15_machine_state.sh +++ b/tools/r15_machine_state.sh @@ -16,12 +16,32 @@ # cycle counter (perf, system-wide, read from outside the measured processes) # divided by the core's busy time from /proc/stat. set -u +CUT_GHZ=3.75 # the preflight fails below this sustained median + +# preflight_ghz : effective GHz per second while the core was fully +# busy (1 s intervals); exit 0 if the median of seconds 13-20 reaches CUT_GHZ, +# 3 below it, 4 with no samples. Counts only the CPU PMU cycles event: newer +# kernels also list SMMU PMUs (smmuv3_pmcg_*/cycles/) in the same interval, +# which are not core clocks. +preflight_ghz() { + awk -F, -v cut="$CUT_GHZ" ' + $5 == "cycles" || $5 ~ /^armv8_pmuv3(_[0-9]+)?\/cycles\/$/ { n++; g = $3 / ($1 - last) / 1e9; last = $1; if (n > 12 && n <= 20) s[++m] = g; all = all sprintf(" %.3f", g) } + END { + if (m == 0) { print "preflight: no samples"; exit 4 } + asort(s); med = (m % 2) ? s[(m + 1) / 2] : (s[m / 2] + s[m / 2 + 1]) / 2 + printf "per-second GHz:%s\nmedian seconds 13-20: %.3f GHz (cut-off %.2f)\n", all, med, cut + exit (med < cut) ? 3 : 0 + }' "$1" +} + +# preflight-parse : the preflight verdict on a recorded file (tests). +if [ "${1:-}" = preflight-parse ]; then preflight_ghz "${2:?perf csv}"; exit $?; fi + CMD=${1:?preflight, start, mark or stop} OUT=${2:?out dir} mkdir -p "$OUT" X925=7 # the preflight core (a Cortex-X925) SAMPLER_CPU=${R15_STATE_CPU:-0} -CUT_GHZ=3.75 # the preflight fails below this sustained median spbm_energy() { for h in /sys/class/hwmon/hwmon*; do @@ -41,15 +61,7 @@ preflight) sudo -n perf stat -a -A -C "$X925" -e cycles -I 1000 -x, -o "$OUT/preflight-perf.csv" -- \ taskset -c "$X925" timeout 20 sha256sum /dev/zero >/dev/null 2>&1 busy >> "$F" - # effective GHz per second while the core was fully busy (1 s intervals) - awk -F, -v cut="$CUT_GHZ" ' - /cycles/ { n++; g = $3 / ($1 - last) / 1e9; last = $1; if (n > 12 && n <= 20) s[++m] = g; all = all sprintf(" %.3f", g) } - END { - if (m == 0) { print "preflight: no samples"; exit 4 } - asort(s); med = (m % 2) ? s[(m + 1) / 2] : (s[m / 2] + s[m / 2 + 1]) / 2 - printf "per-second GHz:%s\nmedian seconds 13-20: %.3f GHz (cut-off %.2f)\n", all, med, cut - exit (med < cut) ? 3 : 0 - }' "$OUT/preflight-perf.csv" >> "$F" + preflight_ghz "$OUT/preflight-perf.csv" >> "$F" rc=$? [ $rc = 0 ] && echo "result: X925 sustains its clock" >> "$F" || echo "result: MACHINE-STATE FAILURE (rc $rc)" >> "$F" exit $rc @@ -96,7 +108,7 @@ stop) # cycles of each X925 core (cpus 5-9, 15-19) as GHz. A fully busy second # reads as the effective clock; a partly idle second reads lower, so the # busy jiffies in machine-state.ndjson decide individual seconds. - awk -F, '/cycles/ { split($2, c, "CPU"); cpu = c[2] + 0 + awk -F, '$5 == "cycles" || $5 ~ /^armv8_pmuv3(_[0-9]+)?\/cycles\/$/ { split($2, c, "CPU"); cpu = c[2] + 0 if ((cpu >= 5 && cpu <= 9) || (cpu >= 15 && cpu <= 19)) { g = $3 / 1e9; if (g >= 1.0) v[++n] = g } } END { if (!n) { print "X925: no second above 1 GHz of cycles"; exit }