Skip to content

Commit f0d7db7

Browse files
vireshkjgross1
authored andcommitted
xen: privcmd: Add support for ioeventfd
Virtio guests send VIRTIO_MMIO_QUEUE_NOTIFY notification when they need to notify the backend of an update to the status of the virtqueue. The backend or another entity, polls the MMIO address for updates to know when the notification is sent. It works well if the backend does this polling by itself. But as we move towards generic backend implementations, we end up implementing this in a separate user-space program. Generally, the Virtio backends are implemented to work with the Eventfd based mechanism. In order to make such backends work with Xen, another software layer needs to do the polling and send an event via eventfd to the backend once the notification from guest is received. This results in an extra context switch. This is not a new problem in Linux though. It is present with other hypervisors like KVM, etc. as well. The generic solution implemented in the kernel for them is to provide an IOCTL call to pass the address to poll and eventfd, which lets the kernel take care of polling and raise an event on the eventfd, instead of handling this in user space (which involves an extra context switch). This patch adds similar support for xen. Inspired by existing implementations for KVM, etc.. This also copies ioreq.h header file (only struct ioreq and related macros) from Xen's source tree (Top commit 5d84f07fe6bf ("xen/pci: drop remaining uses of bool_t")). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/b20d83efba6453037d0c099912813c79c81f7714.1697439990.git.viresh.kumar@linaro.org Signed-off-by: Juergen Gross <jgross@suse.com>
1 parent 9e90e58 commit f0d7db7

4 files changed

Lines changed: 476 additions & 6 deletions

File tree

drivers/xen/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,12 @@ config XEN_PRIVCMD
269269
disaggregated Xen setups this driver might be needed for other
270270
domains, too.
271271

272-
config XEN_PRIVCMD_IRQFD
273-
bool "Xen irqfd support"
272+
config XEN_PRIVCMD_EVENTFD
273+
bool "Xen Ioeventfd and irqfd support"
274274
depends on XEN_PRIVCMD && XEN_VIRTIO && EVENTFD
275275
help
276-
Using the irqfd mechanism a virtio backend running in a daemon can
277-
speed up interrupt injection into a guest.
276+
Using the ioeventfd / irqfd mechanism a virtio backend running in a
277+
daemon can speed up interrupt delivery from / to a guest.
278278

279279
config XEN_ACPI_PROCESSOR
280280
tristate "Xen ACPI processor"

0 commit comments

Comments
 (0)