All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rteval: kcompile: Fix for no numactl and no cpulist
@ 2021-09-09 19:32 John Kacur
  0 siblings, 0 replies; only message in thread
From: John Kacur @ 2021-09-09 19:32 UTC (permalink / raw)
  To: Clark Williams; +Cc: RT, John Kacur, Punit Agrawal

Constructing a command to compile the kernel as a load can fail
in certain cases such as when numactl is not available and the user
doesn't pass a cpulist.

Fix this for both the runcmd and the cleancmd by not assuming that
numactl is available or that taskset will be used.

Reported-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 rteval/modules/loads/kcompile.py | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index d1955c7aee3d..8d08a3d44302 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -45,23 +45,33 @@ class KBuildJob:
         self.jobid = None
         self.node = node
         self.logger = logger
+        self.binder = None
         self.builddir = os.path.dirname(kdir)
         self.objdir = "%s/node%d" % (self.builddir, int(node))
+
         if not os.path.isdir(self.objdir):
             os.mkdir(self.objdir)
+
         if os.path.exists('/usr/bin/numactl') and not cpulist:
+            """ Use numactl """
             self.binder = 'numactl --cpunodebind %d' % int(self.node)
-        else:
-            self.binder = 'taskset -c %s' % compress_cpulist(cpulist)
-        if cpulist:
+            self.jobs = self.calc_jobs_per_cpu() * len(self.node)
+        elif cpulist:
+            """ Use taskset """
             self.jobs = self.calc_jobs_per_cpu() * len(cpulist)
+            self.binder = 'taskset -c %s' % compress_cpulist(cpulist)
         else:
+            """ Without numactl calculate number of jobs from the node """
             self.jobs = self.calc_jobs_per_cpu() * len(self.node)
+
+        self.runcmd = f"make O={self.objdir} -C {self.kdir} -j{self.jobs}"
+        self.cleancmd = f"make O={self.objdir} -C {self.kdir} clean allmodconfig"
+        if self.binder:
+            self.runcmd = self.binder + " " + self.runcmd
+            self.cleancmd = self.binder + " " + self.cleancmd
+
         self.log(Log.DEBUG, "node %d: jobs == %d" % (int(node), self.jobs))
-        self.runcmd = "%s make O=%s -C %s -j%d" \
-                % (self.binder, self.objdir, self.kdir, self.jobs)
-        self.cleancmd = "%s make O=%s -C %s clean allmodconfig" \
-                % (self.binder, self.objdir, self.kdir)
+        self.log(Log.DEBUG, f"cleancmd = {self.cleancmd}")
         self.log(Log.DEBUG, "node%d kcompile command: %s" \
                 % (int(node), self.runcmd))
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-09 19:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09 19:32 [PATCH] rteval: kcompile: Fix for no numactl and no cpulist John Kacur

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.