mbox series

[v3,00/11] tools/nolibc: shrink arch support

Message ID cover.1689150149.git.falcon@tinylab.org
Headers show
Series tools/nolibc: shrink arch support | expand

Message

Zhangjin Wu July 12, 2023, 9:15 a.m. UTC
Hi, Willy, Thomas

Here is the revision of the v2 arch support shrink patchset [1], it
mainly applies suggestions from you.

It is based on the 20230710-nolibc-ser2-tom-syscall-configv4-report
branch of nolibc repo.

Tested for all of the supported archs:

           arch/board | result
          ------------|------------
      arm/versatilepb | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
      arm/vexpress-a9 | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
             arm/virt | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
         aarch64/virt | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
              i386/pc | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
            x86_64/pc | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
         mipsel/malta | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
     loongarch64/virt | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
         riscv64/virt | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
         riscv32/virt | 151 test(s): 122 passed,   7 skipped,  22 failed => status: failure.
s390x/s390-ccw-virtio | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.

Changes from v2 --> v3:

* tools/nolibc: remove the old sys_stat support

    Revert the reorg operation, basically the same as v1

* tools/nolibc: add new crt.h with _start_c

    Revert the reorg operation
    Add crt.h in Makefile
    Add _nolibc_main alias for main to silence the compile warning about 

* tools/nolibc: arm: shrink _start with _start_c
  tools/nolibc: aarch64: shrink _start with _start_c
  tools/nolibc: i386: shrink _start with _start_c
  tools/nolibc: x86_64: shrink _start with _start_c
  tools/nolibc: mips: shrink _start with _start_c
  tools/nolibc: loongarch: shrink _start with _start_c
  tools/nolibc: riscv: shrink _start with _start_c
  tools/nolibc: s390: shrink _start with _start_c

    Revert the reorg operation, but still use post-whitespaces instead of post-tab.
    Include "crt.h" in arch-<ARCH>.h

* tools/nolibc: arch-*.h: add missing space after ','

    Fix up the errors reported by scripts/checkpatch.pl

Best regards,
Zhangjin
---
[1]: https://lore.kernel.org/lkml/cover.1688828139.git.falcon@tinylab.org/

Zhangjin Wu (11):
  tools/nolibc: remove the old sys_stat support
  tools/nolibc: add new crt.h with _start_c
  tools/nolibc: arm: shrink _start with _start_c
  tools/nolibc: aarch64: shrink _start with _start_c
  tools/nolibc: i386: shrink _start with _start_c
  tools/nolibc: x86_64: shrink _start with _start_c
  tools/nolibc: mips: shrink _start with _start_c
  tools/nolibc: loongarch: shrink _start with _start_c
  tools/nolibc: riscv: shrink _start with _start_c
  tools/nolibc: s390: shrink _start with _start_c
  tools/nolibc: arch-*.h: add missing space after ','

 tools/include/nolibc/Makefile         |  1 +
 tools/include/nolibc/arch-aarch64.h   | 56 ++----------------
 tools/include/nolibc/arch-arm.h       | 82 +++------------------------
 tools/include/nolibc/arch-i386.h      | 61 +++-----------------
 tools/include/nolibc/arch-loongarch.h | 45 ++-------------
 tools/include/nolibc/arch-mips.h      | 76 ++++---------------------
 tools/include/nolibc/arch-riscv.h     | 68 +++-------------------
 tools/include/nolibc/arch-s390.h      | 63 ++------------------
 tools/include/nolibc/arch-x86_64.h    | 57 +++----------------
 tools/include/nolibc/crt.h            | 59 +++++++++++++++++++
 tools/include/nolibc/sys.h            | 63 ++++----------------
 tools/include/nolibc/types.h          |  4 +-
 12 files changed, 133 insertions(+), 502 deletions(-)
 create mode 100644 tools/include/nolibc/crt.h

Comments

Willy Tarreau July 15, 2023, 8:59 a.m. UTC | #1
Hi Zhangjin,

On Wed, Jul 12, 2023 at 05:16:34PM +0800, Zhangjin Wu wrote:
> __NR_statx has been added from v4.10:
> 
>     commit a528d35e8bfc ("statx: Add a system call to make enhanced file info available")
> 
> It has been supported by all of the platforms since at least from v4.20
> and glibc 2.28.
> 
> Let's remove the old arch related and dependent sys_stat support
> completely.
> 
> This is friendly to the future new architecture porting.

As I previously said, I'd like that we at least preserve compatibility
with supported stable branches. 4.14 and 4.19 are still supported, so
does this mean that if I rebuild my preinit against the updated nolibc
it will fail to boot on such older systems for the archs that we support?

Because if it means that in order to support all currently active
kernels, one must only build from an older copy of the lib, that becomes
a disservice to its development and usage. Thus if you checked that aarch64,
arm, i386, mips, riscv, s390 and x86_64 had already adopted statx by 4.14,
then I'm fine and we can drop stat(), but then it must be mentioned in
the commit message, because here it's not explicit.

Thanks!
Willy
Willy Tarreau July 15, 2023, 10:01 a.m. UTC | #2
On Wed, Jul 12, 2023 at 05:15:28PM +0800, Zhangjin Wu wrote:
> Hi, Willy, Thomas
> 
> Here is the revision of the v2 arch support shrink patchset [1], it
> mainly applies suggestions from you.
> 
> It is based on the 20230710-nolibc-ser2-tom-syscall-configv4-report
> branch of nolibc repo.
> 
> Tested for all of the supported archs:
> 
>            arch/board | result
>           ------------|------------
>       arm/versatilepb | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
>       arm/vexpress-a9 | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
>              arm/virt | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
>          aarch64/virt | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
>               i386/pc | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
>             x86_64/pc | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
>          mipsel/malta | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
>      loongarch64/virt | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
>          riscv64/virt | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.
>          riscv32/virt | 151 test(s): 122 passed,   7 skipped,  22 failed => status: failure.
> s390x/s390-ccw-virtio | 151 test(s): 144 passed,   7 skipped,   0 failed => status: warning.

Thanks for all this work. So I've checked a few random archs and trust
your tests above to confirm they're correct ;-)  I'd just like to get
your confirmation regarding statx() support in 4.14 and 4.19, and likely
adjust _start_c() according to the last few tests. Also please do prepend
to the list the patch that adds the optimize("-Os") to fix _start, and we
should be good.

Thanks!
Willy