Skip to contentSkip to conversation

virtio-pci: Disable virtio-ioeventfd when !CONFIG_IOTHREAD

PATCH Superseded Stefan Hajnoczi 3 participants 3 messages Jan 25, 2011

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 virtio-pci: Disable virtio-ioeventfd when !CONFIG_IOTHREAD

It is not possible to use virtio-ioeventfd when building without an I/O thread. We rely on a signal to kick us out of vcpu execution. Timers and AIO use SIGALRM and SIGUSR2 respectively. Unfortunately eventfd does not support O_ASYNC (SIGIO) so eventfd cannot be used in a signal driven manner.

---
 kvm-all.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
kvm-all.c +6 -2
index 255b6fa..881ea32 100644
@@ -449,10 +449,14 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
 
 static int kvm_check_many_ioeventfds(void)
 {
-    /* Older kernels have a 6 device limit on the KVM io bus.  Find out so we
+    /* Userspace can use ioeventfd for virtqueue kick.  This requires a host
+     * that supports eventfd(2) and an I/O thread; since eventfd does not
+     * support SIGIO it cannot interrupt the vcpu.
+     *
+     * Older kernels have a 6 device limit on the KVM io bus.  Find out so we
      * can avoid creating too many ioeventfds.
      */
-#ifdef CONFIG_EVENTFD
+#if defined(CONFIG_EVENTFD) && defined(CONFIG_IOTHREAD)
     int ioeventfds[7];
     int i, ret = 0;
     for (i = 0; i < ARRAY_SIZE(ioeventfds); i++) {
Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 16 lines · Stefan Hajnoczi

It is not possible to use virtio-ioeventfd when building without an I/O thread. We rely on a signal to kick us out of vcpu execution. Timers and AIO use SIGALRM and SIGUSR2 respectively. Unfortunately eventfd does not support O_ASYNC (SIGIO) so eventfd cannot be used in a signal driven manner.

---
 kvm-all.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
kvm-all.c +0 -0
index 255b6fa..881ea32 100644

kvm-all.c int kvm_check_extension(KVMState *s, unsigned int extension) · line 452

Quoted 5 lines
kvm-all.c +1 -1
@@ -449,10 +449,14 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
 
 static int kvm_check_many_ioeventfds(void)
 {
-    /* Older kernels have a 6 device limit on the KVM io bus.  Find out so we
+    /* Userspace can use ioeventfd for virtqueue kick.  This requires a host

virtqueue kick -> io notifications?

Quoted 13 lines
kvm-all.c +5 -1
+     * that supports eventfd(2) and an I/O thread; since eventfd does not
+     * support SIGIO it cannot interrupt the vcpu.
+     *
+     * Older kernels have a 6 device limit on the KVM io bus.  Find out so we
      * can avoid creating too many ioeventfds.
      */
-#ifdef CONFIG_EVENTFD
+#if defined(CONFIG_EVENTFD) && defined(CONFIG_IOTHREAD)
     int ioeventfds[7];
     int i, ret = 0;
     for (i = 0; i < ARRAY_SIZE(ioeventfds); i++) {
Signature · 1 line
1.7.2.3
#2 lore raw
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Stefan Hajnoczi

It is not possible to use virtio-ioeventfd when building without an I/O thread.  We rely on a signal to kick us out of vcpu execution.  Timers and AIO use SIGALRM and SIGUSR2 respectively.  Unfortunately eventfd does not support O_ASYNC (SIGIO) so eventfd cannot be used in a signal driven manner.

---
 kvm-all.c |    8 ++++++--

 1 files changed, 6 insertions(+), 2 deletions(-)
kvm-all.c +0 -0
index 255b6fa..881ea32 100644
@@ -449,10 +449,14 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
 
Quoted 6 lines

kvm-all.c int kvm_check_extension(KVMState *s, unsigned int extension) · line 452

Quoted 4 lines
kvm-all.c +1 -1
  static int kvm_check_many_ioeventfds(void)
  {
-    /* Older kernels have a 6 device limit on the KVM io bus.  Find out so we
+    /* Userspace can use ioeventfd for virtqueue kick.  This requires a host

virtqueue kick -> io notifications?

Fixed in v3.

Stefan