-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lkl: posix: use preadv/pwritev for block I/O #563
Conversation
I kept this as a draft, as I'm not sure whether short read/write fallback is needed... For Linux I think there are fifo and possibly network FS edge cases which might need fallback. |
78e582c
to
e825ddc
Compare
v2:
|
preadv/pwritev errors are propagated for undersize or oversize |
android-aarch64 is failing:
I did check to confirm that Bionic carried preadv/pwritev (API level 24). Not sure why we're getting a linker error here. Will need to investigate further... |
Bionic commit 6f4594d5d ("Add preadv/pwritev.") is dated 2015. |
I came across https://raw.githubusercontent.com/thehajime/lkl-docker/refs/heads/master/circleci/android/arm64/Dockerfile which indicates that we're using an ancient android-ndk-r15b with |
We used LGTM once we fix the Android build issue. Perhaps ifdef for Android to use |
break; | ||
} | ||
if (len != sum_iovlen(req->buf, req->count)) | ||
err = do_rw(pwrite_fn, disk.fd, req); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth continuing with preadv/pwritev from where we left off instead of starting from scratch with read/write?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did consider that, but given that short read/write should be very rare, I don't think it's worth the extra complexity.
Ah interesting, thanks for the background (and code review!)
I'll see how I go with updating the CI images and proceed from there. |
...
I've submitted the |
with a quick patch of below to lkl-docker, diff --git a/circleci/android/arm64/Dockerfile b/circleci/android/arm64/Dockerfile
index e86fd6d..10abae4 100644
--- a/circleci/android/arm64/Dockerfile
+++ b/circleci/android/arm64/Dockerfile
@@ -4,7 +4,7 @@ FROM $IMAGE_NAME
LABEL authors="Hajime Tazaki <[email protected]>, Octavian Purdila <[email protected]>"
# install toolchain from NDK
-RUN ./android-ndk-r15b/build/tools/make_standalone_toolchain.py --arch arm64 --api 23 --install-dir ./aarch64-linux-android && \
+RUN ./android-ndk-r15b/build/tools/make_standalone_toolchain.py --arch arm64 --api 24 --install-dir ./aarch64-linux-android && \
rm -rf android-ndk-r15b
# update toolchain, see https://github.com/lkl/linux/issues/348#issuecomment-312409409
the following commit can build without the link failure.
updating build environment with, for example, |
Great \o/ ...
I'm fine with using your change as a band-aid solution for now - can you commit it, or would you like me to submit a PR? Looking at https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md it appears that we should also be able to use the regular github CI images for Android NDK builds too. |
I will do that. |
This is needed to support preadv/pwritev calls, which is available after Bionic API level 24. Link: lkl/linux#563 Signed-off-by: Hajime Tazaki <[email protected]>
preadv and pwritev have been around for a long time, and should be usable on BSD and Linux (v2.6.30, glibc 2.10, Bionic API level 24). Short reads or writes trigger fallback to the old do_rw() handler. Signed-off-by: David Disseldorp <[email protected]>
e825ddc
to
ca21656
Compare
v3:
|
The android build is now passing thanks to @thehajime 's image changes. The Windows failure appears unrelated (failure to download openvpn). |
thanks @ddiss !
rerun the failed test and seems to be fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @ddiss !
preadv and pwritev have been around for a long time, and should be usable on BSD and Linux (v2.6.30, glibc 2.10, Bionic API level 24). This reduces the number of syscalls for multi-iov block requests and also fixes the do_rw() callback "strict-prototypes" compiler errors.
TODO: