Dynamic switch table (B2) -- FABRIC-3.6.md task 3.1
Replaces the fixed SK_SWITCH_MAX_SLOTS=16 compile-time array with a boot-time, RAM-derived allocation via a new sk_vm_switch_signal_boot_init(), kmalloc'd to stadium_max_vm_count() entries -- the same pattern session_boot_init() already established for Stadium-derived sizing. Every switch-signal participant is a Stadium VM, so this reuses that bound directly rather than deriving a separate one. Verified live on all three architectures: switch table sized to 50 slots (amd64), 202 slots (aarch64), 50 slots (riscv64) -- all well past the old fixed cap. All three boot to [zuse@Hera] ok> cleanly; dict_hash for Hermes/Hestia identical across architectures, unmoved from pre-task values. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
66ea4a5e74
commit
c19ef365fe
@@ -49,6 +49,15 @@
|
||||
* participants (Hera/Hermes/Artemis) -- extending participation later
|
||||
* (Stage 4+) is another sk_vm_switch_signal_register() call, not a
|
||||
* redesign.
|
||||
*
|
||||
* FABRIC-3.6.md task 3.1 (2026-09-21, ruled B2 / FABRIC-3.5.md §XLV.2): the
|
||||
* slot table is no longer a fixed SK_SWITCH_MAX_SLOTS=16 compile-time array.
|
||||
* It is kmalloc'd at boot by sk_vm_switch_signal_boot_init(), sized from
|
||||
* stadium_max_vm_count() -- the same RAM-derived population bound Stadium
|
||||
* and session.c already use (session_boot_init() is the direct precedent
|
||||
* mirrored here). Every switch-signal participant is a Stadium VM, so
|
||||
* reusing that bound directly (rather than re-deriving a separate RAM
|
||||
* budget) needs no new sizing formula.
|
||||
*/
|
||||
|
||||
#ifndef STARKERNEL_CAPSULE_VM_SWITCH_SIGNAL_H
|
||||
@@ -59,17 +68,29 @@
|
||||
#include <stdint.h>
|
||||
#include "starkernel/vm_uuid.h"
|
||||
|
||||
/* Boot-time allocation (FABRIC-3.6.md task 3.1, 2026-09-21): kmalloc's the
|
||||
* slot table to stadium_max_vm_count() entries. Must run after
|
||||
* stadium_boot_init() (that bound is 0, and this fails, until Stadium has
|
||||
* computed it) and before the first sk_vm_switch_signal_register() call.
|
||||
* Soft failure -- returns -1 and leaves the table unallocated (capacity 0,
|
||||
* so register() below simply refuses every registration) rather than
|
||||
* halting boot, same posture as stadium_boot_init()/session_boot_init().
|
||||
* Idempotent-unsafe: calling twice leaks the first allocation, so callers
|
||||
* must call it exactly once. */
|
||||
int sk_vm_switch_signal_boot_init(void);
|
||||
|
||||
/* Register a VM as a switch-signal participant. Returns its slot index,
|
||||
* or -1 if the slot table is full. Call once per participating VM,
|
||||
* after that VM is fully born (never mid-birth -- this stage has no
|
||||
* critical-section protection against being switched away mid-setup). */
|
||||
* or -1 if the slot table is full (or sk_vm_switch_signal_boot_init() was
|
||||
* never called / failed). Call once per participating VM, after that VM is
|
||||
* fully born (never mid-birth -- this stage has no critical-section
|
||||
* protection against being switched away mid-setup). */
|
||||
int sk_vm_switch_signal_register(VMUuid vm_id);
|
||||
|
||||
/* Remove a switch-signal participant (FABRIC-3.md §XXVIII Stage 4,
|
||||
* 2026-09-14) -- Tripod VMs never need this (they live forever), but
|
||||
* WIREBIND-birthed identity VMs cycle through attach/detach repeatedly
|
||||
* and must free their slot for reuse, or the bounded table exhausts
|
||||
* after SK_SWITCH_MAX_SLOTS attach/detach cycles. Compacts the table
|
||||
* after sk_vm_switch_signal_slot_capacity() attach/detach cycles. Compacts the table
|
||||
* (small, bounded, mutated only at attach/detach -- not a hot path).
|
||||
* Clears a pending switch targeting this VM, if any, so the checkpoint
|
||||
* never attempts to switch into a no-longer-registered participant.
|
||||
@@ -115,6 +136,12 @@ int sk_vm_switch_signal_slot_count(void);
|
||||
uint32_t sk_vm_switch_signal_readiness(int slot); /* 0 if slot out of range */
|
||||
uint32_t sk_vm_switch_signal_readiness_of(VMUuid vm_id); /* 0 if not registered */
|
||||
|
||||
/* FABRIC-3.6.md task 3.1 (2026-09-21): the table's boot-time-computed
|
||||
* capacity (0 if sk_vm_switch_signal_boot_init() was never called or
|
||||
* failed) -- the dynamic replacement for the old compile-time
|
||||
* SK_SWITCH_MAX_SLOTS=16. */
|
||||
int sk_vm_switch_signal_slot_capacity(void);
|
||||
|
||||
#endif /* __STARKERNEL__ */
|
||||
|
||||
#endif /* STARKERNEL_CAPSULE_VM_SWITCH_SIGNAL_H */
|
||||
|
||||
Reference in New Issue
Block a user