Make the vcpus attribute optional on cachetune, memorytune and
energytune. Not specifying vcpus in the XML makes the allocation/monitoring
group affect the whole domain process, relying on the resctrl inheritance
mechanism so that all of the process' threads and children end up in
the same group.

Signed-off-by: Jedrzej Wasiukiewicz <[email protected]>
---
 docs/formatdomain.rst             | 57 ++++++++++++++++++-------------
 src/conf/schemas/domaincommon.rng | 48 ++++++++++++++++----------
 2 files changed, 63 insertions(+), 42 deletions(-)

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 28c9170a37..1f8bf378eb 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -1023,10 +1023,13 @@ CPU Tuning
    Optional ``cachetune`` element can control allocations for CPU caches using
    the resctrl on the host. Whether or not is this supported can be gathered
    from capabilities where some limitations like minimum size and required
-   granularity are reported as well. The required attribute ``vcpus`` specifies
-   to which vCPUs this allocation applies. A vCPU can only be member of one
-   ``cachetune`` element allocation. The vCPUs specified by cachetune can be
-   identical with those in memorytune, however they are not allowed to overlap.
+   granularity are reported as well. The optional attribute ``vcpus`` specifies
+   to which vCPUs this allocation applies. If ``vcpus`` is omitted the 
allocation
+   applies to the whole emulator process; the resctrl group is then inherited 
by
+   all its threads and child processes. A vCPU can only be member of one
+   ``cachetune`` element allocation. The scope specified by cachetune
+   can be identical with those in memorytune, however they are not
+   allowed to overlap.
    The optional, output only ``id`` attribute identifies cache uniquely.
    Supported subelements are:
 
@@ -1053,23 +1056,26 @@ CPU Tuning
          specified, defaults to bytes.
 
    ``monitor`` :since:`Since 4.10.0`
-      The optional element ``monitor`` creates the cache monitor(s) for current
-      cache allocation and has the following required attributes:
+      The optional element ``monitor`` creates the cache monitor(s) for
+      the enclosing ``cachetune`` allocation. It has the following attributes:
 
       ``level``
-         Host cache level the monitor belongs to.
+         Required. Host cache level the monitor belongs to.
       ``vcpus``
-         vCPU list the monitor applies to. A monitor's vCPU list can only be 
the
-         member(s) of the vCPU list of the associated allocation. The default
-         monitor has the same vCPU list as the associated allocation. For
-         non-default monitors, overlapping vCPUs are not permitted.
+         Optional. The vCPUs to monitor. Must be a subset of the enclosing
+         allocation's vCPUs and must not overlap another cache monitor of the
+         same allocation. A monitor covering the allocation's full vCPU list
+         reports the allocation as a whole. Omit ``vcpus`` to inherit the
+         enclosing allocation's scope.
 
 ``memorytune`` :since:`Since 4.7.0`
    Optional ``memorytune`` element can control allocations for memory bandwidth
    using the resctrl on the host. Whether or not is this supported can be
    gathered from capabilities where some limitations like minimum bandwidth and
-   required granularity are reported as well. The required attribute ``vcpus``
-   specifies to which vCPUs this allocation applies. A vCPU can only be member
+   required granularity are reported as well. The optional attribute ``vcpus``
+   specifies to which vCPUs this allocation applies. If ``vcpus`` is omitted 
the
+   allocation applies to the whole emulator process; the resctrl group is then
+   inherited by all its threads and child processes. A vCPU can only be member
    of one ``memorytune`` element allocation. The ``vcpus`` specified by
    ``memorytune`` can be identical to those specified by ``cachetune``. However
    they are not allowed to overlap each other. Supported subelements are:
@@ -1088,21 +1094,24 @@ CPU Tuning
          configuration.
 
 ``energytune`` :since:`Since 12.4.0`
-   Optional ``energytune`` element allows to monitor energy consumption using 
the
-   resctrl filesystem on the host. Whether or not is this supported can be
-   gathered from capabilities where number of monitors and available features 
are
-   reported. The required attribute ``vcpus`` specifies to which allocation 
group
-   this monitor belongs. A vCPU can only be member of one allocation group and 
monitor
-   group. The ``vcpus`` specified by ``energytune`` can be identical to those
-   specified by ``cachetune`` or ``memorytune``. However they are not allowed 
to
-   overlap each other. Supported subelements are:
+   Optional ``energytune`` element defines a group for energy consumption
+   monitoring using the resctrl filesystem on the host. Whether or not is this
+   supported can be gathered from capabilities where number of monitors and
+   available features are reported. The optional attribute ``vcpus`` specifies
+   which vCPUs form this group. If ``vcpus`` is omitted the group covers the 
whole
+   emulator process; the resctrl group is then inherited by all its threads and
+   child processes. A vCPU can only be member of one ``energytune`` group. The
+   ``vcpus`` specified by ``energytune`` can be identical to those specified by
+   ``cachetune`` or ``memorytune``. However they are not allowed to overlap 
each
+   other. Supported subelements are:
 
    ``monitor``
-      The optional element ``monitor`` creates the energy monitor for
-      this allocation group and has the following required attribute:
+      The optional element creates the energy monitor for the
+      enclosing ``energytune`` group. It has the following attribute:
 
       ``vcpus``
-         vCPU list the monitor applies to.
+         Optional. The vCPUs to monitor. Omit ``vcpus`` to inherit the 
enclosing
+         group's scope.
 
 
 Memory Allocation
diff --git a/src/conf/schemas/domaincommon.rng 
b/src/conf/schemas/domaincommon.rng
index 81ffbfc2fa..aa51429964 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -1224,9 +1224,11 @@
         </optional>
         <zeroOrMore>
           <element name="cachetune">
-            <attribute name="vcpus">
-              <ref name="cpuset"/>
-            </attribute>
+            <optional>
+              <attribute name="vcpus">
+                <ref name="cpuset"/>
+              </attribute>
+            </optional>
             <optional>
               <attribute name="id">
                 <data type="string"/>
@@ -1261,9 +1263,11 @@
                   <attribute name="level">
                     <ref name="unsignedInt"/>
                   </attribute>
-                  <attribute name="vcpus">
-                    <ref name="cpuset"/>
-                  </attribute>
+                  <optional>
+                    <attribute name="vcpus">
+                      <ref name="cpuset"/>
+                    </attribute>
+                  </optional>
                 </element>
               </choice>
             </oneOrMore>
@@ -1271,9 +1275,11 @@
         </zeroOrMore>
         <zeroOrMore>
           <element name="memorytune">
-            <attribute name="vcpus">
-              <ref name="cpuset"/>
-            </attribute>
+            <optional>
+              <attribute name="vcpus">
+                <ref name="cpuset"/>
+              </attribute>
+            </optional>
             <oneOrMore>
               <choice>
                 <element name="node">
@@ -1285,9 +1291,11 @@
                   </attribute>
                 </element>
                 <element name="monitor">
-                  <attribute name="vcpus">
-                    <ref name="cpuset"/>
-                  </attribute>
+                  <optional>
+                    <attribute name="vcpus">
+                      <ref name="cpuset"/>
+                    </attribute>
+                  </optional>
                 </element>
               </choice>
             </oneOrMore>
@@ -1295,9 +1303,11 @@
         </zeroOrMore>
         <zeroOrMore>
           <element name="energytune">
-            <attribute name="vcpus">
-              <ref name="cpuset"/>
-            </attribute>
+            <optional>
+              <attribute name="vcpus">
+                <ref name="cpuset"/>
+              </attribute>
+            </optional>
             <optional>
               <attribute name="id">
                 <data type="string"/>
@@ -1305,9 +1315,11 @@
             </optional>
             <oneOrMore>
               <element name="monitor">
-                <attribute name="vcpus">
-                  <ref name="cpuset"/>
-                </attribute>
+                <optional>
+                  <attribute name="vcpus">
+                    <ref name="cpuset"/>
+                  </attribute>
+                </optional>
               </element>
             </oneOrMore>
           </element>
-- 
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