starkernel: item 4.1a -- quota granting, Hermes's one-time birth grant
Punch list §25 item 4.1a complete. New prerequisite item, found while scoping 4.2: no quota-granting mechanism existed at all. Adds stadium_grant_quota(new_vm_id, from_vm_id) -- a one-time initial grant at birth, distinct from item 1.3's still-unbuilt recurring capacity-transfer arbitration. Splits the donor's free list evenly by cell count, reassigns stadium_owner[] for every moved cell, and grants the new VM a fresh Q48_ONE reservoir (not a split of the donor's -- per-VM conservation, same pattern as Hera's own boot grant). Wired into every baby VM's birth in capsule_birth.c. Verified via a boot-time self-test in kernel_main.c using a synthetic identity (not the real UUID pool, not a real capsule birth -- item 0.1's Hera-alone pruning stays intact). All three architectures booted to ok> with identical output: grant OK, Hera reservoir=0 (already fully committed to resident words, correctly unchanged), test-vm reservoir=65536 (fresh Q48_ONE). dict_hash identical across all three and unchanged from item 4.1's baseline (0x3d4e1daf289da94f) -- confirms no dictionary word was added. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
edfc246579
commit
2981ada2a5
@@ -3300,7 +3300,7 @@ document and committing that amendment as its own item.*
|
||||
> parity output — untouched, as designed. Stadium diagnostics also identical across all
|
||||
> three: `promotions=354 evictions=0`, `resident_sum=65536 reservoir=0 sum=65536
|
||||
> (Q48_ONE=65536)` — the conservation invariant closes exactly.
|
||||
- [ ] **4.1a — Quota granting: Hermes's birth grant.** New prerequisite item, inserted
|
||||
- [x] **4.1a — Quota granting: Hermes's birth grant.** New prerequisite item, inserted
|
||||
2026-08-05 while scoping 4.2 — found that no quota-granting mechanism exists at all.
|
||||
`quota_slot_for_vm()` refuses every `vm_id != 0` today, permanently, by design (item 3.5's
|
||||
note); `stadium_admit()`'s own doc and item 3.2's DONE note both defer per-VM free lists to
|
||||
@@ -3323,23 +3323,30 @@ document and committing that amendment as its own item.*
|
||||
> even split needs no threshold, consistent with §22's "no tuned threshold" elsewhere in
|
||||
> this design.
|
||||
>
|
||||
> *Done when:*
|
||||
> - A new `stadium_grant_quota(VMUuid vm_id)` (or equivalent, named at implementation
|
||||
> time) exists in `stadium.c`, callable at a baby VM's birth (`capsule_birth.c`).
|
||||
> - Splits Hera's free list evenly by cell count (±1 for odd counts), reassigns
|
||||
> `stadium_owner[idx]` for every cell that moves, and grants the new VM a fresh
|
||||
> `Q48_ONE` reservoir — verified by both VMs' independent conservation checks closing
|
||||
> exactly immediately after the grant, with zero residents on either side yet.
|
||||
> - Hera's own residents (including cell 0) are provably untouched — same cell count and
|
||||
> identities before and after the grant.
|
||||
> - Refuses (does not crash) if `vm_id` already holds a quota, or if the granting VM's
|
||||
> free list is empty.
|
||||
> - All three architectures boot to `ok>` with logs under `logs/`, `dict_hash` unchanged
|
||||
> from item 4.1's baseline (`0x3d4e1daf289da94f`) since this item touches no dictionary
|
||||
> word.
|
||||
> *Done, verified 2026-08-05.* `stadium_grant_quota(VMUuid new_vm_id, VMUuid from_vm_id)`
|
||||
> (`stadium.c`/`stadium.h`) exists as designed: counts `from_vm_id`'s free list, splits the
|
||||
> first half (by list-walk order) into a new quota slot for `new_vm_id` with `stadium_owner`
|
||||
> reassigned per moved cell, terminates both lists correctly, and grants a fresh `Q48_ONE`
|
||||
> reservoir. Refuses without crashing if `new_vm_id` already holds a quota, `from_vm_id`
|
||||
> holds none, the free list has fewer than 2 cells, or no empty quota slot remains. Wired
|
||||
> into every baby VM's birth (`capsule_birth.c`, right after `stadium_vm_id` is set, before
|
||||
> IDENTITY exec) — failure is non-fatal to birth itself, same as having no quota is today's
|
||||
> status quo for every VM.
|
||||
>
|
||||
> *Verified* via a boot-time self-test (`kernel_main.c`, right after item 4.1's diagnostic
|
||||
> print) using a synthetic identity — deliberately not `vm_uuid_next()`'s real birth pool
|
||||
> (would perturb the deterministic ID stream) and not a real capsule birth (item 0.1 pruned
|
||||
> automatic Hermes birth from `init.4th`; restoring that is item 4.2's job, not this one's).
|
||||
> All three architectures booted to `ok>` with logs under `logs/20260805-145714/amd64/`,
|
||||
> `logs/20260805-145806/aarch64/`, `logs/20260805-145902/riscv64/`, each printing identically:
|
||||
> `Stadium quota grant self-test: OK`, `Hera reservoir=0` (already fully committed to
|
||||
> resident words by item 4.1's own self-test, unchanged by this grant — correct, since this
|
||||
> item never touches reservoir on the donor side), `test-vm reservoir=65536` (a fresh
|
||||
> `Q48_ONE`, as ruled). `dict_hash` identical across all three and unchanged from item 4.1's
|
||||
> baseline (`0x3d4e1daf289da94f`), confirming this item added no dictionary word.
|
||||
- [ ] **4.2 — Hermes native on the Stadium.** The proving ground; produces the effort
|
||||
number. *Refs:* §10. **Blocked on 4.1a** — Hermes cannot hold Stadium residents without a
|
||||
quota, and nothing grants one yet.
|
||||
number. *Refs:* §10. **Unblocked 2026-08-05** — item 4.1a closed; `stadium_grant_quota()`
|
||||
exists and is wired into every baby VM's birth.
|
||||
|
||||
> **Two rulings taken before work starts, 2026-08-05:**
|
||||
> 1. **`stadium_owner[idx]` fix folded into this item's scope**, by explicit Captain Bob
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
tick_number,elapsed_ns,tick_interval_ns,cache_hits_delta,bucket_hits_delta,word_executions_delta,hot_word_count,avg_word_heat_q48,window_width,actual_window_size,predicted_label_hits,jitter_bits,apic_ticks,time_trust_q48,variance_q48,vm_call_depth_max,hera_heat_q48,hermes_heat_q48,artemis_heat_q48
|
||||
1,10000,10000,0,0,183,4,45,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
2,20000,10000,0,0,173,5,44,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
3,30000,10000,0,0,184,6,60,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
4,40000,10000,0,0,174,8,71,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
5,50000,10000,0,0,150,9,78,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
6,60000,10000,0,0,159,11,73,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
7,70000,10000,0,0,188,15,71,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
8,80000,10000,0,0,214,16,83,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
9,90000,10000,0,0,216,19,82,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
10,100000,10000,0,0,222,21,84,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
11,110000,10000,0,0,207,23,86,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
12,120000,10000,0,0,189,26,83,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
13,130000,10000,0,0,221,28,80,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
14,140000,10000,0,0,204,29,83,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
15,150000,10000,0,0,203,30,82,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
16,160000,10000,0,0,201,32,83,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
17,170000,10000,0,0,190,34,86,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
18,180000,10000,0,0,170,35,73,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
19,190000,10000,0,0,154,28,44,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
20,200000,10000,0,0,154,28,41,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
21,210000,10000,0,0,153,32,39,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
22,220000,10000,0,0,167,35,42,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
23,230000,10000,0,0,176,37,41,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
24,240000,10000,0,0,175,37,39,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
25,250000,10000,0,0,196,38,37,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
26,260000,10000,0,0,192,41,37,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
27,270000,10000,0,0,158,40,38,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
28,280000,10000,0,0,158,40,35,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
29,290000,10000,0,0,164,41,37,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
30,300000,10000,0,0,154,43,39,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
31,310000,10000,0,0,172,46,35,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
32,320000,10000,0,0,180,49,34,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
33,330000,10000,0,0,145,51,35,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
34,340000,10000,0,0,203,53,37,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
35,350000,10000,0,0,154,55,39,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
36,360000,10000,0,0,144,57,37,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
37,370000,10000,0,0,144,57,35,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
38,380000,10000,0,0,132,57,34,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
39,390000,10000,0,0,180,57,32,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
40,400000,10000,0,0,220,63,29,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
41,410000,10000,0,0,215,64,28,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
42,420000,10000,0,0,208,68,29,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
43,430000,10000,0,0,177,72,27,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
44,440000,10000,0,0,199,77,28,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
45,450000,10000,0,0,223,82,26,4096,30,0,0,0,65536,0,0,65536,0,0
|
||||
46,460000,10000,0,0,202,85,24,4096,67,0,0,0,65536,0,0,65536,0,0
|
||||
47,470000,10000,0,0,218,91,25,4096,198,0,0,0,65536,0,0,65536,0,0
|
||||
48,480000,10000,0,0,221,92,26,4096,350,0,0,0,65536,0,0,65536,0,0
|
||||
49,490000,10000,0,0,225,97,26,4096,528,0,0,0,65536,0,0,65536,0,0
|
||||
50,500000,10000,0,0,214,100,27,4096,694,0,0,0,65536,0,0,65536,0,0
|
||||
51,510000,10000,0,0,227,102,28,4096,883,0,0,0,65536,0,0,65536,0,0
|
||||
52,520000,10000,0,0,208,102,29,4096,1043,0,0,0,65536,0,0,65536,0,0
|
||||
53,530000,10000,0,0,207,102,30,4096,1202,0,0,0,65536,0,0,65536,0,0
|
||||
54,540000,10000,0,0,200,102,31,4096,1319,0,0,0,65536,0,0,65536,0,0
|
||||
55,550000,10000,0,0,205,103,32,4096,1464,0,0,0,65536,0,0,65536,0,0
|
||||
56,560000,10000,0,0,211,103,32,4096,1620,0,0,0,65536,0,0,65536,0,0
|
||||
57,570000,10000,0,0,193,110,33,4096,1712,0,0,0,65536,0,0,65536,0,0
|
||||
58,580000,10000,0,0,190,5,67,4096,1775,0,0,0,65536,0,0,65536,0,0
|
||||
|
@@ -0,0 +1,59 @@
|
||||
tick_number,elapsed_ns,tick_interval_ns,cache_hits_delta,bucket_hits_delta,word_executions_delta,hot_word_count,avg_word_heat_q48,window_width,actual_window_size,predicted_label_hits,jitter_bits,apic_ticks,time_trust_q48,variance_q48,vm_call_depth_max,hera_heat_q48,hermes_heat_q48,artemis_heat_q48
|
||||
1,10000,10000,0,0,183,4,45,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
2,20000,10000,0,0,173,5,44,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
3,30000,10000,0,0,184,6,60,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
4,40000,10000,0,0,174,8,71,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
5,50000,10000,0,0,150,9,78,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
6,60000,10000,0,0,159,11,73,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
7,70000,10000,0,0,188,15,71,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
8,80000,10000,0,0,214,16,83,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
9,90000,10000,0,0,216,19,82,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
10,100000,10000,0,0,222,21,84,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
11,110000,10000,0,0,207,23,86,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
12,120000,10000,0,0,189,26,83,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
13,130000,10000,0,0,221,28,80,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
14,140000,10000,0,0,204,29,83,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
15,150000,10000,0,0,203,30,82,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
16,160000,10000,0,0,201,32,83,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
17,170000,10000,0,0,190,34,86,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
18,180000,10000,0,0,170,35,73,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
19,190000,10000,0,0,154,28,44,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
20,200000,10000,0,0,154,28,41,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
21,210000,10000,0,0,153,32,39,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
22,220000,10000,0,0,167,35,42,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
23,230000,10000,0,0,176,37,41,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
24,240000,10000,0,0,175,37,39,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
25,250000,10000,0,0,196,38,37,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
26,260000,10000,0,0,192,41,37,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
27,270000,10000,0,0,158,40,38,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
28,280000,10000,0,0,158,40,35,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
29,290000,10000,0,0,164,41,37,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
30,300000,10000,0,0,154,43,39,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
31,310000,10000,0,0,172,46,35,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
32,320000,10000,0,0,180,49,34,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
33,330000,10000,0,0,145,51,35,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
34,340000,10000,0,0,203,53,37,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
35,350000,10000,0,0,154,55,39,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
36,360000,10000,0,0,144,57,37,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
37,370000,10000,0,0,144,57,35,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
38,380000,10000,0,0,132,57,34,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
39,390000,10000,0,0,180,57,32,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
40,400000,10000,0,0,220,63,29,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
41,410000,10000,0,0,215,64,28,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
42,420000,10000,0,0,208,68,29,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
43,430000,10000,0,0,177,72,27,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
44,440000,10000,0,0,199,77,28,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
45,450000,10000,0,0,223,82,26,4096,30,0,0,0,65536,0,0,65536,0,0
|
||||
46,460000,10000,0,0,202,85,24,4096,67,0,0,0,65536,0,0,65536,0,0
|
||||
47,470000,10000,0,0,218,91,25,4096,198,0,0,0,65536,0,0,65536,0,0
|
||||
48,480000,10000,0,0,221,92,26,4096,350,0,0,0,65536,0,0,65536,0,0
|
||||
49,490000,10000,0,0,225,97,26,4096,528,0,0,0,65536,0,0,65536,0,0
|
||||
50,500000,10000,0,0,214,100,27,4096,694,0,0,0,65536,0,0,65536,0,0
|
||||
51,510000,10000,0,0,227,102,28,4096,883,0,0,0,65536,0,0,65536,0,0
|
||||
52,520000,10000,0,0,208,102,29,4096,1043,0,0,0,65536,0,0,65536,0,0
|
||||
53,530000,10000,0,0,207,102,30,4096,1202,0,0,0,65536,0,0,65536,0,0
|
||||
54,540000,10000,0,0,200,102,31,4096,1319,0,0,0,65536,0,0,65536,0,0
|
||||
55,550000,10000,0,0,205,103,32,4096,1464,0,0,0,65536,0,0,65536,0,0
|
||||
56,560000,10000,0,0,211,103,32,4096,1620,0,0,0,65536,0,0,65536,0,0
|
||||
57,570000,10000,0,0,193,110,33,4096,1712,0,0,0,65536,0,0,65536,0,0
|
||||
58,580000,10000,0,0,190,5,67,4096,1775,0,0,0,65536,0,0,65536,0,0
|
||||
|
@@ -0,0 +1,59 @@
|
||||
tick_number,elapsed_ns,tick_interval_ns,cache_hits_delta,bucket_hits_delta,word_executions_delta,hot_word_count,avg_word_heat_q48,window_width,actual_window_size,predicted_label_hits,jitter_bits,apic_ticks,time_trust_q48,variance_q48,vm_call_depth_max,hera_heat_q48,hermes_heat_q48,artemis_heat_q48
|
||||
1,10000,10000,0,0,183,4,45,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
2,20000,10000,0,0,173,5,44,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
3,30000,10000,0,0,184,6,60,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
4,40000,10000,0,0,174,8,71,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
5,50000,10000,0,0,150,9,78,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
6,60000,10000,0,0,159,11,73,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
7,70000,10000,0,0,188,15,71,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
8,80000,10000,0,0,214,16,83,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
9,90000,10000,0,0,216,19,82,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
10,100000,10000,0,0,222,21,84,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
11,110000,10000,0,0,207,23,86,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
12,120000,10000,0,0,189,26,83,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
13,130000,10000,0,0,221,28,80,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
14,140000,10000,0,0,204,29,83,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
15,150000,10000,0,0,203,30,82,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
16,160000,10000,0,0,201,32,83,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
17,170000,10000,0,0,190,34,86,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
18,180000,10000,0,0,170,35,73,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
19,190000,10000,0,0,154,28,44,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
20,200000,10000,0,0,154,28,41,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
21,210000,10000,0,0,153,32,39,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
22,220000,10000,0,0,167,35,42,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
23,230000,10000,0,0,176,37,41,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
24,240000,10000,0,0,175,37,39,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
25,250000,10000,0,0,196,38,37,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
26,260000,10000,0,0,192,41,37,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
27,270000,10000,0,0,158,40,38,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
28,280000,10000,0,0,158,40,35,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
29,290000,10000,0,0,164,41,37,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
30,300000,10000,0,0,154,43,39,685,685,0,0,0,65536,0,0,65536,0,0
|
||||
31,310000,10000,0,0,172,46,35,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
32,320000,10000,0,0,180,49,34,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
33,330000,10000,0,0,145,51,35,567,567,0,0,0,65536,0,0,65536,0,0
|
||||
34,340000,10000,0,0,203,53,37,582,582,0,0,0,65536,0,0,65536,0,0
|
||||
35,350000,10000,0,0,154,55,39,731,731,0,0,0,65536,0,0,65536,0,0
|
||||
36,360000,10000,0,0,144,57,37,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
37,370000,10000,0,0,144,57,35,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
38,380000,10000,0,0,132,57,34,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
39,390000,10000,0,0,180,57,32,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
40,400000,10000,0,0,220,63,29,4096,0,0,0,0,65536,0,0,65536,0,0
|
||||
41,410000,10000,0,0,215,64,28,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
42,420000,10000,0,0,208,68,29,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
43,430000,10000,0,0,177,72,27,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
44,440000,10000,0,0,199,77,28,4096,24,0,0,0,65536,0,0,65536,0,0
|
||||
45,450000,10000,0,0,223,82,26,4096,30,0,0,0,65536,0,0,65536,0,0
|
||||
46,460000,10000,0,0,202,85,24,4096,67,0,0,0,65536,0,0,65536,0,0
|
||||
47,470000,10000,0,0,218,91,25,4096,198,0,0,0,65536,0,0,65536,0,0
|
||||
48,480000,10000,0,0,221,92,26,4096,350,0,0,0,65536,0,0,65536,0,0
|
||||
49,490000,10000,0,0,225,97,26,4096,528,0,0,0,65536,0,0,65536,0,0
|
||||
50,500000,10000,0,0,214,100,27,4096,694,0,0,0,65536,0,0,65536,0,0
|
||||
51,510000,10000,0,0,227,102,28,4096,883,0,0,0,65536,0,0,65536,0,0
|
||||
52,520000,10000,0,0,208,102,29,4096,1043,0,0,0,65536,0,0,65536,0,0
|
||||
53,530000,10000,0,0,207,102,30,4096,1202,0,0,0,65536,0,0,65536,0,0
|
||||
54,540000,10000,0,0,200,102,31,4096,1319,0,0,0,65536,0,0,65536,0,0
|
||||
55,550000,10000,0,0,205,103,32,4096,1464,0,0,0,65536,0,0,65536,0,0
|
||||
56,560000,10000,0,0,211,103,32,4096,1620,0,0,0,65536,0,0,65536,0,0
|
||||
57,570000,10000,0,0,193,110,33,4096,1712,0,0,0,65536,0,0,65536,0,0
|
||||
58,580000,10000,0,0,190,5,67,4096,1775,0,0,0,65536,0,0,65536,0,0
|
||||
|
@@ -401,6 +401,35 @@ int stadium_evict(size_t cell_index);
|
||||
*/
|
||||
size_t stadium_admit(VMUuid vm_id, const StadiumPatronHeader *candidate);
|
||||
|
||||
/*
|
||||
* stadium_grant_quota - One-time initial quota grant for a newly born VM
|
||||
* (FABRIC.md item 4.1a). NOT item 1.3's recurring capacity-transfer
|
||||
* arbitration -- that mechanism (density-gradient-driven, per capacity-tick)
|
||||
* stays unbuilt and its "how much moves" question stays open. This is the
|
||||
* narrower, one-time event: the same shape as Hera's own whole-pool grant at
|
||||
* stadium_boot_init(), just from an existing VM's free list instead of the
|
||||
* boot-time global one.
|
||||
*
|
||||
* Splits from_vm_id's free list evenly by cell count (new VM gets the first
|
||||
* half by list-walk order; from_vm_id keeps the remainder, including any odd
|
||||
* cell). Reassigns stadium_owner[] for every cell that moves. Touches no
|
||||
* resident cell on either side -- only free-list cells move, so from_vm_id's
|
||||
* residents (including a pinned cell 0, if from_vm_id is Hera) are
|
||||
* unaffected. Grants new_vm_id a fresh Q48_ONE reservoir -- NOT a fraction of
|
||||
* from_vm_id's, since conservation is per-VM (see StadiumVMQuota.reservoir's
|
||||
* doc in stadium.c), not a shared pool split across VMs.
|
||||
*
|
||||
* REFUSES (returns -1, does not crash) if: the Stadium is not initialized;
|
||||
* new_vm_id already holds a quota; from_vm_id holds no quota; from_vm_id's
|
||||
* free list has fewer than 2 cells (nothing to split); or no empty quota
|
||||
* slot remains (STADIUM_MAX_VM_COUNT exhausted).
|
||||
*
|
||||
* @param new_vm_id The VM receiving a fresh quota. Must not already have one.
|
||||
* @param from_vm_id The VM whose free list is split. Must already hold a quota.
|
||||
* @return 0 on success, -1 if refused.
|
||||
*/
|
||||
int stadium_grant_quota(VMUuid new_vm_id, VMUuid from_vm_id);
|
||||
|
||||
#endif /* __STARKERNEL__ */
|
||||
|
||||
#endif /* STARKERNEL_VM_STADIUM_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -31,6 +31,7 @@
|
||||
#include "starkernel/capsule_run.h"
|
||||
#include "starkernel/kmalloc.h"
|
||||
#include "starkernel/console.h"
|
||||
#include "starkernel/vm/stadium.h" /* item 4.1a -- stadium_grant_quota() */
|
||||
#include "vm.h"
|
||||
#include "platform_alloc.h"
|
||||
#include "starforth_config.h" /* STADIUM_MAX_VM_COUNT */
|
||||
@@ -502,6 +503,15 @@ CapsuleRunResult capsule_birth_baby(
|
||||
|
||||
capsule_parity_log_birth(vm_id, cap->capsule_id, cap->content_hash, dict_hash);
|
||||
|
||||
/* item 4.1a: one-time initial quota grant, from Hera's free list. Placed
|
||||
* after a live birth is confirmed (not gating IDENTITY exec above) --
|
||||
* this baby can hold no Stadium resident until item 4.2's own work gives
|
||||
* her a reason to. Failure is not fatal: a VM with no quota today is the
|
||||
* status quo every VM had before this item existed, so she is simply
|
||||
* born without one and every stadium_word_dispatch() for her stays a
|
||||
* harmless refusal, same as any VM without a quota. */
|
||||
(void)stadium_grant_quota(vm_id, vm_uuid_hera());
|
||||
|
||||
if (out_vm_id) *out_vm_id = vm_id;
|
||||
if (out_vm_ctx) *out_vm_ctx = new_vm;
|
||||
|
||||
|
||||
@@ -628,6 +628,26 @@ static void kernel_main_deep(BootInfo *boot_info) {
|
||||
* capsule birth above, so this is non-vacuous by this point. */
|
||||
stadium_words_print_boot_diagnostics(vm_uuid_hera());
|
||||
|
||||
/* item 4.1a self-test: exercises stadium_grant_quota() with a synthetic
|
||||
* identity, NOT vm_uuid_next()'s real birth pool (would perturb the
|
||||
* deterministic ID stream real BIRTH calls draw from) and NOT a real
|
||||
* capsule birth (item 0.1 pruned automatic Hermes birth from init.4th;
|
||||
* restoring it is item 4.2's job, not this one's). Diagnostic only --
|
||||
* the synthetic VM is never used for anything else. */
|
||||
{
|
||||
VMUuid test_id;
|
||||
test_id.hi = 0;
|
||||
test_id.lo = 1; /* distinct from vm_uuid_hera() (all-zero) and
|
||||
* vm_uuid_none() (all-ones) */
|
||||
int grant_rc = stadium_grant_quota(test_id, vm_uuid_hera());
|
||||
console_puts("Stadium quota grant self-test: ");
|
||||
console_println(grant_rc == 0 ? "OK" : "REFUSED");
|
||||
if (grant_rc == 0) {
|
||||
print_uint(" Hera reservoir=", stadium_reservoir_peek(vm_uuid_hera()));
|
||||
print_uint(" test-vm reservoir=", stadium_reservoir_peek(test_id));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Runtime --doe flag: inject "EXEC-DOE BYE" if requested via boot args.
|
||||
* Checked before SK_STARTUP_FORTH so a runtime --doe takes precedence.
|
||||
|
||||
@@ -398,6 +398,61 @@ size_t stadium_admit(VMUuid vm_id, const StadiumPatronHeader *candidate) {
|
||||
return idx;
|
||||
}
|
||||
|
||||
/*
|
||||
* FABRIC.md item 4.1a: one-time initial quota grant, not item 1.3's
|
||||
* (still-unbuilt) recurring transfer. See stadium.h's doc for the full
|
||||
* argument. Two passes over from_vm_id's free list: the first counts it
|
||||
* (need the length before deciding where to split), the second detaches the
|
||||
* first `half` cells into new_vm_id's own list, reassigning owner as it goes.
|
||||
*/
|
||||
int stadium_grant_quota(VMUuid new_vm_id, VMUuid from_vm_id) {
|
||||
int from_slot, new_slot, i;
|
||||
size_t count, half, idx, last_new, new_head, remainder_head;
|
||||
|
||||
if (!stadium_initialized) return -1;
|
||||
if (quota_slot_for_vm(new_vm_id) >= 0) return -1;
|
||||
|
||||
from_slot = quota_slot_for_vm(from_vm_id);
|
||||
if (from_slot < 0) return -1;
|
||||
|
||||
new_slot = -1;
|
||||
for (i = 0; i < STADIUM_MAX_VM_COUNT; i++) {
|
||||
if (!stadium_quotas[i].in_use) { new_slot = i; break; }
|
||||
}
|
||||
if (new_slot < 0) return -1;
|
||||
|
||||
count = 0;
|
||||
idx = stadium_quotas[from_slot].free_head;
|
||||
while (idx != STADIUM_CELL_NONE) {
|
||||
count++;
|
||||
idx = link_to_size(stadium_cell_array[idx].header.link);
|
||||
}
|
||||
|
||||
half = count / 2;
|
||||
if (half == 0) return -1; /* fewer than 2 free cells -- nothing to split */
|
||||
|
||||
new_head = stadium_quotas[from_slot].free_head;
|
||||
idx = new_head;
|
||||
last_new = STADIUM_CELL_NONE;
|
||||
for (i = 0; i < (int)half; i++) {
|
||||
stadium_owner[idx] = (uint8_t)new_slot;
|
||||
last_new = idx;
|
||||
idx = link_to_size(stadium_cell_array[idx].header.link);
|
||||
}
|
||||
/* idx now points to the first cell staying with from_slot (or
|
||||
* STADIUM_CELL_NONE if half == count, i.e. an even list fully moved). */
|
||||
remainder_head = idx;
|
||||
stadium_cell_array[last_new].header.link = size_to_link(STADIUM_CELL_NONE);
|
||||
stadium_quotas[from_slot].free_head = remainder_head;
|
||||
|
||||
stadium_quotas[new_slot].vm_id = new_vm_id;
|
||||
stadium_quotas[new_slot].in_use = 1;
|
||||
stadium_quotas[new_slot].free_head = new_head;
|
||||
stadium_quotas[new_slot].reservoir = Q48_ONE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t stadium_reservoir_pull(VMUuid vm_id, uint64_t amount) {
|
||||
int slot = quota_slot_for_vm(vm_id);
|
||||
uint64_t pulled;
|
||||
|
||||
Reference in New Issue
Block a user