vmsig: management daemon, runtime endpoint lifecycle, roster, discovery, in-tree drivers, packaging

- core: runtime attach/detach of a per-endpoint adapter trio (runtime-safe add_adapter + vmsig_core_detach_endpoint, deferred reap)
- roster: VMSIG_EV_ROSTER + CAP_ROSTER, retained per-endpoint and replayed to late subscribers
- discovery: inotify trigger dir, vmid/endpoint slot allocator, host probe; vmsigd daemon with config + per-uid admission
- input driver and vgpu perception built in-tree; vgpu perception as a separate library
- memctx: own the supplied ro_fd (closed at detach)
- deb packaging: install rules, systemd unit, tmpfiles, default config
This commit is contained in:
2026-06-22 17:25:06 +03:00
parent 0d387a4249
commit 9bde398b6c
55 changed files with 4703 additions and 61 deletions
+24
View File
@@ -1,6 +1,7 @@
#ifndef VMSIG_CORE_INTERNAL_H
#define VMSIG_CORE_INTERNAL_H
#include "vmsig_core.h"
#include "vmsig_roster.h"
#include <signal.h>
/* Private internals of the epoll core. Each registered fd carries a
@@ -41,6 +42,11 @@ typedef struct {
const vmsig_adapter_ops* ops;
vmsig_adapter* a;
uint32_t endpoint;
int active; /* 0 = free/reaped slot (reusable) */
int reap; /* deferred runtime detach requested */
uint16_t gen; /* +1 on each (re)use (ABA guard / debug) */
core_slot* slots[VMSIG_ADAPTER_FDS]; /* epoll slots we registered */
int nslot;
} core_adapter_ent;
@@ -57,6 +63,15 @@ typedef struct {
vmsig_memctx_reg reg; /* valid when registered */
} core_memctx_cell;
/* ===== Retained VM roster (inventory coherence; daemon-published) =====
* One value snapshot per endpoint: the last published roster datum. Simpler than the
* MEMCTX cell — roster carries no fd and no borrowed buffer, so the cell is pure POD and
* delivery is the ordinary broadcast (no re-describe / re-share). valid=0 on DETACH. */
typedef struct {
int valid; /* a roster entry is published for this endpoint */
vmsig_roster entry; /* last published {vmid,state,action,name} (by value) */
} core_roster_cell;
/* ===== Lease layer (arbitration of exclusive ownership of destructive resources) =====
* One cell per (endpoint, lease-class): who owns it (origin) + a snapshot of arb_prio at
* acquisition time. owner=0 => free. The snapshot (rather than the live grant) makes the
@@ -108,6 +123,7 @@ struct vmsig_core {
uint32_t epoch[64]; /* per-endpoint VM session epoch */
core_memctx_cell memctx[64]; /* per-endpoint retained context */
core_roster_cell roster[64]; /* per-endpoint retained roster */
core_lease_cell lease[64][VMSIG_LEASE_CLASSES]; /* lease per (endpoint, class) */
vmsig_arb_policy arb_cb; /* preemption policy (NULL=default) */
@@ -150,6 +166,14 @@ void core_memctx_route(vmsig_core* c, const vmsig_event* trigger);
* defined in loop.c). */
void core_memctx_replay(vmsig_core* c, int ctl_id);
/* ===== VM roster (inventory coherence; defined in loop.c alongside the memctx seam) ===== */
/* Publish a roster transition for `endpoint`: retain the datum (valid=0 on DETACH) and
* broadcast VMSIG_EV_ROSTER to qualified subscribers (CAP_ROSTER + source + endpoint). */
void core_roster_publish(vmsig_core* c, uint32_t endpoint, const vmsig_roster* entry);
/* Replay the retained roster to a single (late) subscriber (from vmsig_core_add_control). */
void core_roster_replay(vmsig_core* c, int ctl_id);
/* Bump the endpoint's epoch on a destructive lifecycle transition: epoch++, invalidate
* the retain cell, emit MEMCTX_INVALIDATED, request re-bootstrap from the adapter.
* Observed by the core in pump_up on UP VM_LIFECYCLE (defined in loop.c). */