Skip to contentSkip to conversation

LoongArch: cpuinfo: standardize the "model name" field

PATCH NAK Enze Li 3 participants 12 messages Mar 22, 2023 – Mar 23, 2023 LoongArch

lore
Share & tools
lore

Enze Li

author
#0 lore raw

PATCH 1/1 LoongArch: cpuinfo: standardize the "model name" field

When I use the latest version of lscpu to check my CPU info, I see,

======

Architecture:          loongarch64
  Byte Order:          Little Endian
CPU(s):                4
  On-line CPU(s) list: 0-3
Model name:            -
  Thread(s) per core:  1
  Core(s) per socket:  4

...
======

Obviously, the "Model name" field shows me with a "-", which means the lscpu failed to retrieve the correct information from the /proc/cpuinfo file.

The main problem is that, the lscpu only identifies the data by its "model name" field. However, on the LoongArch platform, only 'Model Name' is provided, which cannot be accurately identified due to case sensitivity issues. And I think that must be an oversight.

This patch fixes this issue. With this patch applied, I get,

======

Architecture:          loongarch64
  Byte Order:          Little Endian
CPU(s):                4
  On-line CPU(s) list: 0-3
Model name:            Loongson-3A5000-HV
  Thread(s) per core:  1
  Core(s) per socket:  4

...
======

---
 arch/loongarch/kernel/proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/proc.c +1 -1
index 5c67cc4fd56d..7da56f9ee15c 100644
@@ -50,7 +50,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 	seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
 	seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
 	seq_printf(m, "CPU Family\t\t: %s\n", __cpu_family[n]);
-	seq_printf(m, "Model Name\t\t: %s\n", __cpu_full_name[n]);
+	seq_printf(m, "model name\t\t: %s\n", __cpu_full_name[n]);
 	seq_printf(m, "CPU Revision\t\t: 0x%02x\n", version);
 	seq_printf(m, "FPU Revision\t\t: 0x%02x\n", fp_version);
 	seq_printf(m, "CPU MHz\t\t\t: %llu.%02llu\n",

base-commit: fc89d7fb499b0162e081f434d45e8d1b47e82ece

Signature · 1 line
2.34.1
#1 lore raw
Quoted 18 lines · Enze Li

When I use the latest version of lscpu to check my CPU info, I see,

======
Architecture:          loongarch64
  Byte Order:          Little Endian
CPU(s):                4
  On-line CPU(s) list: 0-3
Model name:            -
  Thread(s) per core:  1
  Core(s) per socket:  4
...
======

Obviously, the "Model name" field shows me with a "-", which means the lscpu failed to retrieve the correct information from the /proc/cpuinfo
file.

Quoted 4 lines

The main problem is that, the lscpu only identifies the data by its "model name" field.  However, on the LoongArch platform, only 'Model Name' is provided, which cannot be accurately identified due to case sensitivity issues.  And I think that must be an oversight.

If I read lscpu code correctly, it also matches "cpu MHz" (instead of "CPU MHz"), "address sizes" (instead of "Address Sizes"), "features" (instead of "Features"), "cpu family" (instead of "CPU Family"), and "CPU revision" (instead of "CPU Revision"). Maybe you want to "fix" them as well.

But this is just strange: both "CPU" and "MHz" are some sort of abbreviations ("Central Process Unit" and "Mega Hertz") so why "cpu" should be lower case but "MHz" should not? And why "CPU revision" but "cpu MHz"?

To me it's a util-linux bug. Can you report it at
https://github.com/util-linux/util-linux/issues and let's wait for the response from util-linux maintainers?

Quoted 34 lines

This patch fixes this issue.  With this patch applied, I get,

======
Architecture:          loongarch64
  Byte Order:          Little Endian
CPU(s):                4
  On-line CPU(s) list: 0-3
Model name:            Loongson-3A5000-HV
  Thread(s) per core:  1
  Core(s) per socket:  4
...
======

---
 arch/loongarch/kernel/proc.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/proc.c +1 -1
index 5c67cc4fd56d..7da56f9ee15c 100644
@@ -50,7 +50,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
         seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
         seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
         seq_printf(m, "CPU Family\t\t: %s\n", __cpu_family[n]);
-       seq_printf(m, "Model Name\t\t: %s\n", __cpu_full_name[n]);
+       seq_printf(m, "model name\t\t: %s\n", __cpu_full_name[n]);
         seq_printf(m, "CPU Revision\t\t: 0x%02x\n", version);
         seq_printf(m, "FPU Revision\t\t: 0x%02x\n", fp_version);
         seq_printf(m, "CPU MHz\t\t\t: %llu.%02llu\n",

base-commit: fc89d7fb499b0162e081f434d45e8d1b47e82ece

Signature · 2 lines
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University
author
#2 lore raw

Hi Ruoyao,

It's very kind of you to have this review. :)

Please see below.

Quoted 27 lines · Xi Ruoyao
Quoted 19 lines · Enze Li

When I use the latest version of lscpu to check my CPU info, I see,

======

Architecture:          loongarch64
  Byte Order:          Little Endian
CPU(s):                4
  On-line CPU(s) list: 0-3
Model name:            -
  Thread(s) per core:  1
  Core(s) per socket:  4

...
======

Obviously, the "Model name" field shows me with a "-", which means the
lscpu failed to retrieve the correct information from the /proc/cpuinfo
file.

Quoted 6 lines

The main problem is that, the lscpu only identifies the data by its "model name" field. However, on the LoongArch platform, only 'Model
Name' is provided, which cannot be accurately identified due to case
sensitivity issues. And I think that must be an oversight.

Quoted 5 lines

If I read lscpu code correctly, it also matches "cpu MHz" (instead of "CPU MHz"), "address sizes" (instead of "Address Sizes"), "features" (instead of "Features"), "cpu family" (instead of "CPU Family"), and "CPU revision" (instead of "CPU Revision"). Maybe you want to "fix" them as well.

I didn't notice the "issues" you mentioned, so it remains to be seen if they are "real" problems. However, I think changes like this should be approached with caution, and we should refer to the official Loongson website's distribution versions[1] (which are widely used) for guidance.

Quoted 11 lines

But this is just strange: both "CPU" and "MHz" are some sort of abbreviations ("Central Process Unit" and "Mega Hertz") so why "cpu" should be lower case but "MHz" should not? And why "CPU revision" but
"cpu MHz"?

To me it's a util-linux bug. Can you report it at
https://github.com/util-linux/util-linux/issues and let's wait for the
response from util-linux maintainers?

Also, I'd like to know why the LoongArch architecture is different from other architectures on this issue? If this is a bug, then all existing software that uses the 'model name' field will have this bug for LoongArch. This will require all maintainers to adapt to LoongArch (by adjusting it to be case-insensitive), which will unnecessarily increase the difficulty of adapting to LoongArch, won't it?

Best Regards,
Enze

Quoted 36 lines
Quoted 36 lines

This patch fixes this issue. With this patch applied, I get,

======

Architecture:          loongarch64
  Byte Order:          Little Endian
CPU(s):                4
  On-line CPU(s) list: 0-3
Model name:            Loongson-3A5000-HV
  Thread(s) per core:  1
  Core(s) per socket:  4

...
======

---
 arch/loongarch/kernel/proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/proc.c +1 -1
index 5c67cc4fd56d..7da56f9ee15c 100644
@@ -50,7 +50,7 @@ static int show_cpuinfo(struct seq_file *m, void
 *v)
        seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
        seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
        seq_printf(m, "CPU Family\t\t: %s\n", __cpu_family[n]);
-       seq_printf(m, "Model Name\t\t: %s\n", __cpu_full_name[n]);
+       seq_printf(m, "model name\t\t: %s\n", __cpu_full_name[n]);
        seq_printf(m, "CPU Revision\t\t: 0x%02x\n", version);
        seq_printf(m, "FPU Revision\t\t: 0x%02x\n", fp_version);
        seq_printf(m, "CPU MHz\t\t\t: %llu.%02llu\n",

base-commit: fc89d7fb499b0162e081f434d45e8d1b47e82ece

#3 lore raw
Quoted 11 lines · Enze Li
Quoted 5 lines

If I read lscpu code correctly, it also matches "cpu MHz" (instead of "CPU MHz"), "address sizes" (instead of "Address Sizes"), "features" (instead of "Features"), "cpu family" (instead of "CPU Family"), and "CPU revision" (instead of "CPU Revision").  Maybe you want to "fix" them as well.

I didn't notice the "issues" you mentioned, so it remains to be seen if they are "real" problems.  However, I think changes like this should be approached with caution, and we should refer to the official Loongson website's distribution versions[1] (which are widely used) for guidance.

Not found the link to 1. And again we should not refer to the "official" Loongson distributions for kernel development, at all, because the commercial distributions are *fundamentally* incompatible with the upstream kernel.

Quoted 11 lines
Quoted 10 lines

But this is just strange: both "CPU" and "MHz" are some sort of abbreviations ("Central Process Unit" and "Mega Hertz") so why "cpu" should be lower case but "MHz" should not?  And why "CPU revision" but
"cpu MHz"?

To me it's a util-linux bug.  Can you report it at
https://github.com/util-linux/util-linux/issues and let's wait for the
response from util-linux maintainers?

Quoted 4 lines

Also, I'd like to know why the LoongArch architecture is different from other architectures on this issue?  If this is a bug, then all existing software that uses the 'model name' field will have this bug for LoongArch.

Only arch/x86, arch/ia64, arch/arm, and arch/x86_64 provides a "model name" field in cpuinfo. arch/ppc and arch/sparc use "cpu" field instead of "model name" and lscpu accepts it.

If some code only matches "model name" and it blows up when the matching fails, it's definitely a bug because the code is already broken on 19 Linux ports out of 23. It's 19 out of 23, or 82%, not loongarch alone out of 23.

Quoted 3 lines

This will require all maintainers to adapt to LoongArch (by adjusting it to be case-insensitive), which will unnecessarily increase the difficulty of adapting to LoongArch, won't it?

Yes, on the day "Model Name" was written, it was an unnecessary difficulty and we made an error. But once arch/loongarch is released in 5.19, it becomes a necessary difficulty. If we just change it now, it will be another error.

It's just like we all know implicit fall-thorough in switch-case statements is a design error, but we cannot just change the compiler to silently add a "break" before all "case".

Signature · 2 lines
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University
author
#4 lore raw
Quoted 71 lines · Xi Ruoyao
Quoted 10 lines · Enze Li
Quoted 9 lines

If I read lscpu code correctly, it also matches "cpu MHz" (instead of
"CPU MHz"), "address sizes" (instead of "Address Sizes"), "features"
(instead of "Features"), "cpu family" (instead of "CPU Family"), and
"CPU revision" (instead of "CPU Revision"). Maybe you want to "fix"
them as well.

Quoted 8 lines

I didn't notice the "issues" you mentioned, so it remains to be seen if
they are "real" problems. However, I think changes like this should be
approached with caution, and we should refer to the official Loongson
website's distribution versions[1] (which are widely used) for guidance.

Not found the link to 1. And again we should not refer to the "official" Loongson distributions for kernel development, at all, because the commercial distributions are *fundamentally* incompatible with the upstream kernel.

Quoted 14 lines
Quoted 8 lines

But this is just strange: both "CPU" and "MHz" are some sort of abbreviations ("Central Process Unit" and "Mega Hertz") so why "cpu"
should be lower case but "MHz" should not? And why "CPU revision"
but
"cpu MHz"?

Quoted 5 lines

To me it's a util-linux bug. Can you report it at
https://github.com/util-linux/util-linux/issues and let's wait for
the
response from util-linux maintainers?

Quoted 6 lines

Also, I'd like to know why the LoongArch architecture is different from
other architectures on this issue? If this is a bug, then all existing
software that uses the 'model name' field will have this bug for LoongArch.

Only arch/x86, arch/ia64, arch/arm, and arch/x86_64 provides a "model name" field in cpuinfo. arch/ppc and arch/sparc use "cpu" field instead
of "model name" and lscpu accepts it.

If some code only matches "model name" and it blows up when the matching
fails, it's definitely a bug because the code is already broken on 19 Linux ports out of 23. It's 19 out of 23, or 82%, not loongarch alone
out of 23.

Quoted 4 lines

This will require all maintainers to adapt to LoongArch (by adjusting it to be case-insensitive), which will unnecessarily increase
the difficulty of adapting to LoongArch, won't it?

Yes, on the day "Model Name" was written, it was an unnecessary difficulty and we made an error. But once arch/loongarch is released in
5.19, it becomes a necessary difficulty. If we just change it now, it
will be another error.

Quoted 5 lines

It's just like we all know implicit fall-thorough in switch-case statements is a design error, but we cannot just change the compiler to
silently add a "break" before all "case".

Got you! Thanks a lot for your explanation and patience.

I'll keep an eye on this architecture to see if there's any help I can do.

Thanks,
Enze

reviewer NAK
#5 lore raw
In reply to Enze Li
Quoted 45 lines · Enze Li

When I use the latest version of lscpu to check my CPU info, I see,

======
Architecture: loongarch64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Model name: -
Thread(s) per core: 1
Core(s) per socket: 4
...
======

Obviously, the "Model name" field shows me with a "-", which means the lscpu failed to retrieve the correct information from the /proc/cpuinfo file.

The main problem is that, the lscpu only identifies the data by its "model name" field. However, on the LoongArch platform, only 'Model Name' is provided, which cannot be accurately identified due to case sensitivity issues. And I think that must be an oversight.

This patch fixes this issue. With this patch applied, I get,

======
Architecture: loongarch64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Model name: Loongson-3A5000-HV
Thread(s) per core: 1
Core(s) per socket: 4
...
======

---
  arch/loongarch/kernel/proc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/proc.c +0 -0
index 5c67cc4fd56d..7da56f9ee15c 100644

arch/loongarch/kernel/proc.c static int show_cpuinfo(struct seq_file *m, void *v) · line 53

Quoted 5 lines
arch/loongarch/kernel/proc.c +1 -1
@@ -50,7 +50,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
  	seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
  	seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
  	seq_printf(m, "CPU Family\t\t: %s\n", __cpu_family[n]);
-	seq_printf(m, "Model Name\t\t: %s\n", __cpu_full_name[n]);
+	seq_printf(m, "model name\t\t: %s\n", __cpu_full_name[n]);

NAK: it's userspace-visible ABI change. AFAIK there are already multiple downstream adaptations (made by Loongson folks) that rely on the current spelling, which may not have any fallback mechanism built in (e.g. recognize both "Model Name" and "model name", match case-insensitively, etc).

It's better to adapt the downstream projects instead, for example you could make them more resilient to a hypothetic future arch's similar change by making them match case-insensitively.

Quoted 5 lines
arch/loongarch/kernel/proc.c +0 -0
  	seq_printf(m, "CPU Revision\t\t: 0x%02x\n", version);
  	seq_printf(m, "FPU Revision\t\t: 0x%02x\n", fp_version);
  	seq_printf(m, "CPU MHz\t\t\t: %llu.%02llu\n",

base-commit: fc89d7fb499b0162e081f434d45e8d1b47e82ece

Signature · 3 lines
WANG "xen0n" Xuerui

Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
#6 lore raw
Quoted 4 lines · WANG Xuerui
Quoted 4 lines

The main problem is that, the lscpu only identifies the data by its "model name" field.  However, on the LoongArch platform, only 'Model Name' is provided, which cannot be accurately identified due to case sensitivity issues.  And I think that must be an oversight.

I tried using strcasecmp() in lscpu-cputype.c but it makes many tests miserably fail and there is no trivial way to fix.

I guess I'll just add LoongArch special cases there :(.

Signature · 2 lines
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University
author
#7 lore raw
In reply to WANG Xuerui

Hi Xuerui,

Thanks for your review! A few comments inlined below.

Quoted 58 lines · WANG Xuerui
Quoted 50 lines · Enze Li

When I use the latest version of lscpu to check my CPU info, I see,

======
Architecture: loongarch64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Model name: -
Thread(s) per core: 1
Core(s) per socket: 4
...
======

Obviously, the "Model name" field shows me with a "-", which means the
lscpu failed to retrieve the correct information from the /proc/cpuinfo
file.

The main problem is that, the lscpu only identifies the data by its "model name" field. However, on the LoongArch platform, only 'Model
Name' is provided, which cannot be accurately identified due to case
sensitivity issues. And I think that must be an oversight.

This patch fixes this issue. With this patch applied, I get,

======
Architecture: loongarch64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Model name: Loongson-3A5000-HV
Thread(s) per core: 1
Core(s) per socket: 4
...
======

---
  arch/loongarch/kernel/proc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/proc.c +0 -0
index 5c67cc4fd56d..7da56f9ee15c 100644

arch/loongarch/kernel/proc.c static int show_cpuinfo(struct seq_file *m, void · line 54

Quoted 6 lines
arch/loongarch/kernel/proc.c +1 -1
@@ -50,7 +50,7 @@ static int show_cpuinfo(struct seq_file *m, void
 *v)
  	seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
  	seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
  	seq_printf(m, "CPU Family\t\t: %s\n", __cpu_family[n]);
-	seq_printf(m, "Model Name\t\t: %s\n", __cpu_full_name[n]);
+	seq_printf(m, "model name\t\t: %s\n", __cpu_full_name[n]);
Quoted 8 lines

NAK: it's userspace-visible ABI change. AFAIK there are already multiple
downstream adaptations (made by Loongson folks) that rely on the current
spelling, which may not have any fallback mechanism built in (e.g. recognize both "Model Name" and "model name", match case- insensitively,
etc).

I can hardly believe that the 'Model Name' has been widely adopted. AFAIK, the latest official releases[1][2][3] use 'model name'(*NOT* the same with the upstream). Wouldn't Loongson folks use their own distribution for downstream software development?

It's undeniable that there are still a few developers who develop downstream software based on the upstream kernel, but it's only a small portion. AFAIK, there are three pre-release versions that use the upstream kernel, namely Archlinux, fedora-remix-loongarch, and Gentoo. However, none of them have released an official version, which means they are not widely used.

Considering that the 'Model Name' field only exists in upstream code and hasn't been widely adopted so far, I cautiously believe that this issue needs to be fixed as soon as possible to avoid disrupting the LoongArch ecosystem.

Quoted 5 lines

It's better to adapt the downstream projects instead, for example you
could make them more resilient to a hypothetic future arch's similar change by making them match case-insensitively.

Yes, I used to think the same way. But then I found out that almost all architectures, except for LoongArch, use the 'model name' field for identification. In this case, if I were a maintainer in the util-linux community, I don't think I would approve the change if someone submitted a patch like that, because the code would disrupt the overall structure and make it less aesthetically pleasing.

[1]
http://pkg.loongnix.cn/loongnix-server/8.4/isos/8.4.0/Loongnix-server-8.4.0.livecd.loongarch64.iso
[2]
http://pkg.loongnix.cn/loongnix/isos/Loongnix-20.3/Loongnix-20.3.livecd.mate.loongarch64.iso
[3]
http://pkg.loongnix.cn/loongnix/isos/Loongnix-20.3/Loongnix-20.3.sp1.livecd.cartoon.loongarch64.iso

Best Regards,
Enze

Quoted 6 lines
Quoted 6 lines
arch/loongarch/kernel/proc.c +0 -0
  	seq_printf(m, "CPU Revision\t\t: 0x%02x\n", version);
  	seq_printf(m, "FPU Revision\t\t: 0x%02x\n", fp_version);

seq_printf(m, "CPU MHz\t\t\t: %llu.%02llu\n",

base-commit: fc89d7fb499b0162e081f434d45e8d1b47e82ece

#8 lore raw
Quoted 10 lines · Enze Li
Quoted 9 lines

NAK: it's userspace-visible ABI change. AFAIK there are already multiple
downstream adaptations (made by Loongson folks) that rely on the current
spelling, which may not have any fallback mechanism built in (e.g. recognize both "Model Name" and "model name", match case- insensitively,
etc).

Quoted 4 lines

I can hardly believe that the 'Model Name' has been widely adopted. AFAIK, the latest official releases[1][2][3] use 'model name'(*NOT* the same with the upstream).  Wouldn't Loongson folks use their own distribution for downstream software development?

No they wouldn't. Loongnix is fundamentally incompatible with whatever in the upstream code base. Xuerui has explained it before:

As of 2022-07-18, all commercial LoongArch distributions are incompatible with all community distributions. All binary software built on community distributions, and some software written in high-level languages and existing in forms like source code or bytecode (such as those written in Python or Java) cannot run on commercial distributions, and vice versa. All closed-source software from ISVs such as WPS Office are built on commercial distributions, so they are extremely unlikely to work as-is on community distributions.

This is the so-called compatibility problem between the old-world and the new-world. Because the Loongson Corporation finished all commercial moves before announcing the LoongArch to the open-source community, the open-source LoongArch ecosystem is the new world; in contrast to this, all commercial distributions and the ecosystem associated make up the old world. The two worlds are to be united eventually, but are two parallel universes for now; and the technical difficulty of making the two worlds compatible with each other is enormous.

Quoted 6 lines

It's undeniable that there are still a few developers who develop downstream software based on the upstream kernel, but it's only a small portion.  AFAIK, there are three pre-release versions that use the upstream kernel, namely Archlinux, fedora-remix-loongarch, and Gentoo. However, none of them have released an official version, which means they are not widely used.

<sarcasm>
Then should we switch to the old MIPS-style UAPI, like Loongnix?  And get arch/loongarch kicked out from linux.git by Linus?
</sarcasm>

Quoted 4 lines

Considering that the 'Model Name' field only exists in upstream code and hasn't been widely adopted so far, I cautiously believe that this issue needs to be fixed as soon as possible to avoid disrupting the LoongArch ecosystem.

It's already disrupted, unfortunately. And the disruption cannot be "fixed" with a little adjustment here, a little adjustment there.

Quoted 11 lines
Quoted 4 lines

It's better to adapt the downstream projects instead, for example you
could make them more resilient to a hypothetic future arch's similar change by making them match case-insensitively.

Yes, I used to think the same way.  But then I found out that almost all architectures, except for LoongArch, use the 'model name' field for identification.  In this case, if I were a maintainer in the util-linux community, I don't think I would approve the change if someone submitted a patch like that, because the code would disrupt the overall structure and make it less aesthetically pleasing.

It would not disrupt the overall structure. I know because I've already written the code:

https://github.com/util-linux/util-linux/pull/2128

There is already many architecture specific code in lscpu (with a comment like /* aarch64 */ or /* sparc */).

Signature · 2 lines
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University
reviewer
#9 lore raw
In reply to Enze Li
Quoted 23 lines · Enze Li

Hi Xuerui,

Thanks for your review! A few comments inlined below.

Quoted 4 lines · WANG Xuerui

On 2023/3/22 17:05, Enze Li wrote:

<snip>

Quoted 8 lines

NAK: it's userspace-visible ABI change. AFAIK there are already multiple
downstream adaptations (made by Loongson folks) that rely on the current
spelling, which may not have any fallback mechanism built in (e.g. recognize both "Model Name" and "model name", match case- insensitively,
etc).

I can hardly believe that the 'Model Name' has been widely adopted. AFAIK, the latest official releases[1][2][3] use 'model name'(*NOT* the same with the upstream). Wouldn't Loongson folks use their own distribution for downstream software development?

Quoted 6 lines

It's undeniable that there are still a few developers who develop downstream software based on the upstream kernel, but it's only a small portion. AFAIK, there are three pre-release versions that use the upstream kernel, namely Archlinux, fedora-remix-loongarch, and Gentoo. However, none of them have released an official version, which means they are not widely used.

As a matter of fact, Archlinux and Gentoo (and their derivatives) are "rolling-release" distros. Which means they *never* release "official versions", if you mean things like tagged releases and corresponding LTS branches.

And AFAIK users of all three can be seen in the wild, I've definitely seen them upstream, maybe you need to look elsewhere than you previously used to.

Quoted 12 lines

Considering that the 'Model Name' field only exists in upstream code and hasn't been widely adopted so far, I cautiously believe that this issue needs to be fixed as soon as possible to avoid disrupting the LoongArch ecosystem.

Quoted 5 lines

It's better to adapt the downstream projects instead, for example you
could make them more resilient to a hypothetic future arch's similar change by making them match case-insensitively.

Quoted 6 lines

Yes, I used to think the same way. But then I found out that almost all architectures, except for LoongArch, use the 'model name' field for identification. In this case, if I were a maintainer in the util-linux community, I don't think I would approve the change if someone submitted a patch like that, because the code would disrupt the overall structure and make it less aesthetically pleasing.

Casing is generally considered personal taste, and different people's tastes can hugely vary. For example, in contrast to your belief, the current spelling is in fact *more* aesthetically pleasing to Huacai: compare the initial arch/loongarch port's [v5] and [v6] where the case change was introduced.

(I had talked with Huacai about the field keys but the conversation was private & in Chinese; I was actually proposing all-lowercase keys but he insisted on "mhz" being "incorrect", then as a result he had to Title Case everything else because of *aesthetic reasons* which I didn't and still don't agree with. I later criticized him because he left "processor", "package" and "core" lowercased, but he never gave any satisfying justification nor backed out the change, so as a result we are left with the current situation. You can say anything, but as a matter of fact, the ship has sailed.)

[v5]: https://lore.kernel.org/lkml/[email protected]/#Z31arch:loongarch:kernel:proc.c
[v6]: https://lore.kernel.org/all/[email protected]/#Z31arch:loongarch:kernel:proc.c

Quoted 7 lines

[1]
http://pkg.loongnix.cn/loongnix-server/8.4/isos/8.4.0/Loongnix-server-8.4.0.livecd.loongarch64.iso
[2]
http://pkg.loongnix.cn/loongnix/isos/Loongnix-20.3/Loongnix-20.3.livecd.mate.loongarch64.iso
[3]
http://pkg.loongnix.cn/loongnix/isos/Loongnix-20.3/Loongnix-20.3.sp1.livecd.cartoon.loongarch64.iso

In general we don't recommend caring about the old world. They are essentially forks/downstream of the various projects we talk about/contribute to, which are stuck to the previous non-"peer-reviewed" ABI due to non-technical reasons. (There are multiple possible ways to get unstuck but that's unrelated to the current topic.) As the upstream has moved on, and considering that much of Loongnix modification has no chance being accepted upstream, it's probably better to just maintain patches downstream in favor of keeping the boundary of the two clear.

Signature · 3 lines
WANG "xen0n" Xuerui

Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
#10 lore raw
Quoted 9 lines · WANG Xuerui

(I had talked with Huacai about the field keys but the conversation was private & in Chinese; I was actually proposing all-lowercase keys but he insisted on "mhz" being "incorrect", then as a result he had to Title Case everything else because of *aesthetic reasons* which I didn't and still don't agree with. I later criticized him because he left "processor", "package" and "core" lowercased, but he never gave any satisfying justification nor backed out the change, so as a result we are left with the current situation. You can say anything, but as a matter of fact, the ship has sailed.)

If I read some comment in linux.git correctly, it seems the code calculating the number of processor cores in Glibc would blow up if "processor" was changed to "Processor".

To me it's a mistake from day one making all the userspace parsing /proc/cpuinfo, while it's clearly more "human readable" than parseable. Perhaps the "correct" way is adding "/proc/cpuinfo.toml" with a well- defined spec in Documentation/filesystems/proc.rst.

Signature · 2 lines
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University
reviewer
#11 lore raw
Quoted 11 lines · Xi Ruoyao
Quoted 9 lines · WANG Xuerui

(I had talked with Huacai about the field keys but the conversation was private & in Chinese; I was actually proposing all-lowercase keys but he insisted on "mhz" being "incorrect", then as a result he had to Title Case everything else because of *aesthetic reasons* which I didn't and still don't agree with. I later criticized him because he left "processor", "package" and "core" lowercased, but he never gave any satisfying justification nor backed out the change, so as a result we are left with the current situation. You can say anything, but as a matter of fact, the ship has sailed.)

Quoted 3 lines

If I read some comment in linux.git correctly, it seems the code calculating the number of processor cores in Glibc would blow up if "processor" was changed to "Processor".

Ah you're probably right. At that time Huacai noted difficulties making "Processor" work which were not possible to work around, so he had to keep it lower-case. If not for this reason, every loongarch cpuinfo field would be properly in their respective Canonical Case (honestly that's not gonna be a bad thing).

Quoted 4 lines

To me it's a mistake from day one making all the userspace parsing /proc/cpuinfo, while it's clearly more "human readable" than parseable. Perhaps the "correct" way is adding "/proc/cpuinfo.toml" with a well- defined spec in Documentation/filesystems/proc.rst.

Yay for alternative machine-readable representation of de-facto information source; actually getting a proposal past the bikeshedding stage and pushing it past the finish line is another thing though. ;-)

Signature · 3 lines
WANG "xen0n" Xuerui

Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/