Internships/ProjectIdeas/IORegionFD: Difference between revisions
(Created page with "=== ioregionfd - new device access dispatch mechanism === '''Summary:''' Implement the ioregionfd device access dispatch mechanism in the Linux kvm.ko kernel module so that d...") |
No edit summary |
||
Line 1: | Line 1: | ||
=== ioregionfd - new device access dispatch mechanism === | === ioregionfd - new device access dispatch mechanism === | ||
'''Summary:''' Implement | '''Summary:''' Implement a mechanism in the Linux kvm.ko kernel module to dispatch device accesses directly to a process or thread without jumping through the QEMU vCPU thread. | ||
Virtual devices | Virtual devices such as graphics cards and network cards can be emulated in dedicated tasks (processes or threads) instead of running in QEMU's vCPU or main loop threads. Dedicated tasks have security and performance advantages because they are isolated and can run on dedicated physical CPUs. | ||
Some devices cannot be emulated efficiently yet because there is no way for the Linux kvm.ko kernel module to dispatch device accesses directly to the device emulation task. Today it is necessary to jump through the QEMU vCPU thread first and then forward the access to the dedicated task, which is slow. A few existing devices use the ioeventfd mechanism to avoid this but it only works for "doorbell" writes, not for read accesses or non-doorbell writes. This project is about implementing a general solution called ioregionfd. | |||
Here is how read accesses and non-doorbell writes | Here is how read accesses and non-doorbell writes are dispatched today: | ||
kvm.ko <---ioctl(KVM_RUN)---> QEMU <---messages---> device task | kvm.ko <---ioctl(KVM_RUN)---> QEMU <---messages---> device task | ||
ioregionfd | ioregionfd eliminates the extra step through QEMU like this: | ||
kvm.ko <---ioregionfd---> device task | kvm.ko <---ioregionfd---> device task | ||
This project consists of implementing the KVM_SET_IOREGIONFD ioctl in the Linux kvm.ko kernel module and writing test cases | This project consists of implementing the KVM_SET_IOREGIONFD ioctl in the Linux kvm.ko kernel module and writing test cases. As a stretch goal you could update QEMU's emulated NVMe device to run in a dedicated QEMU IOThread using ioregionfd. | ||
This project idea is suitable if you would like to gain Linux kernel programming and virtualization/emulation experience. No prior kernel programming experience is required but you must be | Please take a look at the ioregionfd API design discussion link below to understand the new ioctl proposal. | ||
This project idea is suitable if you would like to gain Linux kernel programming and virtualization/emulation experience. No prior kernel programming experience is required but you must be able to write production-quality C (understand pointers, dynamic memory allocation, and error-handling in C). | |||
'''Links:''' | '''Links:''' |
Latest revision as of 12:56, 13 September 2020
ioregionfd - new device access dispatch mechanism
Summary: Implement a mechanism in the Linux kvm.ko kernel module to dispatch device accesses directly to a process or thread without jumping through the QEMU vCPU thread.
Virtual devices such as graphics cards and network cards can be emulated in dedicated tasks (processes or threads) instead of running in QEMU's vCPU or main loop threads. Dedicated tasks have security and performance advantages because they are isolated and can run on dedicated physical CPUs.
Some devices cannot be emulated efficiently yet because there is no way for the Linux kvm.ko kernel module to dispatch device accesses directly to the device emulation task. Today it is necessary to jump through the QEMU vCPU thread first and then forward the access to the dedicated task, which is slow. A few existing devices use the ioeventfd mechanism to avoid this but it only works for "doorbell" writes, not for read accesses or non-doorbell writes. This project is about implementing a general solution called ioregionfd.
Here is how read accesses and non-doorbell writes are dispatched today:
kvm.ko <---ioctl(KVM_RUN)---> QEMU <---messages---> device task
ioregionfd eliminates the extra step through QEMU like this:
kvm.ko <---ioregionfd---> device task
This project consists of implementing the KVM_SET_IOREGIONFD ioctl in the Linux kvm.ko kernel module and writing test cases. As a stretch goal you could update QEMU's emulated NVMe device to run in a dedicated QEMU IOThread using ioregionfd.
Please take a look at the ioregionfd API design discussion link below to understand the new ioctl proposal.
This project idea is suitable if you would like to gain Linux kernel programming and virtualization/emulation experience. No prior kernel programming experience is required but you must be able to write production-quality C (understand pointers, dynamic memory allocation, and error-handling in C).
Links:
Details:
- Skill level: advanced
- Language: C
- Mentor: Stefan Hajnoczi <stefanha@redhat.com>