On Tue, May 12, 2026 at 15:13:58 +0200, Jedrzej Wasiukiewicz wrote: > Linux kernel 7.0 introduced PERF_PKG_MON support in resctrl filesystem > which exposes per-workload energy and performance monitoring. > > This patch enables per-VM energy monitoring via core_energy (Joules) and > activity (Farads) counters. Energy monitors can be configured through new > <energytune> element under <cputune> following earlier cachetune and > memorytune patterns. > > Design notes: > > Energy values from resctrl are floating-point. I added separate dvals/ndvals > pair to virResctrlMonitorStats to handle them. I kept them in a single > struct for easier integration with performance counters (integers and floats > within same monitor) that might be integrated in another patch. > > The new XML element is <energytune> under <cputune> following earlier pattern > for > resctrl features (cachetune, memorytune). Energytune doesn't currently support > the "tuning" part, only monitoring. I added it as energytune for consistency > with > cache and memory features, keeping all resctrl handling under cputune. This > also makes > sense with current resctrl architecture - all monitoring groups are part of an > allocation group. This approach allows for easy opt-in/out on the monitoring > features. > > Signed-off-by: Jedrzej Wasiukiewicz <[email protected]> > Signed-off-by: Christopher M. Cantalupo <[email protected]> > --- > Please let me know if there's a better approach for this. I'm happy to rework > the design based on feedback. I can also split this patch if necessary.
This patch will need to be split into multiple patches, as we usually do. > > NEWS.rst | 6 + At the very least any change to NEWS.rst *must* be in a separate patch. > docs/formatdomain.rst | 20 ++ > include/libvirt/libvirt-domain.h | 65 +++++++ > src/conf/capabilities.c | 42 ++++ > src/conf/capabilities.h | 6 + > src/conf/domain_conf.c | 99 ++++++++++ > src/conf/schemas/capability.rng | 26 +++ > src/conf/schemas/domaincommon.rng | 19 ++ > src/conf/virconftypes.h | 2 + > src/qemu/qemu_driver.c | 70 ++++++- > src/util/virresctrl.c | 180 +++++++++++++++--- > src/util/virresctrl.h | 12 +- > .../genericxml2xmlindata/energytune-basic.xml | 32 ++++ > tests/genericxml2xmltest.c | 1 + > 14 files changed, 543 insertions(+), 37 deletions(-) > create mode 100644 tests/genericxml2xmlindata/energytune-basic.xml [...] Couple high-level points from scrolling through the overly-long patch: - some changes looked like cleanups mixed with implementation, try to separate cleanups as separate patches - separate out XML+schema+docs changes froma ctual implementation - separate out reporting (capabilities) from VM setup - ensure that everything can be compiled after every patch - avoid VIR_INFO and VIR_WARN as debug messages > -- > 2.34.1 > > --------------------------------------------------------------------- > 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. Funny to see such a disclaimer when posting stuff to public lists.
