On 9/7/26 12:47, Jedrzej Wasiukiewicz wrote:
Treat vCPU attribute absence as a request to place the whole emulator process in one resctrl group for both allocation and monitoring. Parsing such XML failed until now.
A whole-process group has no vCPU list. It formats back as a bare cachetune, memorytune, energytune or monitor element.
Track the scope with a whole_process flag and enforce the rules beside the existing monitor checks. A domain's allocations are either all whole-process or all per-vCPU. A whole-process monitor needs a whole-process allocation, does not mix with explicit monitors and is unique per resource type. A whole-process allocation may still carry explicit per-vCPU monitors, as it already spans every thread. Monitors that omit vcpus inside an explicit allocation inherit the allocation's vcpu scope instead of covering the whole process. This behavior represents the resctrl dependency between allocation and monitoring.
Out of range and empty vcpus attributes still remain silently dropped.
Signed-off-by: Jedrzej Wasiukiewicz <jedrzej.wasiukiewicz@intel.com> Reviewed-by: Christopher M. Cantalupo <christopher.m.cantalupo@intel.com> --- src/conf/domain_conf.c | 231 ++++++++++++------ src/conf/domain_conf.h | 2 + .../cachetune-monitor-empty-vcpus.xml | 30 +++ .../cachetune-monitor-inherit-alloc.xml | 30 +++ .../cachetune-wholeprocess-duplicate.xml | 32 +++ ...chetune-wholeprocess-monitor-duplicate.xml | 31 +++ .../cachetune-wholeprocess-monitors.xml | 31 +++ .../energytune-colliding-monitor.xml | 30 +++ .../energytune-wholeprocess.xml | 29 +++ .../memorytune-wholeprocess.xml | 29 +++ .../resctrl-wholeprocess-alloc-monitor.xml | 32 +++ .../resctrl-wholeprocess-layering.xml | 32 +++ .../resctrl-wholeprocess-monitors.xml | 33 +++ .../cachetune-monitor-inherit-alloc.xml | 30 +++ tests/genericxml2xmltest.c | 11 + 15 files changed, 545 insertions(+), 68 deletions(-) create mode 100644 tests/genericxml2xmlindata/cachetune-monitor-empty-vcpus.xml create mode 100644 tests/genericxml2xmlindata/cachetune-monitor-inherit-alloc.xml create mode 100644 tests/genericxml2xmlindata/cachetune-wholeprocess-duplicate.xml create mode 100644 tests/genericxml2xmlindata/cachetune-wholeprocess-monitor-duplicate.xml create mode 100644 tests/genericxml2xmlindata/cachetune-wholeprocess-monitors.xml create mode 100644 tests/genericxml2xmlindata/energytune-colliding-monitor.xml create mode 100644 tests/genericxml2xmlindata/energytune-wholeprocess.xml create mode 100644 tests/genericxml2xmlindata/memorytune-wholeprocess.xml create mode 100644 tests/genericxml2xmlindata/resctrl-wholeprocess-alloc-monitor.xml create mode 100644 tests/genericxml2xmlindata/resctrl-wholeprocess-layering.xml create mode 100644 tests/genericxml2xmlindata/resctrl-wholeprocess-monitors.xml create mode 100644 tests/genericxml2xmloutdata/cachetune-monitor-inherit-alloc.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 34d3b00079..c1a4b8f26e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18814,15 +18814,17 @@ virDomainDefParseBootOptions(virDomainDef *def, static int virDomainResctrlParseVcpus(virDomainDef *def, xmlNodePtr node, - virBitmap **vcpus) + virBitmap **vcpus, + bool *whole_process)
Nit pick - we don't really like underscore case (though some code might have slipped in back in the day). Michal