RFR: 8284196: RISC-V: Detect supported ISA extensions over cpuinfo [v2]

Ludovic Henry luhenry at openjdk.org
Wed Feb 8 16:03:43 UTC 2023


On Wed, 8 Feb 2023 01:23:02 GMT, Fei Yang <fyang at openjdk.org> wrote:

> It should be safe for them to do as this PR adds the necessary detection of availability of those ISA extensions.

Ok. That also aligns us with how it's done on other platforms (SHA on x86 or AArch64 for example).

I've a slight concern with the reliability of detecting these features based solely on the device tree + being able to force enable said-features in case we know for sure the extension is available but it's not communicated by the kernel.

FYI, the kernel doesn't transfer verbatim the device-tree "isa" provided by the hardware, but it reconstruct it based on the extensions the kernel knows about. So if the hardware support a cutting edge extension (Zvknh and Zvkb for example), but the kernel is older and doesn't know about it, the hardware is going to provide a device-tree with `_Zvknh_Zvkb` to the kernel, but it's not going to show up in `/proc/cpuinfo`. (You can find the list of extensions the kernel currently knows about at [1], and the logic to build the `isa` string at [2]).

> So I guess one possibility is that we might want some vendor-specific control like we do other CPU platforms

I fully agree we will want some of these. Good thing there are the vendorid as part of the spec so we can easily detect which one is which.

> But I hope some ISA extensions like bitmanip could be generally profitable across all venders so that the JVM could auto-enable those extension. But that needs more testing on real hardwares to prove.

Agreed. As long as we have a way to manually enable them so that the user still has the ability to test out some features on their hardware.

[1] https://github.com/torvalds/linux/blob/0983f6bf2bfc0789b51ddf7315f644ff4da50acb/arch/riscv/kernel/cpu.c#L164-L172
[2] https://github.com/torvalds/linux/blob/0983f6bf2bfc0789b51ddf7315f644ff4da50acb/arch/riscv/kernel/cpu.c#L174-L191

-------------

PR: https://git.openjdk.org/jdk/pull/12343


More information about the hotspot-dev mailing list