S145 · SOURCE-BOUND GATE EVIDENCE
K2: IPC RECV deadline, stale-waiter temizliği ve fresh delivery
Operations --test hedefi → focused test içindeki include_str!/#[path] bağı → kaynak kesiti Bu sayfa yalnız S145 kapısına aittir; komşu kapıların kaynakları bu kabulün içine katılmaz.
S145Focused kod testiOperations id exactsource SHA exacttest target exact
operation: k2-ipc-recv-deadline-stale-waiter-partial
uygulama/model · focused test · Operations · 3 exact excerpt
sequence-bound=true · implementation-bound=true
01 · Testin bağlı olduğu uygulama/model kodu
Kapının yürüttüğü gerçek kaynak
tam Rust öğesiL14–L73
kernel/src/arch/aarch64/exceptions.rs::TICKS
use super::{gic, timer};
/// Global tick sayacı. Drift ölçümü + scheduler tick için.
pub static TICKS: AtomicU64 = AtomicU64::new(0);
/// Trampoline'ın stack üzerine kaydettiği register seti.
/// `exceptions.S` içindeki layout ile birebir aynı olmalı.
///
/// TODO(M3.4-real / Audit #19): Exception'lar için ayrı bir IRQ stack ayır
/// (şu an her task'in kendi stack'ini kullanıyor → 16 KiB task stack üzerinde
/// 272 byte trap frame + Rust handler local'leri = nested IRQ veya derin
/// scheduler çağrısı stack overflow yapabilir). Çözüm: per-CPU `IRQ_STACK`
/// statik (4 KiB), trampoline başında SP_EL0 swap.
///
/// TODO(M3.4-real / Audit #12): TaskContext'e ELR_EL1, SPSR_EL1, DAIF, TPIDR
/// alanları eklenmeli. Şu anda cooperative scheduler bunlara ihtiyaç duymuyor
/// (yield_now bir fonksiyon çağrısı, callee-saved registerlar yeter); ama
/// gerçek IRQ-driven preemption (timer IRQ → context_switch) exception
/// frame'inin tamamını task'e bağlamak zorunda.
#[repr(C)]
pub struct ExceptionContext {
pub gpr: [u64; 30], // x0..x29
pub lr: u64, // x30
pub elr_el1: u64, // dönüş PC
pub spsr_el1: u64, // dönüş PSTATE
}
const _: () = assert!(
core::mem::size_of::<ExceptionContext>() == 264,
"exceptions.S expects the integer exception context to occupy 264 bytes",
);
/// ESR_EL1.EC alanını (bits 31:26) decode et.
fn decode_ec(esr: u64) -> &'static str {
match (esr >> 26) & 0x3f {
0x00 => "Unknown reason",
0x01 => "Trapped WFI/WFE",
0x07 => "SIMD/FP access trapped",
0x0e => "Illegal Execution state",
0x15 => "SVC (AArch64)",
0x18 => "MSR/MRS/system trap",
0x20 => "Instruction Abort, lower EL",
0x21 => "Instruction Abort, same EL",
0x22 => "PC alignment fault",
0x24 => "Data Abort, lower EL",
0x25 => "Data Abort, same EL",
0x26 => "SP alignment fault",
0x2c => "FP trapped exception (AArch64)",
0x2f => "SError",
0x30 => "Breakpoint (lower EL)",
0x31 => "Breakpoint (same EL)",
0x32 => "Software Step (lower EL)",
0x33 => "Software Step (same EL)",
0x34 => "Watchpoint (lower EL)",
0x35 => "Watchpoint (same EL)",
0x3c => "BRK instruction (AArch64)",
_ => "<bilinmeyen EC>",
}
}snippet sha256: 8dc4242a2af7…file sha256: 6f3a4c8dbf40…
02 · Doğrulayan test kodu
Operations komutuna bağlı focused test
tam Rust öğesiL164–L179
simulation/tests/ipc_recv_deadline_runtime.rs::qemu_fixture_requires_timeout_stale_waiter_rejection_fresh_delivery_and_reclaim
#[test]
fn qemu_fixture_requires_timeout_stale_waiter_rejection_fresh_delivery_and_reclaim() {
assert!(MAIN.contains("run_qemu_s145_ipc_recv_deadline("));
assert!(MAIN.contains("ABI=SYS_IPC_RECV_TIMEOUT X6_RELATIVE_TICKS=3"));
assert!(MAIN.contains("STALE_WAITER_ABSENT=YES FRESH_RECV_DELIVERED=YES"));
assert!(MAIN.contains("WAIT_EPOCH=2 REGISTERED=2 TIMED_OUT=1 DELIVERED=1"));
assert!(MAIN.contains("RECLAIM=10 OWNER_EP_CLEANUP=1"));
assert!(QEMU_SMOKE.contains("s145_timeout_count=$(grep -aFc '[K2-S145-DEADLINE]'"));
assert!(QEMU_SMOKE.contains("STRICT EL0 RECV RETURN=TIMED_OUT"));
assert!(QEMU_SMOKE.contains("STRICT EL0 LATE CALL=FRESH_RECV"));
assert!(QEMU_SMOKE.contains("STRICT EL0 LATE CALL REPLY=OK"));
assert!(QEMU_SMOKE.contains("strict ELF W^X 26/26"));
assert!(QEMU_SMOKE.contains("IPC reply 20/20"));
}snippet sha256: d49b15f8d2cf…file sha256: 9acb7db98735…
03 · Kapı kimlik kaydı
Operations sıra, kimlik ve başlık bağı
tam Operations kaydıL24620–L24736
website/src/lib/operations.ts::k2-ipc-recv-deadline-stale-waiter-partial
{
id: "k2-ipc-recv-deadline-stale-waiter-partial",
date: "2026-08-24",
sequence: 145,
status: "passed",
umbrella_status: "partial",
title: "K2: IPC RECV deadline, stale-waiter temizliği ve fresh delivery",
summary:
"S145, legacy SYS_IPC_RECV davranışını değiştirmeden opt-in SYS_IPC_RECV_TIMEOUT=16 ABI'sini ekler. x6 relative tick değeri shared allocation-free capacity-32 registry'de exact receiver task/wait epoch/endpoint generation authority'sine bağlanır. Deadline, waiter publication'dan önce arm edilir; queued immediate delivery deadline kaydı açmadan çalışır. Generic timer IRQ exact expired receiver'ı bir kez TimedOut ile uyandırıp stale waiter'ı endpoint kuyruğundan kaldırır. Aynı receiver'ın ikinci fresh wait'i daha sonra gelen ordinary CALL'u alır ve ordinary REPLY ile tamamlar. Notification deadline ve Generic SMP cross-CPU arbitration açık; K2 PARTIAL kalır.",
evidence: [
"Fail-closed bring-up: missing receive-deadline yüzeyi 0/10 RED → QEMU fixture öncesi 9/10 → final S145 source/policy 10/10 PASS.",
"ABI major/minor=1/2; SYS_IPC_RECV_TIMEOUT=16, x6=relative ticks ve TimedOut=4. Legacy SYS_IPC_RECV ve S144 SYS_IPC_CALL_TIMEOUT=15 davranışları korunur.",
"S129–S145 exact envanteri 34 binary / 196 testtir; 196/196 PASS. Ortak ABI/IPC odaklı kapı 58/58 PASS.",
"CALL ve RECV aynı global wait epoch ve allocation-free capacity=32 registry'yi paylaşır. Timed receive arm-before-waiter publication; immediate queued delivery IMMEDIATE_DELIVERY_DEADLINE=UNARMED kuralındadır.",
"AArch64 board-qemu, board-rpi4, board-rpi5 ve board-rpi5+smp applicability 4/4 PASS.",
"QEMU endpoint=49, receiver/caller=53/54, domains=1330597189/1330597190. İlk receive now/deadline/timeout tick=101/104/104; ikinci fresh receive x6=1000 ile late ordinary CALL'dan önce yayımlandı.",
"WAIT_EPOCH=2, REGISTERED=2, TIMED_OUT=1, DELIVERED=1, REPLIED=0, PEER_CLOSED=0, CANCELLED=0; TIMEOUT_AT_DEADLINE=YES ve EXACT_ONCE=YES.",
"İlk strict EL0 dönüşü TimedOut ve x1..x7=0'dır. STALE_WAITER_ABSENT=YES; fresh ikinci RECV late CALL'u aldı, ordinary reply LATE_CALL_REPLY=OK oldu. Synthetic timeout/delivery hook yoktur.",
"Reclaim=10, free 6139→6129→6139, active 5→15→5, OWNER_EP_CLEANUP=1, KERNEL_FAULTS=0 ve EXECUTOR=PASS.",
"QEMU strict ELF W^X 24/24, başarılı IPC reply 20/20, final RuntimePmm 6144→6144 / active 0→0 ve scheduler SEC5 birlikte PASS.",
"Manuel 8 saniyelik QEMU log'u 462859 B / SHA-256 7f7fe40cf0e5430d68e9fd1fad3f0d9b197811bf6fe5c05aa172bf0e85271d8f olarak ölçüldü.",
"Tam workspace yalnız bağımsız frozen S96 exceptions.S SHA-256 uyuşmazlığında durdu: observed f7b47672…04fd, expected c0eed3e2…cb89; full GREEN iddia edilmedi.",
"Fiziksel operatör sırası görünürdür: Gücü kapat → SD kartı Pi'den çıkar → SD kartı Mac'e tak → yetkili write/verify/read-back işlemini tamamla → SD kartı Mac'ten güvenli çıkar → SD kartı güçsüz Pi'ye tak → UART capture pre-arm ve exact identity kapısını doğrula → Güç ver.",
"Bu fiziksel sıra S145'te uygulanmadı: physical/device operations=0, S124 archive/promotion STOP, son fiziksel boot/runtime PASS S92 BOOT8G ve son storage/media PASS S119.",
"Güncel planlama tahmini S145 bazında R2 bitiş aralığı S329–385, risk-paylı merkez ≈S362'dir; taahhüt veya fiziksel PASS değildir.",
"Yerel web kapıları: içerik 241/241, ESLint, TypeScript --noEmit ve Next.js static export 23/23 route / 191 file PASS.",
"Kalıcı kapsam: `docs/K2-S145-IPC-Recv-Deadline-Stale-Waiter-Proof.md`.",
],
commands: [
"cargo test -p aselsan_microkernel_simulation --test ipc_recv_deadline_runtime -- --test-threads=1",
"cargo test -p aselsan_microkernel_simulation [34 exact focused test binary] -- --test-threads=1",
"cargo check -p aselsan_kernel --target aarch64-unknown-none [board-qemu, board-rpi4, board-rpi5, board-rpi5+smp]",
"make verify-qemu",
"cargo test --workspace -- --test-threads=1",
"python3 scripts/render-project-status.py --check",
"cd website && npm test && npm run lint && npx tsc --noEmit && npm run build",
],
terminalSessions: [
{
id: "s145-red-before-recv-deadline-runtime",
title: "RECV deadline authority kaynak kapısı: fail-closed bring-up",
commandLines: [
"cargo test -p aselsan_microkernel_simulation --test ipc_recv_deadline_runtime -- --test-threads=1",
],
outputLines: [
"missing receive deadline modules/methods: 0/10 RED",
"runtime integration, QEMU fixture öncesi: 9/10",
"no partial PASS accepted",
],
exitCode: 101,
outputMode: "selected",
},
{
id: "s145-green-focused-aarch64-qemu",
title: "Exact timeout, stale-waiter temizliği, fresh delivery ve QEMU",
commandLines: [
"cargo test -p aselsan_microkernel_simulation [34 exact focused test binary] -- --test-threads=1",
"cargo check -p aselsan_kernel --target aarch64-unknown-none [4 profiles]",
"make verify-qemu",
],
outputLines: [
"ipc_recv_deadline_runtime: 10/10 PASS",
"combined exact focused inventory: 196/196 PASS · 34 binaries",
"focused ABI/IPC: 58/58 PASS · AArch64 compile profiles: 4/4 PASS",
"[K2-S145-DEADLINE] tick=104 receiver=53 endpoint=49 TIMEOUT=EXACT WAKE=TIMED_OUT STALE_WAITER_REMOVED=YES",
"[K2-S145] STRICT EL0 RECV RETURN=TIMED_OUT",
"[K2-S145] STRICT EL0 LATE CALL=FRESH_RECV",
"[K2-S145] STRICT EL0 LATE CALL REPLY=OK",
"[K2-S145] WAIT_EPOCH=2 REGISTERED=2 TIMED_OUT=1 DELIVERED=1 STALE_WAITER_ABSENT=YES FRESH_RECV_DELIVERED=YES EXACT_ONCE=YES RECLAIM=10 free=6139->6129->6139 active=5->15->5 KERNEL_FAULTS=0 EXECUTOR=PASS",
"QEMU smoke PASS: strict ELF W^X 24/24 · IPC reply 20/20 · S145 PASS",
],
exitCode: 0,
outputMode: "selected",
},
{
id: "s145-workspace-independent-history-red",
title: "Tam workspace: S145 dışı frozen S96 identity kırmızısı",
commandLines: ["cargo test --workspace -- --test-threads=1"],
outputLines: [
"rpi5_g8h_integration_source::wiring_does_not_mutate_timer_gic_boot_or_expand_runtime_scope: FAILED",
"S96 exceptions.S SHA-256: observed f7b47672...04fd, frozen expected c0eed3e2...cb89",
"full-workspace GREEN is not claimed",
],
exitCode: 101,
outputMode: "selected",
},
{
id: "s145-local-web-gates",
title: "İşlemler, Timeline, tahmin ve fiziksel runbook web kapıları",
commandLines: [
"cd website && npm test",
"cd website && npm run lint",
"cd website && npx tsc --noEmit",
"cd website && npm run build",
],
outputLines: [
"web content tests: 241/241 PASS",
"ESLint: PASS · TypeScript --noEmit: PASS",
"Next.js static export: 23/23 routes · 191 files PASS",
"S145 RECV timeout, S329–385 / ≈S362 forecast and exact physical operator verbs are mandatory",
"physical/device operations=0 · S124 archive/promotion STOP",
],
exitCode: 0,
outputMode: "selected",
},
],
terminalSessionsNote:
"S145 opt-in RECV timeout dilimini kapatır. Notification deadline ve Generic SMP cross-CPU timer/wake/delivery yarışı açık olduğundan K2 COMPLETE değildir. Fiziksel runbook açıkça görünür, fakat uygulanmadı.",
limitations: [
"Notification deadline syscall'ı runtime'a henüz bağlı değildir.",
"Allocation-free deadline tablosu shared capacity=32 ve timer tick başına en fazla bir expired IPC wait işler; ürün latency/capacity bütçesi imzalı değildir.",
"Forced receiver teardown, post-admission RECV revoke ve Generic SMP cross-CPU timeout/wake/delivery yarış matrisi tam kapanmadı.",
"Generic SMP current-task stop/migration, cross-CPU wake/TLB/reaper, capability transferi, shared-memory loan ve bütün legacy/kernel kaynaklarının ortak reconciliation'ı açıktır.",
"Full workspace bağımsız frozen S96 identity kırmızısı nedeniyle GREEN değildir.",
"S124 fiziksel archive/promotion STOP; görüntülenen güç/SD/Mac/UART sırası S145'te yürütülmedi.",
],
},snippet sha256: cb5df1e67e65…file sha256: 9726dbf00f84…
Focused test komutu
cargo test -p aselsan_microkernel_simulation --test ipc_recv_deadline_runtime -- --test-threads=1proof: docs/K2-S145-IPC-Recv-Deadline-Stale-Waiter-Proof.md
Registry schema v5 · generator
website/scripts/generate-code-gates.mjs · Tam SHA-256: 3050638b71a684d8f8f947a8a6faa237a17fa8db5dc0db04fb207b668b462af9