On Wed, Sep 21, 2016 at 2:15 PM, Richard W.M. Jones <
rjo...@redhat.com> wrote:
> On Wed, Sep 21, 2016 at 10:59:41AM -0700, Martin Maas wrote:
>> I never got around to cleaning this up in poky, but making this consistent
>> is a good idea. I agree with Michael's point that it's worth to spend some
>> time thinking about how to handle the different RISC-V extensions/variants
>> in Yocto. One approach could be to use riscv32, riscv64, riscv128 as the
>> arch name, and then have additional settings to select the specific variant
>> and extensions to target.
>
> FWIW in Fedora we are hoping to do this.
>
> riscv32 / riscv64 / riscv128 would be the base architecture,
> corresponding to RV32G / RV64G / RV128G (any hardware not capable of
> doing IMAFD would not be supported at all).
I agree this is pretty reasonable; if your system has enough RAM and
"disk" for systemd and the GNU userland, not having a FPU would be a
strange allocation of resources, and it can be simulated in M-mode
anyway. Just don't try to ship a RV32G memcpy() that copies through
floating point registers or anything like that.
Supporting multiarch is a good future direction (and we've been trying
not to do anything that would conflict with it), since in the
post-Moore era the memory savings of ILP32 are hard to ignore,
especially if your workload looks like "100 processes, each using
300MB". This requires running RV32 processes on a RV64 kernel, which
is not possible in priv1.9 but seems likely from conversations here.
> We would hope to handle other extensions entirely at runtime, through
> whatever is the equivalent of CPUID or /proc/cpuinfo, and using ifunc
> or some other dynamic instruction selection.
Agreed; IMO the biggest missing point of the current U-mode spec is
the lack of a feature detection mechanism. (You can't just use a
SIGILL handler for this because an implementation that omits a
standard extension is explicitly permitted (§10.1 under
"Standard-compatible global encodings") to reuse the opcode space for
something non-standard.) Parsing /proc/cpuinfo will work for now but
I'd love something kernel independent.
> Over time we might expand the base requirements, eg. by requiring
> extension C or a particular vector implementation. We'll see how real
> server hardware pans out.
>
> In other words -- a lot like x86.
For a long time on x86 "what features does your processor support" and
"how old is your processor" were mostly the same question. We're
seeing more orthogonal features in x86 now, and ARM has always had
more practically relevant subsets, but RISC-V will probably see far
more ISA variants in the wild due to the fact that we permit and
encourage non-standard extensions.
In the long term, for medium to large computers, I see a future where
generic binaries (RV64G + ifuncs) are relatively rare and mostly used
for bootstrap programs and installers, with other executable code
being generated in myriad variations by either build farms, on-target
compilation, or JITs. Gentoo was the butt of jokes for many years but
iOS (build farms) and Android (on-target compilation?) are doing the
same thing now, and I expect this to spread to the rest of the
non-embedded market.
-s