util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 2/2] lscpu-arm: Remove hard corded model name of Cortex family and X-Gene
@ 2020-11-10  5:19 Jeremy Linton
  2020-11-10  8:37 ` Karel Zak
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Linton @ 2020-11-10  5:19 UTC (permalink / raw)
  To: util-linux; +Cc: Jeffrey Bastian, msys.mizuma, m.mizuma

Hi,

(sorry about the threading problem, I wasn't a linux-util subscriber)

It appears you are removing much of the hard coded cpu part number lists.

I don't agree with this, I think the hard coded table should be the 
first authority on the manufacture/part number lists. That is because 
SMBIOS isn't available on a fairly large number of arm systems, and on 
systems where it does exist, it suffers from the same kinds of problems 
that exist on many !arm machines. Its not particularly a reliable source 
of information.

So, maybe if you have a situation where the SMBIOS information is more 
correct than the hardcoded tables, maybe its a good idea to create a new 
line?


Aka:

Vendor Id: ARM
Model Name: Cortex-A57
BIOS Name: JoeSmithsCore


In the vast majority of cases I imagine the strings should match. The 
problematic cases are LTS os's running on newer hardware. For that i'm 
somewhat of the opinion the Model Name should remain "unknown" rather 
than being silently updated. That is to avoid cases where the output 
from newer lscpu's changes during an upgrade.

PS, Having this hardcoded table isn't optimal, but for now I think we 
are stuck with it. Hopefully at some point we can work out a reliable 
way to source the info. In the meantime, it looks like I need to submit 
some table updates, since there are some newer arm models...


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH v4 1/2] lscpu-arm: Set the order to search the model name
@ 2020-11-09  3:04 Masayoshi Mizuma
  2020-11-09  3:04 ` [PATCH v4 2/2] lscpu-arm: Remove hard corded model name of Cortex family and X-Gene Masayoshi Mizuma
  0 siblings, 1 reply; 9+ messages in thread
From: Masayoshi Mizuma @ 2020-11-09  3:04 UTC (permalink / raw)
  To: util-linux, jbastian; +Cc: Masayoshi Mizuma, Masayoshi Mizuma

From: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>

After commit: 367c85c47 ("lscpu: use SMBIOS tables on ARM for lscpu"),
Model name for A64FX shows like as:

   Model name:       461F0010

That's because 367c85c47 changes to get the modelname from Processor
Version of SMBIOS.

The SMBIOS info would be great if the system is based on SBBR v1.2E and
BBR v1.0 because the specs require the Processor Version of SMBIOS
as "This field must provide a human readable description of the processor
part number".

However, it's not good for the systems aren't based on the specs,
like A64FX. Such systems need to have the model name to the hard
corded table.

Let's set the order; first, search the hard corded table, then SMBIOS.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
---
 sys-utils/lscpu-arm.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/sys-utils/lscpu-arm.c b/sys-utils/lscpu-arm.c
index 20c7291e5..3f258a710 100644
--- a/sys-utils/lscpu-arm.c
+++ b/sys-utils/lscpu-arm.c
@@ -288,6 +288,7 @@ static int __arm_cpu_smbios(struct lscpu_desc *desc)
 	struct lscpu_dmi_header h;
 	int fd;
 	ssize_t rs;
+	int use_smbios = 0;
 
 	fd = open(_PATH_SYS_DMI_TYPE4, O_RDONLY);
 	if (fd < 0)
@@ -301,16 +302,21 @@ static int __arm_cpu_smbios(struct lscpu_desc *desc)
 
 	to_dmi_header(&h, data);
 
-	str = dmi_string(&h, data[PROC_MFR_OFFSET]);
-	if (str) {
-		xstrncpy(buf, str, 127);
-		desc->vendor = xstrdup(buf);
+	if (!desc->modelname) {
+		str = dmi_string(&h, data[PROC_VERSION_OFFSET]);
+		if (str) {
+			xstrncpy(buf, str, 127);
+			desc->modelname = xstrdup(buf);
+			use_smbios = 1;
+		}
 	}
 
-	str = dmi_string(&h, data[PROC_VERSION_OFFSET]);
-	if (str) {
-		xstrncpy(buf, str, 127);
-		desc->modelname = xstrdup(buf);
+	if ((startswith(desc->vendor, "0x")) || use_smbios) {
+		str = dmi_string(&h, data[PROC_MFR_OFFSET]);
+		if (str) {
+			xstrncpy(buf, str, 127);
+			desc->vendor = xstrdup(buf);
+		}
 	}
 
 	return 0;
@@ -318,14 +324,11 @@ static int __arm_cpu_smbios(struct lscpu_desc *desc)
 
 void arm_cpu_decode(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 {
-	int rc = -1;
+	__arm_cpu_decode(desc);
 
 	/* use SMBIOS Type 4 data if available,
 	 * else fall back to manual decoding using the tables above */
 	if (mod->system == SYSTEM_LIVE &&
 	    access(_PATH_SYS_DMI_TYPE4, R_OK) == 0)
-		rc = __arm_cpu_smbios(desc);
-
-	if (rc)
-		__arm_cpu_decode(desc);
+		__arm_cpu_smbios(desc);
 }
-- 
2.27.0


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

end of thread, other threads:[~2020-11-11  8:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  5:19 [PATCH v4 2/2] lscpu-arm: Remove hard corded model name of Cortex family and X-Gene Jeremy Linton
2020-11-10  8:37 ` Karel Zak
2020-11-10 18:50   ` Masayoshi Mizuma
2020-11-10 20:50     ` Jeffrey Bastian
2020-11-11  8:42       ` Karel Zak
  -- strict thread matches above, loose matches on Subject: below --
2020-11-09  3:04 [PATCH v4 1/2] lscpu-arm: Set the order to search the model name Masayoshi Mizuma
2020-11-09  3:04 ` [PATCH v4 2/2] lscpu-arm: Remove hard corded model name of Cortex family and X-Gene Masayoshi Mizuma
2020-11-09 16:23   ` Karel Zak
2020-11-09 18:51     ` Masayoshi Mizuma
2020-11-10  8:04       ` Karel Zak

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