§H.12 step 3: session_set_pinned/session_is_pinned pin-authority choke point
session_is_pinned() reads Session.pinned directly (authoritative, no Stadium re-derivation); session_set_pinned() writes both Session.pinned and the mirrored STADIUM_FLAG_PIN bit on the session's own patron cell, keeping Stadium's internal eviction/admission logic (which must stay self-contained) in sync without it calling back into session.c. Added Session.stadium_cell (index into stadium_cells()) -- necessary plumbing not in the original H.2 field list; the choke point can't reach the right patron header without it. Moved STADIUM_FLAG_PIN from a stadium.c-private #define to stadium.h (public) so session.c can reference it without a duplicate definition. Verified 3-arch boot to ok> (amd64/aarch64/riscv64). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
6d9fe3f515
commit
a621131ef6
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* session.c - Per-VM session bookkeeping (FABRIC-3.md §H.12 step 2)
|
||||
* session.c - Per-VM session bookkeeping (FABRIC-3.md §H.12 steps 2-3)
|
||||
*
|
||||
* Slot table sized from stadium_max_vm_count() at session_boot_init() time,
|
||||
* mirroring stadium.c's own StadiumVMQuota table (kmalloc'd to a
|
||||
@@ -31,6 +31,10 @@
|
||||
* settled). No callers yet; wiring into the boot sequence and into
|
||||
* stadium_birth_hera()/capsule_birth.c's admission path are later
|
||||
* §H.12 steps.
|
||||
*
|
||||
* session_set_pinned()/session_is_pinned() (step 3) are the pin-authority
|
||||
* choke point -- see their own doc comments in session.h for the
|
||||
* authoritative-session-mirrored-Stadium-bit split.
|
||||
*/
|
||||
|
||||
#ifdef __STARKERNEL__
|
||||
@@ -99,9 +103,10 @@ Session *session_register(VMUuid vm_id, VMUuid parent, const char *name)
|
||||
}
|
||||
if (!slot) return (Session *)0; /* table full */
|
||||
|
||||
slot->vm_id = vm_id;
|
||||
slot->parent = parent;
|
||||
slot->pinned = 0;
|
||||
slot->vm_id = vm_id;
|
||||
slot->parent = parent;
|
||||
slot->pinned = 0;
|
||||
slot->stadium_cell = SESSION_STADIUM_CELL_NONE;
|
||||
|
||||
{
|
||||
size_t j = 0;
|
||||
@@ -121,4 +126,32 @@ Session *session_register(VMUuid vm_id, VMUuid parent, const char *name)
|
||||
return slot;
|
||||
}
|
||||
|
||||
void session_set_pinned(VMUuid vm_id, int pinned)
|
||||
{
|
||||
Session *s = session_find(vm_id);
|
||||
StadiumCell *cells;
|
||||
|
||||
if (!s) return;
|
||||
s->pinned = pinned ? 1 : 0;
|
||||
|
||||
if (s->stadium_cell == SESSION_STADIUM_CELL_NONE) return;
|
||||
if (s->stadium_cell >= stadium_cell_count()) return;
|
||||
|
||||
cells = stadium_cells();
|
||||
if (!cells) return;
|
||||
|
||||
if (pinned) {
|
||||
cells[s->stadium_cell].header.flags |= STADIUM_FLAG_PIN;
|
||||
} else {
|
||||
cells[s->stadium_cell].header.flags &= (uint8_t)~STADIUM_FLAG_PIN;
|
||||
}
|
||||
}
|
||||
|
||||
int session_is_pinned(VMUuid vm_id)
|
||||
{
|
||||
Session *s = session_find(vm_id);
|
||||
if (!s) return 0;
|
||||
return s->pinned;
|
||||
}
|
||||
|
||||
#endif /* __STARKERNEL__ */
|
||||
|
||||
Reference in New Issue
Block a user