Linux kernel 7.0 introduced PERF_PKG_MON support in resctrl filesystem which exposes per-workload energy and performance monitoring.
This series 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. Changes since v1 (RFC): - Split into 5 patches (see below) - Changed VIR_INFO/VIR_WARN to VIR_DEBUG - Tightened energyMonitorFeature to <choice> of core_energy/activity instead of regex - Renamed test case energytune-basic -> energytune - Minor comment cleanups in virresctrl.h Jedrzej Wasiukiewicz (5): util: add PERF_PKG_MON energy monitoring support in virresctrl conf: report energy monitoring in host capabilities conf: add energytune to domain XML qemu: resctrl energy counters via domstats NEWS: document resctrl energy monitoring NEWS.rst | 6 + 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 | 27 ++++ 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 | 10 +- tests/genericxml2xmlindata/energytune.xml | 32 ++++ tests/genericxml2xmltest.c | 1 + 14 files changed, 542 insertions(+), 37 deletions(-) create mode 100644 tests/genericxml2xmlindata/energytune.xml -- 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.
