Closed lattice0 closed 1 year ago
As far as I understood, there is a fallback, but the Async case is hardcoded, so it always needs the io_uring stuff to compile. The failures I get are because libc does not have the io_uring stuff when the target is android, so I don't see an easy solution for this, unless the code is reengineered a bit so Async
is an optional case. Would a PR be welcome?
Hi @lattice0! Thanks for reaching out. I'm curious to know more about your use-case because we currently don't officially support Android as a platform to run Firecracker on.
What is the error that you're getting? I'm guessing your libc does not have libc::SYS_io_uring_*
? I think your idea to have Async only if libc supports IO_URING can work in this case.
Contributions to Firecracker are always welcome and appreciated. See https://github.com/firecracker-microvm/firecracker/blob/main/CONTRIBUTING.md on how to get started.
yes! I made a POC by commenting everything related to uring, and I was able to run firecracker on my android. I couldn't test if it works because /dev/kvm was missing, gonna fix that, but it ran up to the point where it can't find /dev/kvm. But would be nice to have uring stuff as a feature instead of always including it. The less weird stuff the better.
Gonna look forward then to do a proper feature for uring, and also read the contributing docs, thanks!
-------- Mensagem Original -------- Ativo 31 de mai. de 2022 10:07, Alex Sardan escreveu:
Hi @.***(https://github.com/lattice0)! Thanks for reaching out. I'm curious to know more about your use-case because we currently don't officially support Android as a platform to run Firecracker on.
What is the error that you're getting? I'm guessing your libc does not have libc::SYS_iouring*? I think your idea to have Async only if libc supports IO_URING can work in this case.
Contributions to Firecracker are always welcome and appreciated. See https://github.com/firecracker-microvm/firecracker/blob/main/CONTRIBUTING.md on how to get started.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@alsrdn
the errors are on these types: https://github.com/firecracker-microvm/firecracker/blob/main/src/io_uring/src/lib.rs#L132
What is better: panic on the usage of these symbols, return Err on the usage of those symbols, or conditionally remove the entire io_uring lib? Remember that IoUring is used on some enums in firecracker code so I'd be adding compiling conditions to enums, which is kinda ugly and hard to tjink about.
PS: these symbols are available on android, but only for very very recent kernels, so it would be better to not add them to libc yet, but only in some years from now, when all kernels are 5.x+.
@alsrdn
the errors are on these types: https://github.com/firecracker-microvm/firecracker/blob/main/src/io_uring/src/lib.rs#L132
What is better: panic on the usage of these symbols, return Err on the usage of those symbols, or conditionally remove the entire io_uring lib? Remember that IoUring is used on some enums in firecracker code so I'd be adding compiling conditions to enums, which is kinda ugly and hard to tjink about.
PS: these symbols are available on android, but only for very very recent kernels, so it would be better to not add them to libc yet, but only in some years from now, when all kernels are 5.x+.
I'm not a big fan of panics. But how can you return Err if those constants are not available on compile time? I'm guessing that conditional compilation is the way to go here. We would also need to throw an error when the Async backend is used to create a block device on Android.
Before making a PR, can you please confirm that Firecracker will run on Android? I really like the use-case and it would be cool if we can have Firecracker running on Android. But if it doesn't work for other reasons (e.g. KVM issues) I wouldn't want to make just the conditional compilation changes for IO_URING.
I cleaned firecracker a week ago (in a completely dirty way) to test on Android and it ran, at least up to the KVM part. My Android phone of course was not compiled with KVM, so I'm working on it. I tried activating KVM on the kernel but it won't boot and I cannot debug the reason, but every time I activate something simple it won't boot also.
Anyways, KVM is for sure coming to Android: https://blog.esper.io/android-dessert-bites-5-virtualization-in-android-13-351789/ without kernel recompilation, and I've found that some xiaomi phones already come with KVM enabled (not mine, though).
The problem with conditional compilation is that when you use them on enums it gets pretty ugly. I did it a week ago and it was not very nice. I think that when IoUring was introduced it wasn't thought to be removable. But it's not that hard also, it's just not my favorite solution. But for the point of stability, making sure it's not even possible to create a IoUring is the best way.
Related approved changes:
https://github.com/rust-lang/libc/pull/2814 https://github.com/rust-vmm/vmm-sys-util/pull/162
Hi @lattice0, given that Android is not an officially supported platform we won't be incorporating Android support and testing into our roadmap. With that said, there should be no issue running Firecracker on Android recreationally provided that KVM is configured and supported correctly.
One other note worth mentioning is that the async file engine (that makes use of io_uring) is not a requirement for Firecracker, especially given that it is in dev-preview. If you are using a kernel that does not have io_uring support, using the sync file engine will be fine.
@mattschlebusch, reaching out to confirm the decision to officially exclude android hosts was made in view of Google microdroid and Google protected-KVM?
Is there anything you can share on what needs to happen for this to change?
Context: Supporting one of firecracker and microdroid.
Feature Request
I'm working on support for Android hosts for fun, I made some patches for some stuff now compiles but it looks like support for io_uring on Android is just for the super new ones as io_uring is just for kernels 5.1.x+. Is there a fallback on firecracker to not use io_uring? I'm still getting familiar with all of the firecracker. If not, would a PR adding this fallback be welcome?
The reason I'd want this is to run VMs on Android. Of course crosvm would be the proper project but I need to work on the simpler project first, then I can make it work on crosvm.
Describe the desired solution
Support Android hosts
Checks