Regarding the changes on /proc/cpuinfo for ISA strings

Andrew Jones ajones at ventanamicro.com
Wed Oct 5 09:48:02 PDT 2022


On Tue, Oct 04, 2022 at 05:55:42AM +0000, Ruinland Tsai wrote:
> Hi Atish and all,
> 
> After the commit "a9b202606" introduced for Kernel v5.18,
> the `/proc/cpuinfo` will longer print the full ISA string provided by DTB.
> 
> With the comment of that commit, it seems that the policy of `cpuinfo` has
> changed to print only the extensions provided in the array
> "riscv_isa_ext_data" and those extensions must be properly enabled (by
> toggling corresponding Kconfig ?).
> 
> So we are wondering a few things and hope that you can enlighten us a little
> bit :
> 
> 1. What is the policy on recieving vendor extensions ?
> Hypothetically speaking, if a vendor submits a patch which simply adds an
> entry into `riscv_isa_ext_data[]` without revealing any detail, will that be
> acceptable ?

Is the concern with usermode being able to determine which unprivileged
extensions are available, whether they're standard or non-standard, even
when the kernel doesn't recognize them?

If so, then that does appear to be an issue. Even simply adding entries to
riscv_isa_ext_data[] isn't great, because in these cases there may be no
other reason for the kernel to be updated, which means doing so creates an
unnecessary burden and unnecessary entries in riscv_isa_ext_data[].

> 
> 2. If a userspace program wishes to know the whole ISA string, is
> `/proc/device-tree` the last resort for them ? And if that's the case, what
> will the equivalent in the ACPI world since we have learnt that the RISC-V
> ACPI spec is now work in progress.

ACPI will have the RHCT table (I believe the ECR has been approved). One
can dump and disassemble the table from sysfs, but neither that nor
looking at /proc/device-tree should be how usermode probes CPU features.

If my guess at the concern is correct, then I wonder if we don't need to
extend the ISA extension naming convention to also include 'u' or whatever
in unprivileged extension names. Then, the kernel would just pass those
through when it publishes extensions to userspace.

Thanks,
drew



More information about the linux-riscv mailing list