public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Clark Williams <williams@redhat.com>, Tomas Glozar <tglozar@redhat.com>
Subject: [PATCH 3/7] rteval: Include core sharing warnings in XML report
Date: Tue, 21 Apr 2026 14:26:14 -0400	[thread overview]
Message-ID: <20260421182618.261347-4-jkacur@redhat.com> (raw)
In-Reply-To: <20260421182618.261347-1-jkacur@redhat.com>

Add core sharing validation warnings to the CPUtopology section of the
XML report, making isolation issues part of the permanent test record.

This complements the console warnings added in the previous commit by
ensuring that core sharing conflicts are documented in the XML output,
allowing users to analyze test runs later even if they missed the
console warnings during execution.

Implementation:
- CPUtopology.add_core_sharing_warnings(): New method to add warnings
  to the CPUtopology XML node after CPU lists are finalized
- rteval-cmd: Call add_core_sharing_warnings() after RtEval object is
  created and CPU lists are available
- XML structure: CoreSharingWarnings appears at the end of CPUtopology
  node, after all CPU entries and summary properties

Note: The warnings must be added after SystemInfo initialization because
CPU lists are finalized in rteval-cmd after the config is processed,
which happens after SystemInfo is created. We call the method explicitly
once the CPU lists are known.

Example XML output:
  <CPUtopology num_cpu_cores="16" ...>
    <cpu name="cpu0" ... isolated="1"/>
    <cpu name="cpu8" ... isolated="1"/>
    ...
    <CoreSharingWarnings>
      <warning>Warning: Housekeeping CPU 0 (isol) shares core with measurement CPU 8 (isol)</warning>
    </CoreSharingWarnings>
  </CPUtopology>

The warnings use the same format as console output, clearly indicating
which CPUs are isolated with "(isol)" markers.

Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 rteval-cmd                    | 13 +++++++++----
 rteval/sysinfo/__init__.py    |  3 +++
 rteval/sysinfo/cputopology.py | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/rteval-cmd b/rteval-cmd
index f0efb0117726..b3f9fac2c2cf 100755
--- a/rteval-cmd
+++ b/rteval-cmd
@@ -447,10 +447,11 @@ if __name__ == '__main__':
         logger.log(Log.DEBUG, f"workdir: {rtevcfg.workdir}")
 
         # Validate core sharing between housekeeping, measurement, and load CPUs
-        if housekeeping_cpus or msrcfg_cpus or ldcfg_cpus:
-            core_warnings = validate_core_sharing(housekeeping_cpus, msrcfg_cpus, ldcfg_cpus)
-            for warning in core_warnings:
-                logger.log(Log.WARN, warning)
+        msrcfg_cpus = CpuList(msrcfg.cpulist).cpus if msrcfg.cpulist else []
+        ldcfg_cpus = CpuList(ldcfg.cpulist).cpus if ldcfg.cpulist else []
+        core_warnings = validate_core_sharing(housekeeping_cpus, msrcfg_cpus, ldcfg_cpus)
+        for warning in core_warnings:
+            logger.log(Log.WARN, warning)
 
         # if --summarize was specified then just parse the XML, print it and exit
         if cmd_opts.rteval___summarize:
@@ -487,6 +488,10 @@ if __name__ == '__main__':
             cpupower_controller.enable_idle_state()
 
         rteval = RtEval(config, loadmods, measuremods, logger)
+
+        # Add core sharing warnings to the XML report now that CPU lists are finalized
+        rteval._sysinfo.add_core_sharing_warnings(housekeeping_cpus, msrcfg_cpus, ldcfg_cpus)
+
         rteval.Prepare(rtevcfg.onlyload)
 
         if rtevcfg.onlyload:
diff --git a/rteval/sysinfo/__init__.py b/rteval/sysinfo/__init__.py
index 4b7b03cda626..56a0c57b2cbc 100644
--- a/rteval/sysinfo/__init__.py
+++ b/rteval/sysinfo/__init__.py
@@ -35,6 +35,9 @@ class SystemInfo(KernelInfo, SystemServices, dmi.DMIinfo, CPUtopology,
         self.ProcessWarnings()
 
         # Parse CPU info
+        # Note: CPU lists are not available at this point (they're finalized in rteval-cmd),
+        # so we can't add core sharing warnings to the XML report yet.
+        # Console warnings are still generated in rteval-cmd.
         CPUtopology._parse(self)
 
 
diff --git a/rteval/sysinfo/cputopology.py b/rteval/sysinfo/cputopology.py
index db30635a0488..a21c19179f28 100644
--- a/rteval/sysinfo/cputopology.py
+++ b/rteval/sysinfo/cputopology.py
@@ -94,6 +94,39 @@ class CPUtopology:
         return self.__cputop_n
 
 
+    def add_core_sharing_warnings(self, housekeeping_cpus, measurement_cpus, load_cpus):
+        """
+        Add core sharing warnings to the CPUtopology XML node.
+        Should be called after CPU lists are finalized.
+
+        :param housekeeping_cpus: List of housekeeping CPU integers
+        :param measurement_cpus: List of measurement CPU integers
+        :param load_cpus: List of load CPU integers
+        """
+        if self.__cputop_n is None:
+            return
+
+        # Remove any existing CoreSharingWarnings section
+        existing = self.__cputop_n.xpathEval('CoreSharingWarnings')
+        if existing:
+            for node in existing:
+                node.unlinkNode()
+                node.freeNode()
+
+        # Generate new warnings
+        from rteval.systopology import validate_core_sharing
+        warnings = validate_core_sharing(
+            housekeeping_cpus or [],
+            measurement_cpus or [],
+            load_cpus or []
+        )
+
+        # Add warnings to XML if any were found
+        if warnings:
+            warnings_n = self.__cputop_n.newChild(None, 'CoreSharingWarnings', None)
+            for warning in warnings:
+                warnings_n.newChild(None, 'warning', warning)
+
     def MakeReport(self):
         return self.__cputop_n
 
-- 
2.53.0


  parent reply	other threads:[~2026-04-21 18:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 18:26 [PATCH 0/7] Core sharing validation for CPU isolation John Kacur
2026-04-21 18:26 ` [PATCH 1/7] rteval: Add CoreSiblings class for CPU core topology queries John Kacur
2026-04-21 18:26 ` [PATCH 2/7] rteval: Add core sharing validation for CPU isolation John Kacur
2026-04-21 18:26 ` John Kacur [this message]
2026-04-21 18:26 ` [PATCH 4/7] rteval: Add temporary test for core sharing validation with mocked isolated CPUs John Kacur
2026-04-21 18:26 ` [PATCH 5/7] rteval: Display core sharing warnings in text report John Kacur
2026-04-21 18:26 ` [PATCH 6/7] rteval: Add --warn-non-isolated-core-sharing option for measurement vs load warnings John Kacur
2026-04-21 18:26 ` [PATCH 7/7] rteval: Include --warn-non-isolated-core-sharing warnings in XML report John Kacur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260421182618.261347-4-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=tglozar@redhat.com \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox