Message ID | cover.1684425792.git.falcon@tinylab.org (mailing list archive) |
---|---|
Headers | show |
Series | tools/nolibc: riscv: Fix up compile error for rv32 | expand |
Hi Zhangjin, On Fri, May 19, 2023 at 01:00:18AM +0800, Zhangjin Wu wrote: > Hi, Willy > > nolibc for riscv is only tested for rv64 currently (see > tools/testing/selftests/nolibc/Makefile), this patchset tries to let it > compile for rv32, but still not pass the nolibc selftest: > > * The first patch uses lw/sw instead of ld/sd for rv32 and verse-vice for rv64 > * This patch may conflict with the stackprotector patch [1], because > both of them changed the _start assembly in arch-riscv.h That's quite embarrassing, I'm having to trace of that series here. Now I can find it in my LKML archives, but I don't have the direct message and didn't spot the other ones. I'll have to investigate, thanks for notifying me! I'm CCing Thomas, I will check with him how to best merge the two. > * The second patch adds __NR_llseek based sys_lseek implementation for rv32 > * There is no __NR_lseek for rv32, see include/uapi/asm-generic/unistd.h > * This code is based on the version from glibc, sysdeps/unix/sysv/linux/lseek.c > * It passed the two lseek tests in nolibc selftest (write a test case manually) OK. > * To let it compile for rv32, we still need to apply one of such actions: > * Revert the kernel commit d4c08b9776b3 ("riscv: Use latest system call ABI"), > but it is not the right direction, that commit has removed all of the time32 syscalls, > and let C lib (e.g. glibc) provide the same C APIs based on the other time64 syscalls > > * If not really use any of the time32 syscalls, defining __ARCH_WANT_TIME32_SYSCALLS > macro will let it compile, but this is buggy for the current implmentations are based > on time32 syscalls! > > * Really implement the C APIs for rv32, based on the time64 syscalls, just like glibc. > This commit c8ce48f06503 ("asm-generic: Make time32 syscall numbers optional") shows > us which functions should be re-implemented. > > So, the work todo for rv32 is: > > * Rebasing all of the old time32 syscalls based C APIs on the new time64 syscalls, > but they are not simply mapped one by one, glibc is a good reference. > > * Add standalone rv32 test support in tools/testing/selftests/nolibc/ I'm not the right one to judge how to best support rv32 but at least I just don't want to go backwards. I'm just having a probably stupid question, but how relevant is rv32 ? I mean, all the boards I've seen to date were based on rv64 even the smallest embedded ones, so I'm sincerely wondering if there exists at all any rv32 devices capable of running Linux. Because if that's not the case, maybe we should instead declare that we only support rv64 ? If such devices exist however, I'm all for us supporting them well. Thanks, Willy
Hi Willy, On 2023-05-19 11:40:30+0200, Willy Tarreau wrote: > Hi Zhangjin, > > On Fri, May 19, 2023 at 01:00:18AM +0800, Zhangjin Wu wrote: > > Hi, Willy > > > > nolibc for riscv is only tested for rv64 currently (see > > tools/testing/selftests/nolibc/Makefile), this patchset tries to let it > > compile for rv32, but still not pass the nolibc selftest: > > > > * The first patch uses lw/sw instead of ld/sd for rv32 and verse-vice for rv64 > > * This patch may conflict with the stackprotector patch [1], because > > both of them changed the _start assembly in arch-riscv.h > > That's quite embarrassing, I'm having to trace of that series here. Now > I can find it in my LKML archives, but I don't have the direct message and > didn't spot the other ones. I'll have to investigate, thanks for notifying > me! I'm CCing Thomas, I will check with him how to best merge the two. I think the conflict should be trivial to fix. I can also resend my series or just the single riscv patch. <snip> Thomas
On Fri, May 19, 2023 at 12:11:00PM +0200, Thomas Weißschuh wrote: > Hi Willy, > > On 2023-05-19 11:40:30+0200, Willy Tarreau wrote: > > Hi Zhangjin, > > > > On Fri, May 19, 2023 at 01:00:18AM +0800, Zhangjin Wu wrote: > > > Hi, Willy > > > > > > nolibc for riscv is only tested for rv64 currently (see > > > tools/testing/selftests/nolibc/Makefile), this patchset tries to let it > > > compile for rv32, but still not pass the nolibc selftest: > > > > > > * The first patch uses lw/sw instead of ld/sd for rv32 and verse-vice for rv64 > > > * This patch may conflict with the stackprotector patch [1], because > > > both of them changed the _start assembly in arch-riscv.h > > > > That's quite embarrassing, I'm having to trace of that series here. Now > > I can find it in my LKML archives, but I don't have the direct message and > > didn't spot the other ones. I'll have to investigate, thanks for notifying > > me! I'm CCing Thomas, I will check with him how to best merge the two. > > I think the conflict should be trivial to fix. > > I can also resend my series or just the single riscv patch. OK then I'll pick Zhangjin's series and will apply yours on top of it. Do not bother resending the whole series, only the riscv patch will be sufficient, I have the rest of your series in my lkml mbox. Thanks! Willy
On 2023-05-19 12:19:10+0200, Willy Tarreau wrote: > On Fri, May 19, 2023 at 12:11:00PM +0200, Thomas Weißschuh wrote: > > Hi Willy, > > > > On 2023-05-19 11:40:30+0200, Willy Tarreau wrote: > > > Hi Zhangjin, > > > > > > On Fri, May 19, 2023 at 01:00:18AM +0800, Zhangjin Wu wrote: > > > > Hi, Willy > > > > > > > > nolibc for riscv is only tested for rv64 currently (see > > > > tools/testing/selftests/nolibc/Makefile), this patchset tries to let it > > > > compile for rv32, but still not pass the nolibc selftest: > > > > > > > > * The first patch uses lw/sw instead of ld/sd for rv32 and verse-vice for rv64 > > > > * This patch may conflict with the stackprotector patch [1], because > > > > both of them changed the _start assembly in arch-riscv.h > > > > > > That's quite embarrassing, I'm having to trace of that series here. Now > > > I can find it in my LKML archives, but I don't have the direct message and > > > didn't spot the other ones. I'll have to investigate, thanks for notifying > > > me! I'm CCing Thomas, I will check with him how to best merge the two. > > > > I think the conflict should be trivial to fix. > > > > I can also resend my series or just the single riscv patch. > > OK then I'll pick Zhangjin's series and will apply yours on top of it. > Do not bother resending the whole series, only the riscv patch will be > sufficient, I have the rest of your series in my lkml mbox. Could you let me know if or when your are publishing your integration branch? Thomas
Hi Thomas, On Sat, May 20, 2023 at 09:18:25AM +0200, Thomas Weißschuh wrote: > On 2023-05-19 12:19:10+0200, Willy Tarreau wrote: > > On Fri, May 19, 2023 at 12:11:00PM +0200, Thomas Weißschuh wrote: > > > Hi Willy, > > > > > > On 2023-05-19 11:40:30+0200, Willy Tarreau wrote: > > > > Hi Zhangjin, > > > > > > > > On Fri, May 19, 2023 at 01:00:18AM +0800, Zhangjin Wu wrote: > > > > > Hi, Willy > > > > > > > > > > nolibc for riscv is only tested for rv64 currently (see > > > > > tools/testing/selftests/nolibc/Makefile), this patchset tries to let it > > > > > compile for rv32, but still not pass the nolibc selftest: > > > > > > > > > > * The first patch uses lw/sw instead of ld/sd for rv32 and verse-vice for rv64 > > > > > * This patch may conflict with the stackprotector patch [1], because > > > > > both of them changed the _start assembly in arch-riscv.h > > > > > > > > That's quite embarrassing, I'm having to trace of that series here. Now > > > > I can find it in my LKML archives, but I don't have the direct message and > > > > didn't spot the other ones. I'll have to investigate, thanks for notifying > > > > me! I'm CCing Thomas, I will check with him how to best merge the two. > > > > > > I think the conflict should be trivial to fix. > > > > > > I can also resend my series or just the single riscv patch. > > > > OK then I'll pick Zhangjin's series and will apply yours on top of it. > > Do not bother resending the whole series, only the riscv patch will be > > sufficient, I have the rest of your series in my lkml mbox. > > Could you let me know if or when your are publishing your integration > branch? Just finished it now, I had to manually rebase all patches and had to interrupt it yesterday. You'll find it here: https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git 20230520-nolibc-rv32+stkp It contains a temporary series made of: - Zhangjin's RV32 patches - your syscall() patch - your stkp series except the riscv one so that you just need to update the riscv one and that will be fine. Be careful, I have *not* restested the riscv port. As usual, do not hesitate to le me know if I messed up with anything. Thanks! Willy
Hi Willy, > Hi Zhangjin, > > On Fri, May 19, 2023 at 01:00:18AM +0800, Zhangjin Wu wrote: > ... > > > * To let it compile for rv32, we still need to apply one of such actions: > > * Revert the kernel commit d4c08b9776b3 ("riscv: Use latest system call ABI"), > > but it is not the right direction, that commit has removed all of the time32 syscalls, > > and let C lib (e.g. glibc) provide the same C APIs based on the other time64 syscalls > > > > * If not really use any of the time32 syscalls, defining __ARCH_WANT_TIME32_SYSCALLS > > macro will let it compile, but this is buggy for the current implmentations are based > > on time32 syscalls! > > > > * Really implement the C APIs for rv32, based on the time64 syscalls, just like glibc. > > This commit c8ce48f06503 ("asm-generic: Make time32 syscall numbers optional") shows > > us which functions should be re-implemented. > > > > So, the work todo for rv32 is: > > > > * Rebasing all of the old time32 syscalls based C APIs on the new time64 syscalls, > > but they are not simply mapped one by one, glibc is a good reference. > > > > * Add standalone rv32 test support in tools/testing/selftests/nolibc/ > > I'm not the right one to judge how to best support rv32 but at least I just > don't want to go backwards. I'm just having a probably stupid question, but > how relevant is rv32 ? I mean, all the boards I've seen to date were based > on rv64 even the smallest embedded ones, so I'm sincerely wondering if there > exists at all any rv32 devices capable of running Linux. Because if that's > not the case, maybe we should instead declare that we only support rv64 ? > If such devices exist however, I'm all for us supporting them well. > Firstly, as the commit c8ce48f06503 ("asm-generic: Make time32 syscall numbers optional") shows: We don't want new architectures to even provide the old 32-bit time_t based system calls any more, or define the syscall number macros. So, this is not rv32 specific, more and more architectures are trying to use the generic unistd.h (include/uapi/asm-generic/unistd.h), but rv32 may be the first new architecture variant who have no time32 syscalls. Second, I did search some rv32 socs/boards from two companies, they are bl602/bl616/bl702, esp32-c2/c3/c6, some of them even have 532KB sRAM which is enough for nolibc-based app + linux kernel, I have gotten 334K rv64 vmlinuz (+nolibc hello.c) in the tinylinux work for riscv, the future work may be running linux on such a real rv32 board ;-) Best regards, Zhangjin Wu > Thanks, > Willy