From: Daxue Gao <daxuex.gao@intel.com>
To: dts@dpdk.org
Cc: Daxue Gao <daxuex.gao@intel.com>
Subject: [PATCH v1] framework: fix getting single cpu information on freebsd
Date: Thu, 1 Jun 2023 14:01:25 +0800 [thread overview]
Message-ID: <20230601060125.13278-1-daxuex.gao@intel.com> (raw)
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
next reply other threads:[~2023-06-01 6:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 6:01 Daxue Gao [this message]
2023-06-07 7:52 ` lijuan.tu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230601060125.13278-1-daxuex.gao@intel.com \
--to=daxuex.gao@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).