* [PATCH 1/3] rteval: Only process warnings if dmidecode_loaded is True
@ 2021-09-09 13:03 John Kacur
2021-09-09 13:03 ` [PATCH 2/3] rteval: Construct a 'model name' on architectures that don't have one John Kacur
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: John Kacur @ 2021-09-09 13:03 UTC (permalink / raw)
To: RT, Clark Williams; +Cc: John Kacur
If python-dmidecode is not available, then you can't test hasattr
or you will get a NameError. Simply return instead.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
rteval/sysinfo/dmi.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/rteval/sysinfo/dmi.py b/rteval/sysinfo/dmi.py
index bd397360096a..80cf3c723b36 100644
--- a/rteval/sysinfo/dmi.py
+++ b/rteval/sysinfo/dmi.py
@@ -42,6 +42,9 @@ except ModuleNotFoundError:
def ProcessWarnings():
""" Process Warnings from dmidecode """
+ if not dmidecode_loaded:
+ return
+
if not hasattr(dmidecode, 'get_warnings'):
return
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] rteval: Construct a 'model name' on architectures that don't have one
2021-09-09 13:03 [PATCH 1/3] rteval: Only process warnings if dmidecode_loaded is True John Kacur
@ 2021-09-09 13:03 ` John Kacur
2021-09-09 13:03 ` [PATCH 3/3] rteval: systopology.py: Add support for systems that don't have Numa John Kacur
2021-09-13 5:39 ` [PATCH 1/3] rteval: Only process warnings if dmidecode_loaded is True Punit Agrawal
2 siblings, 0 replies; 5+ messages in thread
From: John Kacur @ 2021-09-09 13:03 UTC (permalink / raw)
To: RT, Clark Williams; +Cc: root, Punit Agrawal, John Kacur
From: root <root@hpe-apollo-cn99xx-15-vm-19.khw4.lab.eng.bos.redhat.com>
This is based on an idea from Punit Agrawal <punit1.agrawal@toshiba.co.jp>
On architectures that lack 'model name' in /proc/cpuinfo
create 'model name' Unknown when creating the per core dictionaries
in cpuinfo
For arm, we can construct the 'model name' from the
'CPU implementer'
'CPU architecture'
'CPU variant'
'CPU part'
'CPU revision'
Suggested-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
rteval/misc.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/rteval/misc.py b/rteval/misc.py
index 0dd361ff19fd..016fc7c4b494 100644
--- a/rteval/misc.py
+++ b/rteval/misc.py
@@ -77,6 +77,27 @@ def cpuinfo():
info[core] = {}
continue
info[core][key] = val
+
+ for (core, dict) in info.items():
+ if not 'model name' in dict:
+ # On Arm CPU implementer is present
+ # Construct the model_name from the following fields
+ if 'CPU implementer' in dict:
+ model_name = [dict.get('CPU implementer')]
+ model_name.append(dict.get('CPU architecture'))
+ model_name.append(dict.get('CPU variant'))
+ model_name.append(dict.get('CPU part'))
+ model_name.append(dict.get('CPU revision', ''))
+
+ # If a list item is None, remove it
+ model_name = [name for name in model_name if name]
+
+ # Convert the model_name list into a string
+ model_name = " ".join(model_name)
+ info[core]['model name'] = model_name
+ else:
+ info[core]['model name'] = 'Unknown'
+
return info
if __name__ == "__main__":
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] rteval: systopology.py: Add support for systems that don't have Numa
2021-09-09 13:03 [PATCH 1/3] rteval: Only process warnings if dmidecode_loaded is True John Kacur
2021-09-09 13:03 ` [PATCH 2/3] rteval: Construct a 'model name' on architectures that don't have one John Kacur
@ 2021-09-09 13:03 ` John Kacur
2021-09-13 6:02 ` Punit Agrawal
2021-09-13 5:39 ` [PATCH 1/3] rteval: Only process warnings if dmidecode_loaded is True Punit Agrawal
2 siblings, 1 reply; 5+ messages in thread
From: John Kacur @ 2021-09-09 13:03 UTC (permalink / raw)
To: RT, Clark Williams; +Cc: Punit Agrawal, John Kacur
From: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
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 <punit1.agrawal@toshiba.co.jp>
- Renamed Fake to Sim for simulated
Signed-off-by: John Kacur <jkacur@redhat.com>
---
rteval/systopology.py | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/rteval/systopology.py b/rteval/systopology.py
index c61ec1a58514..3c996048f8c1 100644
--- a/rteval/systopology.py
+++ b/rteval/systopology.py
@@ -191,6 +191,30 @@ class NumaNode:
""" return list of cpus for this node """
return self.cpus.getcpulist()
+class SimNumaNode(NumaNode):
+ """class representing a simulated NUMA node.
+ For 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(SimNumaNode.cpupath, "possible"))
+ self.getmeminfo()
+
+ def getmeminfo(self):
+ self.meminfo = {}
+ for l in open(SimNumaNode.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 +262,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] = SimNumaNode()
def getnodes(self):
return list(self.nodes.keys())
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] rteval: Only process warnings if dmidecode_loaded is True
2021-09-09 13:03 [PATCH 1/3] rteval: Only process warnings if dmidecode_loaded is True John Kacur
2021-09-09 13:03 ` [PATCH 2/3] rteval: Construct a 'model name' on architectures that don't have one John Kacur
2021-09-09 13:03 ` [PATCH 3/3] rteval: systopology.py: Add support for systems that don't have Numa John Kacur
@ 2021-09-13 5:39 ` Punit Agrawal
2 siblings, 0 replies; 5+ messages in thread
From: Punit Agrawal @ 2021-09-13 5:39 UTC (permalink / raw)
To: John Kacur; +Cc: RT, Clark Williams
John Kacur <jkacur@redhat.com> writes:
> If python-dmidecode is not available, then you can't test hasattr
> or you will get a NameError. Simply return instead.
>
> Signed-off-by: John Kacur <jkacur@redhat.com>
> ---
> rteval/sysinfo/dmi.py | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/rteval/sysinfo/dmi.py b/rteval/sysinfo/dmi.py
> index bd397360096a..80cf3c723b36 100644
> --- a/rteval/sysinfo/dmi.py
> +++ b/rteval/sysinfo/dmi.py
> @@ -42,6 +42,9 @@ except ModuleNotFoundError:
> def ProcessWarnings():
> """ Process Warnings from dmidecode """
>
> + if not dmidecode_loaded:
> + return
> +
> if not hasattr(dmidecode, 'get_warnings'):
> return
Tested after purging python3-dmidecode package on Debian.
Tested-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Thanks,
Punit
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] rteval: systopology.py: Add support for systems that don't have Numa
2021-09-09 13:03 ` [PATCH 3/3] rteval: systopology.py: Add support for systems that don't have Numa John Kacur
@ 2021-09-13 6:02 ` Punit Agrawal
0 siblings, 0 replies; 5+ messages in thread
From: Punit Agrawal @ 2021-09-13 6:02 UTC (permalink / raw)
To: John Kacur; +Cc: RT, Clark Williams, Punit Agrawal
John Kacur <jkacur@redhat.com> writes:
> From: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
>
> 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 <punit1.agrawal@toshiba.co.jp>
> - Renamed Fake to Sim for simulated
> Signed-off-by: John Kacur <jkacur@redhat.com>
> ---
> rteval/systopology.py | 37 +++++++++++++++++++++++++++++++------
> 1 file changed, 31 insertions(+), 6 deletions(-)
>
> diff --git a/rteval/systopology.py b/rteval/systopology.py
> index c61ec1a58514..3c996048f8c1 100644
> --- a/rteval/systopology.py
> +++ b/rteval/systopology.py
> @@ -191,6 +191,30 @@ class NumaNode:
> """ return list of cpus for this node """
> return self.cpus.getcpulist()
>
> +class SimNumaNode(NumaNode):
> + """class representing a simulated NUMA node.
> + For 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(SimNumaNode.cpupath, "possible"))
> + self.getmeminfo()
> +
> + def getmeminfo(self):
> + self.meminfo = {}
> + for l in open(SimNumaNode.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 +262,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] = SimNumaNode()
>
> def getnodes(self):
> return list(self.nodes.keys())
The name changes look good and passed a test run of rteval on a system
with no numa nodes.
Thanks,
Punit
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-09-13 6:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-09 13:03 [PATCH 1/3] rteval: Only process warnings if dmidecode_loaded is True John Kacur
2021-09-09 13:03 ` [PATCH 2/3] rteval: Construct a 'model name' on architectures that don't have one John Kacur
2021-09-09 13:03 ` [PATCH 3/3] rteval: systopology.py: Add support for systems that don't have Numa John Kacur
2021-09-13 6:02 ` Punit Agrawal
2021-09-13 5:39 ` [PATCH 1/3] rteval: Only process warnings if dmidecode_loaded is True Punit Agrawal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).