Skip to contentSkip to conversation

[5451] Fix IO performance regression in sparc

Qemu-devel Anthony Liguori 1 participant 1 message Oct 8, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

Revision: 5451

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5451
Author:   aliguori
Date:     2008-10-08 19:50:24 +0000 (Wed, 08 Oct 2008)

Log Message:
-----------
Fix IO performance regression in sparc

Replace signalfd with signal handler/pipe. There is no way to interrupt the CPU execution loop when a file descriptor becomes readable. This results in a large performance regression in sparc emulation during bootup.

This patch switches us to signal handler/pipe which was originally suggested by Ian Jackson. The signal handler lets us interrupt the CPU emulation loop while the write to a pipe lets us avoid the select/signal race condition.

Modified Paths:
--------------
trunk/Makefile
trunk/Makefile.target
trunk/block-raw-posix.c
trunk/configure
trunk/qemu-common.h
trunk/qemu-tool.c
trunk/vl.c

Removed Paths:
-------------
trunk/compatfd.c
trunk/compatfd.h

Modified: trunk/Makefile
===================================================================

Makefile +0 -4
@@ -59,10 +59,6 @@
 BLOCK_OBJS += block-raw-posix.o
 endif
 
-ifdef CONFIG_AIO
-BLOCK_OBJS += compatfd.o
-endif
-
 ######################################################################
 # libqemu_common.a: Target independent part of system emulation. The
 # long term path is to suppress *all* target specific code in case of

Modified: trunk/Makefile.target
===================================================================

Makefile.target +0 -4
@@ -481,10 +481,6 @@
 OBJS+=block-raw-posix.o
 endif
 
-ifdef CONFIG_AIO
-OBJS+=compatfd.o
-endif
-
 LIBS+=-lz
 ifdef CONFIG_ALSA
 LIBS += -lasound

Modified: trunk/block-raw-posix.c
===================================================================

block-raw-posix.c +33 -33

110 lines not on this page · raw message

Deleted: trunk/compatfd.c
===================================================================

compatfd.c +0 -127

127 lines not on this page · raw message

Deleted: trunk/compatfd.h
===================================================================

compatfd.h +0 -28
@@ -1,28 +0,0 @@
-/*
- * signalfd/eventfd compatibility
- *
- * Copyright IBM, Corp. 2008
- *
- * Authors:
- *  Anthony Liguori   <[email protected]>
- *
- * This work is licensed under the terms of the GNU GPL, version 2.  See
- * the COPYING file in the top-level directory.
- *
- */
-
-#ifndef QEMU_COMPATFD_H
-#define QEMU_COMPATFD_H
-
-#include <signal.h>
-
-struct qemu_signalfd_siginfo {
-    uint32_t ssi_signo;
-    uint8_t pad[124];
-};
-
-int qemu_signalfd(const sigset_t *mask);
-
-int qemu_eventfd(int *fds);
-
-#endif

Modified: trunk/configure
===================================================================

configure +0 -35
@@ -113,8 +113,6 @@
 nptl="yes"
 mixemu="no"
 bluez="yes"
-signalfd="no"
-eventfd="no"
 
 # OS specific
 targetos=`uname -s`
@@ -930,33 +928,6 @@
   fi
 fi
 
-##########################################
-# signalfd probe
-cat > $TMPC << EOF
-#define _GNU_SOURCE
-#include <unistd.h>
-#include <sys/syscall.h>
-#include <signal.h>
-int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
-EOF
-
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
-  signalfd=yes
-fi
-
-##########################################
-# eventfd probe
-cat > $TMPC << EOF
-#define _GNU_SOURCE
-#include <unistd.h>
-#include <sys/syscall.h>
-int main(void) { return syscall(SYS_eventfd, 0); }
-EOF
-
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
-  eventfd=yes
-fi
-
 # Check if tools are available to build documentation.
 if [ -x "`which texi2html 2>/dev/null`" ] && \
    [ -x "`which pod2man 2>/dev/null`" ]; then
@@ -1297,12 +1268,6 @@
   echo "#define CONFIG_AIO 1" >> $config_h
   echo "CONFIG_AIO=yes" >> $config_mak
 fi
-if test "$signalfd" = "yes" ; then
-  echo "#define CONFIG_signalfd 1" >> $config_h
-fi
-if test "$eventfd" = "yes" ; then
-  echo "#define CONFIG_eventfd 1" >> $config_h
-fi
 
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then

Modified: trunk/qemu-common.h
===================================================================

qemu-common.h +3 -0
@@ -139,4 +139,7 @@
 void cpu_save(QEMUFile *f, void *opaque);
 int cpu_load(QEMUFile *f, void *opaque, int version_id);
 
+/* Force QEMU to stop what it's doing and service IO */
+void qemu_service_io(void);
+
 #endif

Modified: trunk/qemu-tool.c
===================================================================

qemu-tool.c +4 -0
@@ -26,6 +26,10 @@
     void *opaque;
 };
 
+void qemu_service_io(void)
+{
+}
+
 void term_printf(const char *fmt, ...)
 {
 }

Modified: trunk/vl.c
===================================================================

vl.c +13 -0
@@ -7475,6 +7475,19 @@
     return 0;
 }
 
+void qemu_service_io(void)
+{
+    CPUState *env = cpu_single_env;
+    if (env) {
+        cpu_interrupt(env, CPU_INTERRUPT_EXIT);
+#ifdef USE_KQEMU
+        if (env->kqemu_enabled) {
+            kqemu_cpu_interrupt(env);
+        }
+#endif
+    }
+}
+
 /***********************************************************/
 /* bottom halves (can be seen as timers which expire ASAP) */