Enable virtio-fs kernel module for shared directory support in QEMU VMs#2825
Enable virtio-fs kernel module for shared directory support in QEMU VMs#2825jepio merged 6 commits intoflatcar:mainfrom
Conversation
|
While we're at it, we can consider enabling See for example https://github.com/rhvgoyal/virtiofs-tests/blob/master/performance-results/dec-10-2020/results-different-caching-modes.txt for some benchmark numbers, it seems to be quite effective. (triple the performance in many benchmarks) |
|
That’s very interesting. Thanks for sharing those benchmarks! Quite significant. I’ve added According to home-assistant/operating-system@11c2eab, there are more kernel modules that might be related to virtio-fs.
My understanding is that dependent modules don’t need to be specified explicitly, so I’m not adding I’m unsure about I’m also unsure if it’s better to bake them into the kernel, or have them as modules. For now, I’m adding them as modules to avoid increasing the kernel size. I see that the existing By the way, the Home Assistant commit also adds these: From what I can tell, these are unrelated to virtio-fs (even though they are in the same commit), so I’m not going to include them. Let me know your thoughts. |
|
I don't think you can set CONFIG_FUSE_DAX to m, it's a boolean option that doesn't support modularisation https://github.com/torvalds/linux/blob/master/fs/fuse/Kconfig#L43 It is configured as bool, not tristate. So this won't compile.
https://github.com/torvalds/linux/blob/master/mm/Kconfig#L1104 I don't know either, but the direct advice is to enable it when FS_DAX is enabled. Grepping through the kernel it does not seem to add much code size at all, just select different code paths with perhaps slightly different performance characteristics. |
|
@felinira I’ve updated the PR to set both |
|
Had to enable FS_DAX to fix a build failure. Amd64 images are here for testing: https://bincache.flatcar-linux.net/images/amd64/9999.0.0+virtiofs.1/. Arm64 is failing with: |
|
Build action triggered: https://github.com/flatcar/scripts/actions/runs/14905926619 |
|
Images from the latest commit here: https://bincache.flatcar-linux.net/images/amd64/9999.0.0+virtiofs.2/ |
|
@jepio Thanks for the additional fixes to make this work! I’ll check out the build and let you know. |
|
Works fine at first glance, using the Butane snippet below: I can browse the mounted directory and was able to create a file. 🎉 It seems as if the virtiofs kernel module gets loaded automatically. I didn’t need to add any extra module loading config, which is great. I will do further testing next week, for example, benchmarking performance against my existing FCOS machine and playing with DAX. @felinira @skydiablo Do you also have some time to test? |
|
I'm on vacation, after eastern i will give it a try. Thx for Invest! |
|
This works fine for me. However we can probably disable dax again, as it is not actually supported on recent virtiofsd daemons. Sorry for the noise, I expected this to still work, but alas it does not. See https://gitlab.com/virtio-fs/virtiofsd/-/issues/41#note_1869838311 for details. I made some benchmarks. baseline - direct scsi disk access from VM host: virtiofsd mounted with default options: |
|
I wanted to let you know that the integration of virtiofs is working smoothly for me and meets all expectations. There are no issues or difficulties, and everything is running as expected. Thanks for the great work! volker. |
This is a dependency of CONFIG_FUSE_DAX=y. Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Dependency of ZONE_DEVICE. Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
|
I've rebased, will run another CI build to see that everything is fine and then i'll get this merged. Thanks! |
|
CI passed here: http://jenkins.infra.kinvolk.io:8080/job/container/job/packages_all_arches/5856/ |
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
|
I've added a changelog. Follow-up for some day: I noticed that fuse modules are part of the initrd, they don't seem to be needed there. |
|
@jepio Thank you for making this happen! |
|
oh yeah! great! can you estimate when will this be applied to a stable version? |
|
@jepio sry for re-asking, but current public releases aren't support virtiofs? in my case this one: "https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_image.img" or i'm wrong? |
only the recently released Alpha has the support. For the other channels, this feature needs to be backported, which has not been proposed yet. |
|
so i tried this image: https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_image.img but not success with my mount: here log output: so i checked the kernel module: hmmm, seems to be missing, so maybe the current alpha is also not re-created since this merge? |
|
@skydiablo yes, sorry for that - the alpha release has not been updated yet for this cycle. There is work in progress on the alpha release, will update here once it has been done. |
|
There are nightly builds of the latest branch, you can check the latest one here: https://bincache.flatcar-linux.net/images/amd64/4327.0.0+nightly-20250506-2100/ or https://bincache.flatcar-linux.net/images/arm64/4327.0.0+nightly-20250506-2100/. |
Add CONFIG_VIRTIO_FS=m to commonconfig-6.6
How to use
Create a Flatcar QEMU/KVM machine with a virtiofs share called
my_mount.In the VM, run the following commands:
As a result, the host directory should be mounted at
/mnt/my_mount.Testing done
As discussed in flatcar/Flatcar#1657, no testing has been done yet. Testing will be done once a build has been published by the CI.