mbox series

[liburing,v5,00/10] aarch64 support

Message ID 20220705073920.367794-1-ammar.faizi@intel.com (mailing list archive)
Headers show
Series aarch64 support | expand

Message

Ammar Faizi July 5, 2022, 7:43 a.m. UTC
From: Ammar Faizi <ammarfaizi2@gnuweeb.org>

Hi Jens,

This is v5 revision of aarch64 support.

This series contains nolibc support for aarch64 and one extra irrelevant
cleanup (patch #1). The missing bit from aarch64 is get_page_size()
which is a bit complicated to implement without libc.

aarch64 supports three values of page size: 4K, 16K, and 64K which are
selected at kernel compilation time. Therefore, we can't hard code the
page size for this arch. In this series we utilize open(), read() and
close() syscall to find the page size from /proc/self/auxv.

The auxiliary vector contains information about the page size, it is
located at `AT_PAGESZ` keyval pair.

For more details about the auxv data structure, check the link below.

Link: https://github.com/torvalds/linux/blob/v5.19-rc4/fs/binfmt_elf.c#L260
Link: https://lwn.net/Articles/631631/

There are 10 patches in this series. Summary:

- Patch 1 is just a trivial changelog fix.
- Patch 2 and 3 are to add open() and read() syscall.
- Patch 4 is to remove __INTERNAL__LIBURING_SYSCALL_H checks.
- Patch 5 is to add get_page_size() function.
- Patch 6 is just a trivial style fixup for #ifdef and friends.
- Patch 7 is to enable the nolibc support for aarch64.
- Patch 8 is to add nolibc test.
- Patch 9 is for GitHub bot build.
- Patch 10 is to update the CHANGELOG to note aarch64 nolibc support.

I have built it with GitHub bot and it compiles just fine. But I don't
have an aarch64 machine to run the tests. Since you are using aarch64,
I can rely on you to test it.

How to test this?

  make clean;
  ./configure --nolibc;
  make -j8;

  ldd src/liburing.so.2.3;
  # Make sure you don't see libc.so from the `ldd` command.

  make runtests;

Please give it a test, thanks!

## Changelog

v4 -> v5:
  - Fixup commit message in patch #2.
  - Massage commit message in patch #8.
  - Append Reviewed-by tags from Alviro Iskandar Setiawan.

v3 -> v4:
  - Simplify __get_page_size() function.
  - Change __sys_read() return type from int to ssize_t.
  - Append Reviewed-by tags from Alviro Iskandar Setiawan.
  - Fix git am complain: space before tab in indent.

v2 -> v3:
  - No need to init the static var to zero.
  - Split style fixup into a separate patch.
  - Add nolibc test to test get_page_size() function.
  - Use __NR_openat when __NR_open is not defined on the arch.
  - Split open/read/close in get_page_size() into a new function.
  - Cache the get_page_size() fallback value when we fail on the
    syscalls.

v1 -> v2:
  - Drop aarch64 renaming directory patch.
  - Fallback the page size to 4K if we fail to get it.
  - Cache the page size after we read it from /proc/self/auxv.
  - Massage commit messages.
  - Note aarch64 nolibc support in CHANGELOG.

Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
---

Ammar Faizi (10):
  CHANGELOG: Fixup missing space
  arch: syscall: Add `__sys_open()` syscall
  arch: syscall: Add `__sys_read()` syscall
  arch: Remove `__INTERNAL__LIBURING_LIB_H` checks
  arch/aarch64: lib: Add `get_page_size()` function
  lib: Style fixup for #if / #elif / #else / #endif
  lib: Enable nolibc support for aarch64
  test: Add nolibc test
  .github: Enable aarch64 nolibc build for GitHub bot
  CHANGELOG: Note about aarch64 support

 .github/workflows/build.yml |  2 +-
 CHANGELOG                   |  7 ++++-
 src/arch/aarch64/lib.h      | 48 +++++++++++++++++++++++++++++
 src/arch/aarch64/syscall.h  |  4 ---
 src/arch/generic/lib.h      |  4 ---
 src/arch/generic/syscall.h  | 20 ++++++++++---
 src/arch/syscall-defs.h     | 19 ++++++++++++
 src/arch/x86/lib.h          |  4 ---
 src/arch/x86/syscall.h      |  4 ---
 src/lib.h                   | 32 ++++++++++----------
 src/syscall.h               |  2 --
 test/Makefile               |  1 +
 test/nolibc.c               | 60 +++++++++++++++++++++++++++++++++++++
 13 files changed, 167 insertions(+), 40 deletions(-)
 create mode 100644 src/arch/aarch64/lib.h
 create mode 100644 test/nolibc.c


base-commit: f8eb5f804288e10ae7ef442ef482e4dd8b18fee7

Comments

Jens Axboe July 5, 2022, 2:26 p.m. UTC | #1
On Tue, 5 Jul 2022 14:43:50 +0700, Ammar Faizi wrote:
> From: Ammar Faizi <ammarfaizi2@gnuweeb.org>
> 
> Hi Jens,
> 
> This is v5 revision of aarch64 support.
> 
> This series contains nolibc support for aarch64 and one extra irrelevant
> cleanup (patch #1). The missing bit from aarch64 is get_page_size()
> which is a bit complicated to implement without libc.
> 
> [...]

Applied, thanks!

[01/10] CHANGELOG: Fixup missing space
        commit: 3b70ce9c946a2a6623b23f88e1f38ae3a6f9e0ee
[02/10] arch: syscall: Add `__sys_open()` syscall
        commit: 27c678f1698871bbdcd6ccb853a54374e62e9532
[03/10] arch: syscall: Add `__sys_read()` syscall
        commit: 420e43f8bde3bb564c32702dabd416fc8b6154f4
[04/10] arch: Remove `__INTERNAL__LIBURING_LIB_H` checks
        commit: bd2bed0057d0875726eff0587bf0be92fe9d246e
[05/10] arch/aarch64: lib: Add `get_page_size()` function
        commit: c6bc86e2125bcd6fa10ff2b128cd86486acadff6
[06/10] lib: Style fixup for #if / #elif / #else / #endif
        commit: 090fd8441bf70d4db35796946cb7703b4e13e794
[07/10] lib: Enable nolibc support for aarch64
        commit: e7ad97fb51b116dfa653f55508d7be131a65d8f2
[08/10] test: Add nolibc test
        commit: 46d3e1df5f434156916abd0578110d0477bf56f7
[09/10] .github: Enable aarch64 nolibc build for GitHub bot
        commit: b86c5c795ed83add45f1c4e9955509093f2d9709
[10/10] CHANGELOG: Note about aarch64 support
        commit: 41f9e992d11e0fde0406b706afce31f6926e13de

Best regards,