Resctrl support in libvirt currently requires allocations and monitors
to be associated with a set of vCPUs. This does not accurately model
QEMU resource consumption, as IOThreads, worker threads and emulator
threads also consume cache, memory bandwidth and energy. This series
introduces a whole-process resctrl scope, allowing ``cachetune``,
``memorytune``, ``energytune`` and ``monitor`` elements to omit the
``vcpus`` attribute and apply to the entire QEMU emulator process. By
placing the emulator process into the resctrl group before thread
creation, all subsequently created threads inherit the same resctrl
configuration.

Major design choices:

 * A resctrl allocation or monitor without a ``vcpus`` attribute is
   treated as a whole-process group.

 * Whole-process allocations and per-vCPU allocations are mutually
   exclusive within a domain to avoid ambiguous resource assignment.

 * Whole-process monitors require a whole-process allocation of the same
   resource type and are unique per resource.

 * Monitors without ``vcpus`` inherit the scope of their parent
   allocation. Under a whole-process allocation they monitor the whole
   process; under a per-vCPU allocation they monitor the allocation's
   vCPU set. This reflects the dependency between resctrl monitoring and
   allocation groups.

 * Whole-process resctrl groups are created by placing the QEMU process
   into the target group before thread creation, allowing all
   subsequently created threads to inherit the same resctrl
   configuration.

The series also updates XML validation, fixes resctrl monitor
statistics reporting, and cleans up monitor domstats output.

Jedrzej Wasiukiewicz (6):
  conf: allow omitting vcpus in cachetune/memorytune/energytune
  conf: implement whole-process resctrl scope
  qemu: assign whole-process resctrl groups at domain start
  qemu: fix resctrl monitor stats reporting the wrong group name
  qemu: clean up resctrl monitor domstats
  NEWS: Document whole-process resctrl support

 NEWS.rst                                      |  11 +
 docs/formatdomain.rst                         |  57 +++--
 src/conf/domain_conf.c                        | 231 ++++++++++++------
 src/conf/domain_conf.h                        |   2 +
 src/conf/schemas/domaincommon.rng             |  48 ++--
 src/libvirt_private.syms                      |   1 +
 src/qemu/qemu_driver.c                        |  29 ++-
 src/qemu/qemu_process.c                       |  40 ++-
 src/util/virresctrl.c                         |  20 +-
 src/util/virresctrl.h                         |   3 +
 .../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 +
 23 files changed, 694 insertions(+), 128 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

-- 
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.

Reply via email to