Re: [PATCH 3/3] arm64 cpuinfo: implement sysfs nodes for arm64

From: Thomas Renninger
Date: Mon Dec 09 2019 - 06:28:48 EST

On Monday, December 9, 2019 11:31:11 AM CET Will Deacon wrote:
> On Fri, Dec 06, 2019 at 05:24:21PM +0100, Thomas Renninger wrote:
> > From: Felix Schnizlein <fschnizlein@xxxxxxx>
> >
> > Export all information from /proc/cpuinfo to sysfs:
> > implementer, architecture, variant, part, revision,
> > bogomips and flags are exported.
> >
> > Example:
> > /sys/devices/system/cpu/cpu1/info/:[0]# head *


> > ==> flags <==
> > fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid asimdrdm


> I don't understand why we need this on arm64

The first intention of these patches is to port x86 /proc/cpuinfo.

Because of the divergence of /proc/cpuinfo and the totally different
info exported there across architectures,
therefore it is also tried to get a unified interface across architectures
where possible.

So for flags and bugs this may work out, right?

For the rest, it looks like people again only had their CPU in mind and
exported to userspace what currently was needed...

> and why it's an improvement
> over all the other schemes we already support for identifying CPU features.


> Given the pain we've endured over the years exposing this sort of stuff to
> userspace, I'm relucant to add more just for the fun of it.

If there should ever be something like a string describing the CPU...
In x86 it comes from the CPU itself.
Maybe we get a model description at some point as well...

Or any other entity which may also get exported on other archs..

Please remember this interface and watch out whether you could export
things under the same name as done on other architectures.

I'll revert everything but flags for ARM now.
But this is the best example for the need of a generic interface:

x86 - /proc/cpuinfo:
flags : ...
arm64 - /proc/cpuinfo:
Features : ...

even it is exactly the same kernel interface, even x86 flags are used
according to arch/arm64/include/asm/cpufeature.h:

* We use arm64_cpu_capabilities to represent system features, errata work

But it is named differently in /proc/cpuinfo.
This should not happen again in /sys/...