News for hackers. Stuff that matters.
Re:Welcome Debian riscv64 by LatticeAnimal on Sunday July 23, 2023 @09:34PM (#36842014)
I don't fully understand riscv, but shouldn't this be something like `RV64GC`?

Are they building for the base riscv with no isa extensions? This might be addressed somewhere in the debian docs but I didn't see it.

Re:Welcome Debian riscv64 by CUViper on Sunday July 23, 2023 @09:48PM (#36842107)
Re:Welcome Debian riscv64 by LatticeAnimal on Sunday July 23, 2023 @09:52PM (#36842147)
Ah, thanks for that! I wonder how they plan to support future extensions like RV64GCV which seems to be gaining traction…
Re:Welcome Debian riscv64 by jrockway on Sunday July 23, 2023 @10:39PM (#36842514)
Would it be much different than armhf vs. armel?
Re:Welcome Debian riscv64 by sanxiyn on Sunday July 23, 2023 @11:00PM (#36842638)
Note that NEON is optional for armhf, mainly to support Tegra 2. This was a big deal at the time. See https://wiki.debian.org/ArmHardFloatPort.
Re:Welcome Debian riscv64 by viraptor on Sunday July 23, 2023 @11:22PM (#36842766)
Would anything prevent compilers from approaching it like SSE on Intel? Check for feature presence and enable the appropriate path (if using compiler-generated code).
Re:Welcome Debian riscv64 by sanxiyn on Sunday July 23, 2023 @11:31PM (#36842810)
> Check for feature presence

That is the hard part. On Intel you can use CPUID, but it is ARM policy to not expose such instructions. You can read /proc/cpuinfo, but that is Linux-specific.

Re:Welcome Debian riscv64 by erik_seaberg on Monday July 24, 2023 @12:38AM (#36843158)
https://news.ycombinator.com/item?id=18542040 talks about registers with a similar purpose.
Re:Welcome Debian riscv64 by sanxiyn on Monday July 24, 2023 @12:42AM (#36843186)
Only in EL1, which means you can only use them in kernel.
Re:Welcome Debian riscv64 by viraptor on Monday July 24, 2023 @03:11AM (#36844071)
But specific instructions should be testable anyway, right? Try to execute with an exception handler and you'll know.
Re:Welcome Debian riscv64 by pm215 on Monday July 24, 2023 @05:51AM (#36845246)
On Arm this is generally a bad idea -- there are, or were, some corner cases where the kernel can know that an extension shouldn't be used, but it doesn't have a mechanism for "make the instructions UNDEF". The example I know about is ancient history now -- on the Cortex-A8 I think you could build a kernel without Neon support or perhaps the kernel might find there was a Neon-related erratum, but there was no way to disable Neon to force the UNDEFs.

The recommended approach is to use HWCAPs, or else to use the kernel's "emulated ID register accesses" functionality.

Re:Welcome Debian riscv64 by pm215 on Monday July 24, 2023 @05:46AM (#36845204)
The Arm Linux kernel allows you to use some of the "read ID register" instructions from userspace, because it traps them in the kernel and emulates them to present you with a slightly sanitized view of the available hardware: https://www.kernel.org/doc/html/v5.8/arm64/cpu-feature-regis...

You can also look at the hwcaps (available in the ELF aux vector) -- this is the older mechanism.

It's true that there's no cross-OS mechanism to do this, but that's life -- often the OS wants to get in anyway to sanitize the answers (eg so it can tell you "feature X is not present" when it knows about a hardware erratum or the OS was built without feature-X support).

Re:Welcome Debian riscv64 by cmeacham98 on Sunday July 23, 2023 @11:28PM (#36842793)
Debian distributes compiled binaries. Thus, they have to either turn processor features on in all their binaries, or off (or distribute two sets of binaries).
Re:Welcome Debian riscv64 by sanxiyn on Sunday July 23, 2023 @11:35PM (#36842837)
Debian does distribute SSE-using binaries (with fallback) on i386 which detects presence of SSE at runtime using CPUID.
Re:Welcome Debian riscv64 by IntelMiner on Monday July 24, 2023 @02:18AM (#36843721)
You're thinking of optimizing the code for a specific processor. Run-time codepaths that detect CPU features have existed since MMX and SSE
Re:Welcome Debian riscv64 by pabs3 on Monday July 24, 2023 @10:13AM (#36848322)
There are options for runtime instruction selection:

https://wiki.debian.org/InstructionSelection

Re:Welcome Debian riscv64 by waaveshine on Sunday July 23, 2023 @09:54PM (#36842161)
I’ve noticed a lot of projects use riscv64 as shorthand for the rv64gc ISA, especially when it’s understood that there is an MMU, maybe an FPU, privilege levels, and any other extensions that a modern OS requires.

Anyway, I did find this on the Debian website[1]. So it seems they mean rv64gc.

[1] https://wiki.debian.org/RISC-V#Hardware_baseline_and_ABI_cho...

Re:Welcome Debian riscv64 by photonbeam on Sunday July 23, 2023 @10:57PM (#36842613)
Presumably Android will also chose a base minimum ISA spec for riscv software at some point. It would be tidy if they match the regular linux ecosystem
Re:Welcome Debian riscv64 by snvzz on Sunday July 23, 2023 @11:28PM (#36842789)
Android (and most Linux distributions) is likely to settle for RVA22+V or RVA23 as minimum requirement.

There's a lot in there which RV64GC (ratified in 2019, I understand unchanged since 2017) lacks.

Some of the new extensions e.g. vector and bit manipulation do have a significant effect in performance.

Re:Welcome Debian riscv64 by panick21_ on Monday July 24, 2023 @05:57AM (#36845313)
It has not been decided. There was a talk about the details just 2 weeks ago on the RISC-V International Youtube channel. Very interesting and recommended.
Re:Welcome Debian riscv64 by ur-whale on Monday July 24, 2023 @06:14AM (#36845438)
If there is a downfall of RISCV, it's going to be the myriad of sub-architectures and their weird naming schemes, with an added layer of marketing drones muddying up the waters even further.

This is going to confuse the hell out of the potential customer base and it would be a crying shame, wasting a golden opportunity to get out of the oxygen-choking clutches of proprietary ISA vendors (who at this point are purely rent-seeking and add exactly zero actual economic value to the ecosystem).

Re:Welcome Debian riscv64 by 15155 on Monday July 24, 2023 @09:30AM (#36847706)
I don't think so, in practice since atomics (on single-core systems especially) and floats can easily be emulated. If larger, more-incompatible extensions become commonplace, possibly.
Re:Welcome Debian riscv64 by bee_rider on Monday July 24, 2023 @10:00AM (#36848129)
I mean, in the very least the proprietary ISA vendors provide the service of selecting what extensions are added. If you think too many extensions will take down RISC-V, that seems to have value.
Re:Welcome Debian riscv64 by panick21_ on Tuesday July 25, 2023 @07:59PM (#36871373)
RISC-V will do the same thing. That's what profiles and even further platforms will provide. Most software (the large investment) will target these profiles.

Not following the profiles will be possible but will cause issues.

Re:Welcome Debian riscv64 by snvzz on Monday July 24, 2023 @01:26PM (#36851394)
Not since RISC-V Profiles[0].

0. https://github.com/riscv/riscv-profiles/releases