fix(scheduler): apply a mid-replay CONFIG_PUSH to the sim limit plugin (bug-1964)

Cause: live applies every pushed config through sched_init_config(),
whose plugin_config_update() runs each plugin's config_hook (the limit
plugin builds its limits there). The simulator seeded the limit plugin
only at bootstrap (sim_bootstrap_limit_plugin()); the core's CONFIG_PUSH
event loaded groups, resources and queues but never told the plugins,
so a limit added during a replay never existed in sim.

Fix: one shared fan-out, plugin_config_update_core(core, config), which
live's plugin_config_update() now delegates to. The core's CONFIG_PUSH
calls a driver-registered xce_core_config_cb_t after loading groups (live
order), keeping the core free of plugin.c; the simulator registers the
fan-out in sim_bootstrap_limit_plugin(). limit_update_config() reads the
honestly-typed plugin->core instead of casting plugin->sched, so the hook
is safe on the sim core; the hand-built plugin fixtures in
test_limit_plugin.c/test_repl_limit_table.c now set plugin->core as
plugin_register() does. test_sim_limit_config_push_parity.c covers it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-10 10:28:35 +00:00
parent 2cd02cdc8c
commit 3224e90683
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
13 changed files with 452 additions and 7 deletions

View file

@ -89,6 +89,21 @@ typedef int (*xce_core_decision_cb_t)(void*, xce_decision_t*);
*/
typedef void (*xce_core_cache_clear_cb_t)(xce_sched_core_t*);
/*
* xce_core_config_cb_t - driver-registered plugin config hook (bug-1964):
* called by the core's CONFIG_PUSH event (core_events.c) with the pushed
* config, after the config's named groups are loaded and before its
* resources and queues are applied -- the order live's sched_init_config()
* (scheduler.c) uses. Both drivers hand a pushed config to every
* registered plugin's config_hook through the one plugin.c fan-out,
* plugin_config_update_core(): live calls it from sched_init_config(), the
* simulator registers it here (sim_bootstrap_limit_plugin(), sim_limit.c),
* so a limit added mid-replay reaches the limit plugin as it does live. A
* hook rather than a direct call keeps the core free of plugin.c; NULL
* (the default) means "no plugin to tell".
*/
typedef int (*xce_core_config_cb_t)(xce_sched_core_t*, xce_conf4sched_t*);
/*
* xce_unsatisfiable_lookup_cb_t / xce_unsatisfiable_populate_cb_t -
* driver-registered, OPTIONAL unsatisfiable-resreq cache consult/populate
@ -197,6 +212,10 @@ struct xce_sched_core_s {
* xce_core_cache_clear_cb_t above. NULL until a driver registers one
* (xce_core_set_cache_clear_cb()). */
xce_core_cache_clear_cb_t cache_clear_cb;
/* bug-1964: plugin config hook for the CONFIG_PUSH event -- see
* xce_core_config_cb_t above. NULL until a driver registers one
* (xce_core_set_config_cb()). */
xce_core_config_cb_t config_cb;
/* Req 5.2 (scheduler-sim-live-allocation spec, task 1.1): the
* unsatisfiable-resreq cache consult/populate seam -- see
* xce_unsatisfiable_lookup_cb_t above. NULL until a driver registers
@ -621,6 +640,13 @@ extern int xce_core_set_decision_cb(xce_sched_core_t*, xce_core_decision_cb_t,
extern int xce_core_set_cache_clear_cb(xce_sched_core_t*,
xce_core_cache_clear_cb_t);
/*
* xce_core_set_config_cb - registers the driver's plugin config hook for
* the CONFIG_PUSH event (bug-1964; see xce_core_config_cb_t). Same calling
* convention as xce_core_set_cache_clear_cb() above; NULL unregisters.
*/
extern int xce_core_set_config_cb(xce_sched_core_t*, xce_core_config_cb_t);
/*
* xce_core_begin_session / xce_core_signal_go - Req 5 AC 5 (task 4.4) split
* into two exported halves (task 5.2, Req 1 AC 7 / Req 5 AC 9) so a driver

View file

@ -122,6 +122,7 @@ typedef struct {
extern int plugin_register(void*, void*);
extern void plugin_unregister(void*);
extern int plugin_config_update(void*, xce_conf4sched_t*);
extern int plugin_config_update_core(xce_sched_core_t*, xce_conf4sched_t*);
extern int plugin_queue_update(void*, xce_sched_queue_t*);
extern int plugin_job_update(void*, xce_sched_job_t*);
extern int plugin_worker_update(void*, xce_sched_worker_t*);