[rteval PATCH v2 0/3] Make rteval usable on arm, arm64 and i386

STALE2013d

8 messages, 2 authors, 2021-03-05 · open the first message on its own page

[rteval PATCH v2 0/3] Make rteval usable on arm, arm64 and i386

From: Punit Agrawal <hidden>
Date: 2021-02-24 02:18:47

Hi,

This is an updated version of the series to improve support of rteval
on arm, arm64 and i386. Previous version can be found at [0].

Changes -
* The biggest change in this version is to improve the logic to
  construct CPU description on arm and arm64 architectures. The
  changes also incorporate feedback from John on the previous version.

* Include the patch to systopology.py required on systems that do not
  have numa domains. The patch was previously posted separately at [1].

Feedback welcome.

Thanks,
Punit


[0] https://lore.kernel.org/linux-rt-users/20210126021241.112944-1-punit1.agrawal@toshiba.co.jp/
[1] https://lore.kernel.org/linux-rt-users/20210127083412.118047-1-punit1.agrawal@toshiba.co.jp/

Punit Agrawal (3):
  rteval: cyclictest.py: Update logic to get core description
  rteval: cyclictest.py: Make build targets architecture independent
  rteval: systopology.py: Add support for systems that don't have Numa

 rteval/misc.py                           | 24 ++++++++++++++-
 rteval/modules/loads/kcompile.py         |  2 +-
 rteval/modules/measurement/cyclictest.py |  8 +++--
 rteval/systopology.py                    | 38 ++++++++++++++++++++----
 4 files changed, 61 insertions(+), 11 deletions(-)

-- 
2.30.0

[rteval PATCH v2 1/3] rteval: cyclictest.py: Update logic to get core description

From: Punit Agrawal <hidden>
Date: 2021-02-24 02:18:47

Certain architectures such as arm and arm64 don't have a "model name"
in /proc/cpuinfo but provide other identifying information such as
implementer, architecture, variant, part, revision, etc..

Add a function 'get_cpumodel()' that takes the per-core dictionary
constructed from /proc/cpuinfo and uses the available data to
construct the CPU description. Update the users of "model name" to use
the newly added function.

Signed-off-by: Punit Agrawal <redacted>
---
 rteval/misc.py                           | 24 +++++++++++++++++++++++-
 rteval/modules/measurement/cyclictest.py |  8 +++++---
 2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/rteval/misc.py b/rteval/misc.py
index 0dd361f..c3ca354 100644
--- a/rteval/misc.py
+++ b/rteval/misc.py
@@ -79,6 +79,28 @@ def cpuinfo():
         info[core][key] = val
     return info
 
+# Pass the per-core dictionary that is part of the dictionary returned
+# by cpuinfo()
+def get_cpumodel(core_info):
+    desc = info[core].get('model name', '')
+    if not desc:
+        # On Arm (both 32 and 64 bit), 'CPU Implementer' is always
+        # present. Return 'unknown' otherwise
+        if 'CPU Implementer' not in info[core]:
+            desc = 'unknown'
+            break
+
+        implementor = core_info.get('CPU implementer', '')
+        architecture = core_info.get('CPU architecture', '')
+        variant = core_info.get('CPU variant', '')
+        part = core_info.get('CPU part', '')
+        revision = core_info.get('CPU revision', '')
+
+        desc = 'Implementor: %s Architecture: %s Variant: %s Part: %s Revision: %s' \
+            % (implementor, architecture, variant, part, revision)
+
+    return desc
+
 if __name__ == "__main__":
 
     info = cpuinfo()
@@ -86,4 +108,4 @@ if __name__ == "__main__":
     for i in idx:
         print("%s: %s" % (i, info[i]))
 
-    print("0: %s" % (info['0']['model name']))
+    print("0: %s" % (get_cpumodel(info['0'])))
diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py
index 232bd6b..c9e1dfb 100644
--- a/rteval/modules/measurement/cyclictest.py
+++ b/rteval/modules/measurement/cyclictest.py
@@ -34,7 +34,7 @@ import math
 import libxml2
 from rteval.Log import Log
 from rteval.modules import rtevalModulePrototype
-from rteval.misc import expand_cpulist, online_cpus, cpuinfo
+from rteval.misc import expand_cpulist, online_cpus, cpuinfo, get_cpumodel
 
 class RunData:
     '''class to keep instance data from a cyclictest run'''
@@ -217,13 +217,15 @@ class Cyclictest(rtevalModulePrototype):
         for core in self.__cpus:
             self.__cyclicdata[core] = RunData(core, 'core', self.__priority,
                                               logfnc=self._log)
-            self.__cyclicdata[core].description = info[core]['model name']
+            self.__cyclicdata[core].description = get_cpumodel(info[core])
+            if self.__cyclicdata[core].description == 'unknown':
+                self._log(Log.INFO, "Unknown model for core %d" % core)
 
         # Create a RunData object for the overall system
         self.__cyclicdata['system'] = RunData('system',
                                               'system', self.__priority,
                                               logfnc=self._log)
-        self.__cyclicdata['system'].description = ("(%d cores) " % self.__numcores) + info['0']['model name']
+        self.__cyclicdata['system'].description = ("(%d cores) " % self.__numcores) + get_cpumodel(info['0'])
 
         if self.__sparse:
             self._log(Log.DEBUG, "system using %d cpu cores" % self.__numcores)
-- 
2.30.0

[rteval PATCH v2 3/3] rteval: systopology.py: Add support for systems that don't have Numa

From: Punit Agrawal <hidden>
Date: 2021-02-24 02:18:47

Certain systems such as Arm v7 do not have support for Numa nodes,
i.e., "/sys/devices/system/node*" does not exist. Instead of erroring
out in this situation, it would be better if rteval could use
alternate sources to get the system topology and memory information.

Introduce the notion of a fake Numa node (as a class) which is used
when no numa nodes are found on the system. Other than the
constructor, it provides the same interface as the existing NumaNode
class so existing users should work without any changes.

Signed-off-by: Punit Agrawal <redacted>
---
 rteval/systopology.py | 38 ++++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/rteval/systopology.py b/rteval/systopology.py
index c61ec1a..7ce9a8c 100644
--- a/rteval/systopology.py
+++ b/rteval/systopology.py
@@ -191,6 +191,31 @@ class NumaNode:
         """ return list of cpus for this node """
         return self.cpus.getcpulist()
 
+class FakeNumaNode(NumaNode):
+    """class representing a fake NUMA node. The fake NUMA node is used on
+    systems which don't have NUMA enabled (no
+    /sys/devices/system/node) such as Arm v7
+
+    """
+
+    cpupath = '/sys/devices/system/cpu'
+    mempath = '/proc/meminfo'
+
+    def __init__(self):
+        self.nodeid = 0
+        self.cpus = CpuList(sysread(FakeNumaNode.cpupath, "possible"))
+        self.getmeminfo()
+
+    def getmeminfo(self):
+        self.meminfo = {}
+        for l in open(FakeNumaNode.mempath, "r"):
+            elements = l.split()
+            key = elements[0][0:-1]
+            val = int(elements[1])
+            if len(elements) == 3 and elements[2] == "kB":
+                val *= 1024
+            self.meminfo[key] = val
+
 #
 # Class to abstract the system topology of numa nodes and cpus
 #
@@ -238,12 +263,13 @@ class SysTopology:
 
     def getinfo(self):
         nodes = glob.glob(os.path.join(SysTopology.nodepath, 'node[0-9]*'))
-        if not nodes:
-            raise RuntimeError("No valid nodes found in %s!" % SysTopology.nodepath)
-        nodes.sort()
-        for n in nodes:
-            node = int(os.path.basename(n)[4:])
-            self.nodes[node] = NumaNode(n)
+        if nodes:
+            nodes.sort()
+            for n in nodes:
+                node = int(os.path.basename(n)[4:])
+                self.nodes[node] = NumaNode(n)
+        else:
+            self.nodes[0] = FakeNumaNode()
 
     def getnodes(self):
         return list(self.nodes.keys())
-- 
2.30.0

[rteval PATCH v2 2/3] rteval: cyclictest.py: Make build targets architecture independent

From: Punit Agrawal <hidden>
Date: 2021-02-24 02:18:57

Not all kernel archiectures provide the "bzImage" target, e.g., arm64
provides "Image" which generates an uncompressed kernel binary.

Instead of going down the path of customizing build targets
per-architecture, let's drop them altogether. The default kernel
target should build the kernel and modules on all architectures
anyways.

Signed-off-by: Punit Agrawal <redacted>
---
 rteval/modules/loads/kcompile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index 326f1ae..e747b9f 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -58,7 +58,7 @@ class KBuildJob:
         else:
             self.jobs = self.calc_jobs_per_cpu() * len(self.node)
         self.log(Log.DEBUG, "node %d: jobs == %d" % (int(node), self.jobs))
-        self.runcmd = "%s make O=%s -C %s -j%d bzImage modules" \
+        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)
-- 
2.30.0

Re: [rteval PATCH v2 2/3] rteval: cyclictest.py: Make build targets architecture independent

From: John Kacur <jkacur@redhat.com>
Date: 2021-03-03 06:32:33


On Wed, 24 Feb 2021, Punit Agrawal wrote:
quoted hunk
Not all kernel archiectures provide the "bzImage" target, e.g., arm64
provides "Image" which generates an uncompressed kernel binary.

Instead of going down the path of customizing build targets
per-architecture, let's drop them altogether. The default kernel
target should build the kernel and modules on all architectures
anyways.

Signed-off-by: Punit Agrawal <redacted>
---
 rteval/modules/loads/kcompile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index 326f1ae..e747b9f 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -58,7 +58,7 @@ class KBuildJob:
         else:
             self.jobs = self.calc_jobs_per_cpu() * len(self.node)
         self.log(Log.DEBUG, "node %d: jobs == %d" % (int(node), self.jobs))
-        self.runcmd = "%s make O=%s -C %s -j%d bzImage modules" \
+        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)
-- 
2.30.0
Signed-off-by: John Kacur <jkacur@redhat.com>

Re: [rteval PATCH v2 2/3] rteval: cyclictest.py: Make build targets architecture independent

From: Punit Agrawal <hidden>
Date: 2021-03-04 06:57:09

John Kacur [off-list ref] writes:
On Wed, 24 Feb 2021, Punit Agrawal wrote:
quoted
Not all kernel archiectures provide the "bzImage" target, e.g., arm64
provides "Image" which generates an uncompressed kernel binary.

Instead of going down the path of customizing build targets
per-architecture, let's drop them altogether. The default kernel
target should build the kernel and modules on all architectures
anyways.

Signed-off-by: Punit Agrawal <redacted>
---
 rteval/modules/loads/kcompile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index 326f1ae..e747b9f 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -58,7 +58,7 @@ class KBuildJob:
         else:
             self.jobs = self.calc_jobs_per_cpu() * len(self.node)
         self.log(Log.DEBUG, "node %d: jobs == %d" % (int(node), self.jobs))
-        self.runcmd = "%s make O=%s -C %s -j%d bzImage modules" \
+        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)
-- 
2.30.0
Signed-off-by: John Kacur <jkacur@redhat.com>
Hi John,

Thanks for picking up this patch.

Just wanted to make sure about the status of the other 2 patches in the
set - 1/3 and 3/3, I am assuming they're on your TODO but haven't had a
chance to confirm yet.

Let me know if that's not the case for some reason.

Thanks,
Punit

Re: [rteval PATCH v2 2/3] rteval: cyclictest.py: Make build targets architecture independent

From: John Kacur <jkacur@redhat.com>
Date: 2021-03-04 15:50:28


On Thu, 4 Mar 2021, Punit Agrawal wrote:
John Kacur [off-list ref] writes:
quoted
On Wed, 24 Feb 2021, Punit Agrawal wrote:
quoted
Not all kernel archiectures provide the "bzImage" target, e.g., arm64
provides "Image" which generates an uncompressed kernel binary.

Instead of going down the path of customizing build targets
per-architecture, let's drop them altogether. The default kernel
target should build the kernel and modules on all architectures
anyways.

Signed-off-by: Punit Agrawal <redacted>
---
 rteval/modules/loads/kcompile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index 326f1ae..e747b9f 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -58,7 +58,7 @@ class KBuildJob:
         else:
             self.jobs = self.calc_jobs_per_cpu() * len(self.node)
         self.log(Log.DEBUG, "node %d: jobs == %d" % (int(node), self.jobs))
-        self.runcmd = "%s make O=%s -C %s -j%d bzImage modules" \
+        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)
-- 
2.30.0
Signed-off-by: John Kacur <jkacur@redhat.com>
Hi John,

Thanks for picking up this patch.

Just wanted to make sure about the status of the other 2 patches in the
set - 1/3 and 3/3, I am assuming they're on your TODO but haven't had a
chance to confirm yet.

Let me know if that's not the case for some reason.

Thanks,
Punit
Yes, they are on my TODO list, I will get to them.
I will probably take the patch that deal with the model name, after I 
convince myself that it won't break anything else.

I don't really like the idea of a fake NUMA node to deal with rteval
on non-NUMA machines, but I am open to ideas to get rteval working
on such machines. On my list to give you feedback.

Thanks

John

Re: [rteval PATCH v2 2/3] rteval: cyclictest.py: Make build targets architecture independent

From: Punit Agrawal <hidden>
Date: 2021-03-05 01:34:17

John Kacur [off-list ref] writes:
On Thu, 4 Mar 2021, Punit Agrawal wrote:
quoted
John Kacur [off-list ref] writes:
quoted
On Wed, 24 Feb 2021, Punit Agrawal wrote:
quoted
Not all kernel archiectures provide the "bzImage" target, e.g., arm64
provides "Image" which generates an uncompressed kernel binary.

Instead of going down the path of customizing build targets
per-architecture, let's drop them altogether. The default kernel
target should build the kernel and modules on all architectures
anyways.

Signed-off-by: Punit Agrawal <redacted>
---
 rteval/modules/loads/kcompile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index 326f1ae..e747b9f 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -58,7 +58,7 @@ class KBuildJob:
         else:
             self.jobs = self.calc_jobs_per_cpu() * len(self.node)
         self.log(Log.DEBUG, "node %d: jobs == %d" % (int(node), self.jobs))
-        self.runcmd = "%s make O=%s -C %s -j%d bzImage modules" \
+        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)
-- 
2.30.0
Signed-off-by: John Kacur <jkacur@redhat.com>
Hi John,

Thanks for picking up this patch.

Just wanted to make sure about the status of the other 2 patches in the
set - 1/3 and 3/3, I am assuming they're on your TODO but haven't had a
chance to confirm yet.

Let me know if that's not the case for some reason.

Thanks,
Punit
Yes, they are on my TODO list, I will get to them.
I will probably take the patch that deal with the model name, after I 
convince myself that it won't break anything else.

I don't really like the idea of a fake NUMA node to deal with rteval
on non-NUMA machines, but I am open to ideas to get rteval working
on such machines. On my list to give you feedback.
I am not too attached to the fake NUMA node either. The resulting patch
seemed like the least invasive way to make rteval more inclusive on
non-NUMA architectures.

I am open to alternate ways to enable this functionality. I'll look out
for your feedback once you've taken a closer look.

[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help