test suite reviews and discussions
 help / color / mirror / Atom feed
* [PATCH v1] framework: fix getting single cpu information on freebsd
@ 2023-06-01  6:01 Daxue Gao
  2023-06-07  7:52 ` lijuan.tu
  0 siblings, 1 reply; 2+ messages in thread
From: Daxue Gao @ 2023-06-01  6:01 UTC (permalink / raw)
  To: dts; +Cc: Daxue Gao

Fix to get cpu information on freebsd,
when the machine has only one cpu,
It cannot match the number of cpus,cores,threads.
Such as:
<groups>
 <group level="1" cache-level="0">
  <cpu count="8" mask="ff,0,0,0">0, 1, 2, 3, 4, 5, 6, 7</cpu>
 </group>
</groups>

Signed-off-by: Daxue Gao <daxuex.gao@intel.com>
---
 framework/crb.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/framework/crb.py b/framework/crb.py
index 4ffee558..9e3b0a58 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -721,9 +721,21 @@ class Crb(object):
         socket_id = 0
 
         sockets = cpu_xml.findall(".//group[@level='2']")
+        if not sockets:
+            sockets = cpu_xml.findall(".//group[@level='1']")
         for socket in sockets:
             core_id = 0
             core_elements = socket.findall(".//children/group/cpu")
+            if not core_elements:
+                core_elements = socket.findall("./cpu")
+                for core in core_elements:
+                    cores = [int(x) for x in core.text.split(",")]
+                for core in cores:
+                    if self.crb["bypass core0"] and core == 0:
+                        continue
+                    self.cores.append(
+                        {"socket": socket_id, "core": core, "thread": core}
+                    )
             for core in core_elements:
                 threads = [int(x) for x in core.text.split(",")]
                 for thread in threads:
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-07  7:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01  6:01 [PATCH v1] framework: fix getting single cpu information on freebsd Daxue Gao
2023-06-07  7:52 ` lijuan.tu

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).