[PATCH v2 0/2] qemu: fix and clean up resctrl monitor domstats
Fix two independent inconsistencies in resctrl monitor domstats reporting. The first patch reports the actual resctrl monitor group name instead of its internal ID. The second avoids reporting a zero cache monitor count when no cache monitor data is available, matching the memory bandwidth and energy collectors. These patches were previously posted as part of the whole-process resctrl series: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/QFXZZ... Changes since v1: - Split the independent fixes from the whole-process feature series. - Rebased onto current master. - Added Christopher's Reviewed-by. - Limited the domstats cleanup to the independent cache monitor fix. whole-process vCPU reporting remains in the feature series. Jedrzej Wasiukiewicz (2): qemu: fix resctrl monitor stats reporting the wrong group name qemu: omit empty cache monitor domstats src/libvirt_private.syms | 1 + src/qemu/qemu_driver.c | 5 ++++- src/util/virresctrl.c | 10 ++++++++++ src/util/virresctrl.h | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) -- 2.43.0 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
qemuDomainGetResctrlMonData filled the monitor's reported name from virResctrlMonitorGetID(), the bare id parsed from the domain XML (e.g. "vcpus_0-1"). That is a bug and a duplicate: the id is only a fragment of the real resctrl group name and vcpus are already reported with the vcpus attribute. The group actually lives at mon_groups/<machine>-<id>. Add virResctrlMonitorGetName(), which returns the basename of the monitor's resctrl path. The stats name now maps 1:1 to the mon_group directory backing the monitor. Signed-off-by: Jedrzej Wasiukiewicz <jedrzej.wasiukiewicz@intel.com> Reviewed-by: Christopher M. Cantalupo <christopher.m.cantalupo@intel.com> --- src/libvirt_private.syms | 1 + src/qemu/qemu_driver.c | 2 +- src/util/virresctrl.c | 10 ++++++++++ src/util/virresctrl.h | 3 +++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 81d0574676..798d2d28c8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3397,6 +3397,7 @@ virResctrlMonitorAddPID; virResctrlMonitorCreate; virResctrlMonitorDeterminePath; virResctrlMonitorGetID; +virResctrlMonitorGetName; virResctrlMonitorGetStats; virResctrlMonitorNew; virResctrlMonitorRemove; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cb144407c4..9abd4d5618 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17415,7 +17415,7 @@ qemuDomainGetResctrlMonData(virQEMUDriver *driver, * let this newly allocated memory buffer to be freed along with * the free of 'res' */ res->vcpus = virBitmapFormat(domresmon->vcpus); - res->name = g_strdup(virResctrlMonitorGetID(monitor)); + res->name = virResctrlMonitorGetName(monitor); if (virResctrlMonitorGetStats(monitor, (const char **)features, &res->stats, &res->nstats) < 0) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 66df44fb58..b3e5c34443 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2587,6 +2587,16 @@ virResctrlMonitorGetID(virResctrlMonitor *monitor) } +char * +virResctrlMonitorGetName(virResctrlMonitor *monitor) +{ + if (!monitor->path) + return NULL; + + return g_path_get_basename(monitor->path); +} + + void virResctrlMonitorSetAlloc(virResctrlMonitor *monitor, virResctrlAlloc *alloc) diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index 2818b6e8cc..c12b521621 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -233,6 +233,9 @@ virResctrlMonitorSetID(virResctrlMonitor *monitor, const char * virResctrlMonitorGetID(virResctrlMonitor *monitor); +char * +virResctrlMonitorGetName(virResctrlMonitor *monitor); + void virResctrlMonitorSetAlloc(virResctrlMonitor *monitor, virResctrlAlloc *alloc); -- 2.43.0 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
qemuDomainGetStatsCpuCache reports cpu.cache.monitor.count=0 when no cache monitors are available. The memory bandwidth and energy collectors instead omit their monitor fields when there is no monitor data. Return early when no cache monitor data is available to make the three resctrl domstats collectors consistent. Signed-off-by: Jedrzej Wasiukiewicz <jedrzej.wasiukiewicz@intel.com> Reviewed-by: Christopher M. Cantalupo <christopher.m.cantalupo@intel.com> --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9abd4d5618..8498568623 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17577,6 +17577,9 @@ qemuDomainGetStatsCpuCache(virQEMUDriver *driver, return; } + if (nresdata == 0) + return; + virTypedParamListAddUInt(params, nresdata, VIR_DOMAIN_STATS_CPU_CACHE_MONITOR_COUNT); -- 2.43.0 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
On 9/4/26 12:23, Jedrzej Wasiukiewicz wrote:
Fix two independent inconsistencies in resctrl monitor domstats reporting. The first patch reports the actual resctrl monitor group name instead of its internal ID. The second avoids reporting a zero cache monitor count when no cache monitor data is available, matching the memory bandwidth and energy collectors.
These patches were previously posted as part of the whole-process resctrl series:
https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/QFXZZ...
Changes since v1: - Split the independent fixes from the whole-process feature series. - Rebased onto current master. - Added Christopher's Reviewed-by. - Limited the domstats cleanup to the independent cache monitor fix. whole-process vCPU reporting remains in the feature series.
Jedrzej Wasiukiewicz (2): qemu: fix resctrl monitor stats reporting the wrong group name qemu: omit empty cache monitor domstats
src/libvirt_private.syms | 1 + src/qemu/qemu_driver.c | 5 ++++- src/util/virresctrl.c | 10 ++++++++++ src/util/virresctrl.h | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> and merged. Michal
participants (2)
-
Jedrzej Wasiukiewicz -
Michal Prívozník