myxce/.kiro/specs/scheduler-sim-eager-reconciliation
Rongsong Shen 4f94638a1d
fix(scheduler): route sim reconciliation's on_dispatch() through the allocator thread (bug-1837)
sim_reconcile_unaccounted_jobs() (sim_loop.c) was calling
picker->picker_iface->on_dispatch() directly from the sim driver thread,
violating plugin.h's documented "allocator thread only" contract for
Post-allocation hooks. Dormant in practice only because builtin_fcfs.c
happens to lock internally around every hook -- a defensive measure the
contract text doesn't actually require of picker plugins.

Since scheduler-sim-live-allocation, sim mode spawns the same real
sched_job_picker()/sched_allocator() thread pair normal mode uses, so a
real allocator thread now exists to route through. Added a
reconcile_req/reconcile_ack cbuf pair on xce_sched_core_t and a reserved
XCE_SCHED_RECONCILE_WAKE sentinel pushed through jbuf to wake the
allocator thread without touching jbuf's pinned capacity-1/item-type
invariant (Req 5 AC 7). sched_allocator() services the request and calls
on_dispatch() itself; sim_reconcile_invoke_on_dispatch() blocks on the ack.
Falls back to a direct call when no allocator thread is live for a given
core (standalone unit tests), which is safe by construction.

TDD: new test spawns a stand-in allocator-relay thread and asserts
on_dispatch() fires there, not on the caller's thread -- confirmed RED
against the old direct-call code, GREEN after. Four other test files with
hand-rolled sched_allocator() stubs needed the same relay branch (found by
an actual hang at meson's timeout). Full scheduler suite: 85/85, zero
regressions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-21 12:58:57 +00:00
..
design.md fix(scheduler): route sim reconciliation's on_dispatch() through the allocator thread (bug-1837) 2026-09-21 12:58:57 +00:00
requirements.md fix(scheduler): sim mode force-dispatched recorded decisions past live capacity (bug-1836, bug-1838) 2026-09-21 09:50:27 +00:00
research.md fix(scheduler): sim resource over-commit, byte-unit display, sync job-state-at-capture 2026-09-12 14:06:41 +00:00
spec.json fix(scheduler): sim resource over-commit, byte-unit display, sync job-state-at-capture 2026-09-12 14:06:41 +00:00
tasks.md fix(scheduler): sim resource over-commit, byte-unit display, sync job-state-at-capture 2026-09-12 14:06:41 +00:00