From 9b29dd6c7b30b33aa759d7694f1f4e9a26c38e76 Mon Sep 17 00:00:00 2001 From: John Kacur Date: Thu, 26 Sep 2024 17:17:12 -0400 Subject: [PATCH] Restore all load module options Change the default kernel to linux-6.10.5-rteval Fix parsing in kcompile for the correct kernel to compile Resolves: RHEL-54310 Signed-off-by: John Kacur --- ...ng-in-kcompile-of-the-kernel-to-comp.patch | 102 +++++++++++++++++ ...-Upgrade-load-kernel-to-linux-6.10.5.patch | 80 ++++++++++++++ rteval-restore-all-load-module-options.patch | 103 ++++++++++++++++++ rteval.spec | 13 ++- 4 files changed, 296 insertions(+), 2 deletions(-) create mode 100644 rteval-Fix-parsing-in-kcompile-of-the-kernel-to-comp.patch create mode 100644 rteval-Upgrade-load-kernel-to-linux-6.10.5.patch create mode 100644 rteval-restore-all-load-module-options.patch diff --git a/rteval-Fix-parsing-in-kcompile-of-the-kernel-to-comp.patch b/rteval-Fix-parsing-in-kcompile-of-the-kernel-to-comp.patch new file mode 100644 index 0000000..cd4c491 --- /dev/null +++ b/rteval-Fix-parsing-in-kcompile-of-the-kernel-to-comp.patch @@ -0,0 +1,102 @@ +From 7e2fae40e551530f6d0ad8528c4de1ec2ae9e31b Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Sun, 18 Aug 2024 15:23:00 -0400 +Subject: [PATCH 3/3] rteval: Fix parsing in kcompile of the kernel to compile + +This patch does two things. +1. It allows you to create your own customer kernel with a dash -rteval + in the name, eg, linux-6.10.5-rteval +2. It fixes parsing of the kernel name so that if the user requests + linux-6.10.5 it doesn't use linux-6.10.6-rteval instead + +Signed-off-by: John Kacur +--- + rteval/modules/loads/kcompile.py | 30 +++++++++++++++++++----------- + 1 file changed, 19 insertions(+), 11 deletions(-) + +diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py +index 80106812af0a..58c542201a1b 100644 +--- a/rteval/modules/loads/kcompile.py ++++ b/rteval/modules/loads/kcompile.py +@@ -122,6 +122,8 @@ class Kcompile(CommandLineLoad): + self.cpulist = config.cpulist + CommandLineLoad.__init__(self, "kcompile", config, logger) + self.logger = logger ++ self._kernel_prefix = "" ++ self._log(Log.DEBUG, f'self._cfg.source = {self._cfg.source}') + + def _extract_tarball(self): + if self.source is None: +@@ -152,22 +154,29 @@ class Kcompile(CommandLineLoad): + f"error removing builddir ({self.builddir}) (ret={ret})") + + def _find_tarball(self): +- # If the user specifies the full kernel name, check if available +- tarfile = os.path.join(self.srcdir, self._cfg.source) +- if os.path.exists(tarfile): +- return tarfile ++ """ Find the tarball and self._kernel_prefix """ + + if 'rc' in self._cfg.source: +- tarfile_prefix = re.search(r"\d{1,2}\.\d{1,3}\-[a-z]*\d{1,2}", self._cfg.source).group(0) ++ tarfile_prefix = re.search(r"\d{1,2}\.\d{1,3}\-rc\d{1,2}", self._cfg.source).group(0) ++ elif 'rteval' in self._cfg.source: ++ tarfile_prefix = re.search(r"(\d{1,2}\.\d{1,3}\.\d{1,3}\-rteval)|(\d{1,2}\.\d{1,3}\-rteval)", self._cfg.source).group(0) + else: + tarfile_prefix = re.search(r"(\d{1,2}\.\d{1,3}\.\d{1,3})|(\d{1,2}\.\d{1,3})", self._cfg.source).group(0) + ++ # Save the kernel prefix ++ self._kernel_prefix = "linux-" + tarfile_prefix ++ ++ # If the user specifies the full kernel name, check if available ++ tarfile = os.path.join(self.srcdir, self._cfg.source) ++ if os.path.exists(tarfile): ++ return tarfile ++ + # either a tar.xz or tar.gz might exist. Check for both. + xz_file = os.path.join(self.srcdir,"linux-" + tarfile_prefix + ".tar.xz" ) + gz_file = os.path.join(self.srcdir,"linux-" + tarfile_prefix + ".tar.gz" ) + if os.path.exists(xz_file): + return xz_file +- elif os.path.exists(gz_file): ++ if os.path.exists(gz_file): + return gz_file + raise rtevalRuntimeError(self, f"tarfile {tarfile} does not exist!") + +@@ -178,21 +187,20 @@ class Kcompile(CommandLineLoad): + # find our source tarball + if self._cfg.source: + self.source = self._find_tarball() +- kernel_prefix = re.search(r"(linux-\d{1,2}\.\d{1,3}\.\d{1,3})|(linux-\d{1,2}\.\d{1,3})", self.source).group(0) + else: + tarfiles = glob.glob(os.path.join(self.srcdir, f"{DEFAULT_KERNEL_PREFIX}*")) + if tarfiles: + self.source = tarfiles[0] + else: + raise rtevalRuntimeError(self, f" no kernel tarballs found in {self.srcdir}") +- kernel_prefix = DEFAULT_KERNEL_PREFIX +- self._log(Log.DEBUG, f"kernel_prefix = {kernel_prefix}") ++ self._kernel_prefix = DEFAULT_KERNEL_PREFIX ++ self._log(Log.DEBUG, f"self._kernel_prefix = {self._kernel_prefix}") + + # check for existing directory + kdir = None + names = os.listdir(self.builddir) + for d in names: +- if d.startswith(kernel_prefix): ++ if d == self._kernel_prefix: + kdir = d + break + if kdir is None: +@@ -200,7 +208,7 @@ class Kcompile(CommandLineLoad): + names = os.listdir(self.builddir) + for d in names: + self._log(Log.DEBUG, f"checking {d}") +- if d.startswith(kernel_prefix): ++ if d == self._kernel_prefix: + kdir = d + break + if kdir is None: +-- +2.46.0 + diff --git a/rteval-Upgrade-load-kernel-to-linux-6.10.5.patch b/rteval-Upgrade-load-kernel-to-linux-6.10.5.patch new file mode 100644 index 0000000..64273f3 --- /dev/null +++ b/rteval-Upgrade-load-kernel-to-linux-6.10.5.patch @@ -0,0 +1,80 @@ +From 0e6fa19365330937d54132a3077d5d9961877546 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Sun, 18 Aug 2024 12:10:55 -0400 +Subject: [PATCH 2/3] rteval: Upgrade load kernel to linux-6.10.5-rteval + +The older kernel fails to compile on newer tool chains, so upgrade +the kernel that kcompile compiles as a load to linux-6.10.5-rteval + +Signed-off-by: John Kacur +--- + Dockerfile | 2 +- + Makefile | 2 +- + rteval/modules/loads/kcompile.py | 4 ++-- + rteval/rteval.conf | 2 +- + 4 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/Dockerfile b/Dockerfile +index 45f6434777d4..f3ee516b57d5 100644 +--- a/Dockerfile ++++ b/Dockerfile +@@ -1,7 +1,7 @@ + # Use CentOS Stream 9 as base image + FROM centos:stream9 + +-ARG KERNEL_VERSION=linux-6.6.1.tar.xz ++ARG KERNEL_VERSION=linux-6.10.5-rteval.tar.xz + + + # Copy current directory to /opt/rteval/ +diff --git a/Makefile b/Makefile +index d9a6b9f116ac..e1a2bbba0373 100644 +--- a/Makefile ++++ b/Makefile +@@ -14,7 +14,7 @@ PREFIX := /usr + DATADIR := $(DESTDIR)/$(PREFIX)/share + LOADDIR := loadsource + +-KLOAD := $(LOADDIR)/linux-6.6.1.tar.xz ++KLOAD := $(LOADDIR)/linux-6.10.5-rteval.tar.xz + BLOAD := $(LOADDIR)/dbench-4.0.tar.gz + LOADS := $(KLOAD) $(BLOAD) + +diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py +index f7a9c0084805..80106812af0a 100644 +--- a/rteval/modules/loads/kcompile.py ++++ b/rteval/modules/loads/kcompile.py +@@ -21,7 +21,7 @@ expand_cpulist = cpulist_utils.expand_cpulist + compress_cpulist = cpulist_utils.compress_cpulist + nonisolated_cpulist = cpulist_utils.nonisolated_cpulist + +-DEFAULT_KERNEL_PREFIX = "linux-6.6" ++DEFAULT_KERNEL_PREFIX = "linux-6.10.5-rteval" + + class KBuildJob: + '''Class to manage a build job bound to a particular node''' +@@ -334,7 +334,7 @@ class Kcompile(CommandLineLoad): + + def ModuleParameters(): + return {"source": {"descr": "Source tar ball", +- "default": "linux-6.6.1.tar.xz", ++ "default": "linux-6.10.5-rteval.tar.xz", + "metavar": "TARBALL"}, + "jobspercore": {"descr": "Number of working threads per core", + "default": 2, +diff --git a/rteval/rteval.conf b/rteval/rteval.conf +index a4aad33e264f..0611c031c2a0 100644 +--- a/rteval/rteval.conf ++++ b/rteval/rteval.conf +@@ -18,7 +18,7 @@ dbench: external + stressng: module + + [kcompile] +-source: linux-6.6.1.xz ++source: linux-6.10.5-rteval.xz + jobspercore: 2 + + [hackbench] +-- +2.46.0 + diff --git a/rteval-restore-all-load-module-options.patch b/rteval-restore-all-load-module-options.patch new file mode 100644 index 0000000..1d34a39 --- /dev/null +++ b/rteval-restore-all-load-module-options.patch @@ -0,0 +1,103 @@ +From 06acb385b2074f39146d5c1a41cb2133c43ade82 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Sun, 18 Aug 2024 09:48:49 -0400 +Subject: [PATCH 1/3] rteval: restore all load module options + +Commit 56c7cf63942d rteval: Allow arguments specific to module group + +intended to allow group options to the overall measurement modules without +applying to the load modules. It inadvertently disabled options for most +load modules such as hackbench and kcompile. + +This patch reworks the overall group mechanism a little bit to restore +these menus. + +Signed-off-by: John Kacur +--- + rteval/modules/__init__.py | 22 +++++++++++++++++----- + rteval/modules/measurement/__init__.py | 12 +----------- + 2 files changed, 18 insertions(+), 16 deletions(-) + +diff --git a/rteval/modules/__init__.py b/rteval/modules/__init__.py +index acd6330788e2..eb29db86ce7a 100644 +--- a/rteval/modules/__init__.py ++++ b/rteval/modules/__init__.py +@@ -280,10 +280,24 @@ reference from the first import""" + + grparser = parser.add_argument_group(f"Group Options for {self.__modtype} modules") + grparser.add_argument(f'--{self.__modtype}-cpulist', +- dest=f'{self.__modtype}___cpulist', action='store', default="", ++ dest=f'{self.__modtype}___cpulist', action='store', ++ default="", + help=f'CPU list where {self.__modtype} modules will run', + metavar='CPULIST') + ++ # Set up options for measurement modules only ++ if self.__modtype == 'measurement': ++ grparser.add_argument(f'--{self.__modtype}-run-on-isolcpus', ++ dest = f'{self.__modtype}___run_on_isolcpus', ++ action = "store_true", ++ default = config.GetSection("measurement").setdefault("run-on-isolcpus", "false").lower() == "true", ++ help = "Include isolated CPUs in default cpulist") ++ grparser.add_argument('--idle-set', ++ dest='measurement___idlestate', ++ metavar='IDLESTATE', ++ default=None, ++ help='Idle state depth to set on cpus running measurement modules') ++ + for (modname, mod) in list(self.__modsloaded.items()): + opts = mod.ModuleParameters() + if len(opts) == 0: +@@ -296,7 +310,7 @@ reference from the first import""" + # Ignore if a section is not found + cfg = None + +- modgrparser = parser.add_argument_group(f"Options for the {shortmod} module") ++ grparser = parser.add_argument_group(f"Options for the {shortmod} module") + for (o, s) in list(opts.items()): + descr = 'descr' in s and s['descr'] or "" + metavar = 'metavar' in s and s['metavar'] or None +@@ -311,7 +325,7 @@ reference from the first import""" + default = 'default' in s and s['default'] or None + + +- modgrparser.add_argument(f'--{shortmod}-{o}', ++ grparser.add_argument(f'--{shortmod}-{o}', + dest=f"{shortmod}___{o}", + action='store', + help='%s%s' % (descr, +@@ -319,8 +333,6 @@ reference from the first import""" + default=default, + metavar=metavar) + +- return grparser +- + + def InstantiateModule(self, modname, modcfg, modroot=None): + """Imports a module and instantiates an object from the modules create() function. +diff --git a/rteval/modules/measurement/__init__.py b/rteval/modules/measurement/__init__.py +index 9314d1cb6bbc..44708ce0b035 100644 +--- a/rteval/modules/measurement/__init__.py ++++ b/rteval/modules/measurement/__init__.py +@@ -29,17 +29,7 @@ class MeasurementModules(RtEvalModules): + + def SetupModuleOptions(self, parser): + "Sets up all the measurement modules' parameters for the option parser" +- grparser = super().SetupModuleOptions(parser) +- +- # Set up options specific for measurement module group +- grparser.add_argument("--measurement-run-on-isolcpus", +- dest="measurement___run_on_isolcpus", +- action="store_true", +- default=self._cfg.GetSection("measurement").setdefault("run-on-isolcpus", "false").lower() +- == "true", +- help="Include isolated CPUs in default cpulist") +- grparser.add_argument('--idle-set', dest='measurement___idlestate', metavar='IDLESTATE', +- default=None, help='Idle state depth to set on cpus running measurement modules') ++ super().SetupModuleOptions(parser) + + + def Setup(self, modparams): +-- +2.46.0 + diff --git a/rteval.spec b/rteval.spec index a9ad9a6..d0521d7 100644 --- a/rteval.spec +++ b/rteval.spec @@ -1,6 +1,6 @@ Name: rteval Version: 3.8 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Utility to evaluate system suitability for RT Linux Group: Development/Tools @@ -14,7 +14,7 @@ BuildRequires: python3-setuptools Requires: python3-lxml Requires: python3-libxml2 Requires: realtime-tests -Requires: rteval-loads >= 1.6-5 +Requires: rteval-loads >= 1.6-12 Requires: sysstat Requires: xz bzip2 tar gzip m4 gawk Requires: kernel-headers @@ -51,6 +51,9 @@ Patch14: rteval-Added-functionality-to-allow-user-to-set-the-.patch Patch15: rteval-run-cyclictest-using-default-system-when-sett.patch Patch16: rteval-Add-module-for-tuned-state.patch Patch17: rteval-Add-tuned-state-to-rteval-text-report.patch +Patch18: rteval-restore-all-load-module-options.patch +Patch19: rteval-Upgrade-load-kernel-to-linux-6.10.5.patch +Patch20: rteval-Fix-parsing-in-kcompile-of-the-kernel-to-comp.patch %description The rteval script is a utility for measuring various aspects of @@ -83,6 +86,12 @@ to the screen. %{_bindir}/rteval %changelog +* Mon Aug 19 2024 John Kacur - 3.8-11 +- Restore all load module options +- Change the default kernel to linux-6.10.5-rteval +- Fix parsing in kcompile for the correct kernel to compile +Resolves: RHEL-54310 + * Tue Aug 13 2024 Tomas Glozar - 3.8-10 - Collect tuned state in sysinfo Resolves: RHEL-33854