The concern about RV32 Linux ABI stability raised by musl-libc's maintainer
Dear RISC-V developers,
Sorry for dropping this mail out of the blue.
A couple of weeks ago, I was porting Alpine, a musl-libc based Linux distro, to a RV32 platform named LiteX/VexRiscv . Since the support for RV32 musl-libc was blocked whereas RV64 support got accepted back in May 2019, I asked Rich Felker, the maintainer of musl-libc, about his concern which blocks the RV32 port.
He said, and I quote, "kernel has not declared it (RV32 Linux) a stable ABI yet."
He added some comments on this issue in the follow-up e-mail :
" I don't know the official statement of kernel policy, but my understanding of it is just that the normal kernel stability policy (that they can't "break userspace", including changing type definitions that are part of user-kernel ABI, removing syscalls, etc.) doesn't apply yet for RV32. I'd welcome a clarification from anyone who can provide one on whether this is still the case, and if so, what needs to happen to get past that. "
To the best of my recollection, I don't recall there's any official statements to declare the stability of RV64 kernel or any kind of ABI freeze.
I've been asking around my collegaues; they don't remember such kind of annoucement either.
Yet I believe that to some degree, there's a rough transition point when we all came to agree " not to touch RV64 kernel <=> user interface (i.e. stuffs under arch/riscv/include/asm) too much from now on. "
As my own experience, we (Andes Tech) have been distributing RV32 kernel to our customers without having ABI breakage for a long time.
Does anyone here also feels the same for RV32 ?
If that's the case, then we might be able to ease Rich's concern about RV32 kernel's ABI stability.
Or if that's not the case, please enlighten me a bit so we could work it out together :-)
A spinning tiny cog,
Ruinland ChuanTzu Tasi
----- Forwarded message from Rich Felker <[email protected]> -----
Date: Wed, 1 Apr 2020 09:40:01 -0400
From: Rich Felker <[email protected]>
To: [email protected]
Subject: Re: [musl] About "stable ABI" for riscv32 kernel issue and Alpine port
User-Agent: Mutt/1.5.21 (2010-09-15)
Quoted 5 lines · Ruinland ChuanTzu Tsai
Hi Rich and All,
Back in 13th Mar, Rich has stated that "kernel has not declared it (RV32 Linux) a stable ABI yet." I'm wondering whether Rich could kindly elaborate a little bit more details about this concern ?
I don't know the official statement of kernel policy, but my understanding of it is just that the normal kernel stability policy (that they can't "break userspace", including changing type definitions that are part of user-kernel ABI, removing syscalls, etc.) doesn't apply yet for RV32. I'd welcome a clarification from anyone who can provide one on whether this is still the case, and if so, what needs to happen to get past that.
Quoted 4 lines
Since my employer, Andes Tech, is one of the founding plantium memeber of RISC-V Foundation and we're shipping a considerable amount of Linux-running RV32 products at the time we're speaking, we will be happy to help on the kernel side and make it more stablized and secured.
It's not a matter of secure or "stable" in the sense of not crashing. It's a matter of "stable" in the sense of "not changing out from under you".
Quoted 13 lines
During my pastime, I've ported Alpine Linux with musl 1.2.0 to a publicily available and open-sourced platform, LiteX/VexRiscv[1], which could be synthesized and "burnt" to a Lattice ECP5-5G Versa Evaluation Board with completely FOSS toolchain without any closed source component. [2]
And here's the footage of booting :
https://asciinema.org/a/315205Unfortunately, since my musl 1.2.0 is an inhouse work and we are still polishing and preparing it for upstreaming, please excuse me from not releasing the cpio image and stuffs at this time being.
Quoted 6 lines
P.S.
Regarding the last mail:
https://www.openwall.com/lists/musl/2020/03/13/4
I'm not really qualified to answer the reason/profit of lacking LR/SC pair. Yet just a rough hunch that LR/SC is much stronger in atomicity than other AMOs.
Yes, LR/SC is a slightly stronger primitive in some sense, but at the same time it's far easier to fake an implementation on single-core designs.
In any case if there are chips people want to run Linux/musl on that lack LR/SC then we need to know what the intended way to get atomics is. Does kernel trap and emulate? Do we have to make a syscall? Is there a function kernel exports to userspace like kuser_helper on pre-v6 ARM that establishes a contract of cooperation between kernel and userspace to restart interrupted atomics? What are you doing with your WIP port?
Rich
----- End forwarded message -----
Quoted 29 lines · Ruinland ChuanTzu Tsai
Dear RISC-V developers,
Sorry for dropping this mail out of the blue.A couple of weeks ago, I was porting Alpine, a musl-libc based Linux distro, to a RV32 platform named LiteX/VexRiscv . Since the support for RV32 musl-libc was blocked whereas RV64 support got accepted back in May 2019, I asked Rich Felker, the maintainer of musl-libc, about his concern which blocks the RV32 port.
He said, and I quote, "kernel has not declared it (RV32 Linux) a stable ABI yet."
He added some comments on this issue in the follow-up e-mail :
" I don't know the official statement of kernel policy, but my understanding of it is just that the normal kernel stability policy (that they can't "break userspace", including changing type definitions that are part of user-kernel ABI, removing syscalls, etc.) doesn't apply yet for RV32. I'd welcome a clarification from anyone who can provide one on whether this is still the case, and if so, what needs to happen to get past that. "To the best of my recollection, I don't recall there's any official statements to declare the stability of RV64 kernel or any kind of ABI freeze.
I've been asking around my collegaues; they don't remember such kind of annoucement either.
Quoted 7 lines
Yet I believe that to some degree, there's a rough transition point when we all came to agree " not to touch RV64 kernel <=> user interface (i.e. stuffs under
arch/riscv/include/asm) too much from now on. "As my own experience, we (Andes Tech) have been distributing RV32 kernel to our customers without having ABI breakage for a long time.
are you carrying local patches for kernel that change UAPIs?
Quoted 2 lines
Does anyone here also feels the same for RV32 ?
it has to be upstream in Linux kernel and 4.15 is when all needed UAPI headers for Linux were made
available for rv64, I am not sure if that has happened yet for rv32. And glibc port is also not accepted yet
so kernel userspace is still in flux fo rv32 imo
Quoted 77 lines
If that's the case, then we might be able to ease Rich's concern about RV32 kernel's ABI stability.
Or if that's not the case, please enlighten me a bit so we could work it out together :-)
A spinning tiny cog,
Ruinland ChuanTzu Tasi----- Forwarded message from Rich Felker <[email protected]> -----
Date: Wed, 1 Apr 2020 09:40:01 -0400
From: Rich Felker <[email protected]>
To: [email protected]
Subject: Re: [musl] About "stable ABI" for riscv32 kernel issue and Alpine port
User-Agent: Mutt/1.5.21 (2010-09-15)Quoted 5 lines · Ruinland ChuanTzu Tsai
Hi Rich and All,
Back in 13th Mar, Rich has stated that "kernel has not declared it (RV32 Linux) a stable ABI yet." I'm wondering whether Rich could kindly elaborate a little bit more details about this concern ?
I don't know the official statement of kernel policy, but my understanding of it is just that the normal kernel stability policy (that they can't "break userspace", including changing type definitions that are part of user-kernel ABI, removing syscalls, etc.) doesn't apply yet for RV32. I'd welcome a clarification from anyone who can provide one on whether this is still the case, and if so, what needs to happen to get past that.
Quoted 4 lines
Since my employer, Andes Tech, is one of the founding plantium memeber of RISC-V Foundation and we're shipping a considerable amount of Linux-running RV32 products at the time we're speaking, we will be happy to help on the kernel side and make it more stablized and secured.
It's not a matter of secure or "stable" in the sense of not crashing. It's a matter of "stable" in the sense of "not changing out from under you".
Quoted 13 lines
During my pastime, I've ported Alpine Linux with musl 1.2.0 to a publicily available and open-sourced platform, LiteX/VexRiscv[1], which could be synthesized and "burnt" to a Lattice ECP5-5G Versa Evaluation Board with completely FOSS toolchain without any closed source component. [2]
And here's the footage of booting :
https://asciinema.org/a/315205Unfortunately, since my musl 1.2.0 is an inhouse work and we are still polishing and preparing it for upstreaming, please excuse me from not releasing the cpio image and stuffs at this time being.
Quoted 6 lines
P.S.
Regarding the last mail:
https://www.openwall.com/lists/musl/2020/03/13/4
I'm not really qualified to answer the reason/profit of lacking LR/SC pair. Yet just a rough hunch that LR/SC is much stronger in atomicity than other AMOs.Yes, LR/SC is a slightly stronger primitive in some sense, but at the same time it's far easier to fake an implementation on single-core designs.
In any case if there are chips people want to run Linux/musl on that lack LR/SC then we need to know what the intended way to get atomics is. Does kernel trap and emulate? Do we have to make a syscall? Is there a function kernel exports to userspace like
kuser_helperon pre-v6 ARM that establishes a contract of cooperation between kernel and userspace to restart interrupted atomics? What are you doing with your WIP port?Rich
----- End forwarded message -----