From patchwork Mon Aug 10 21:39:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 31108 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 79424B7B6D for ; Tue, 11 Aug 2009 07:41:12 +1000 (EST) Received: from localhost ([127.0.0.1]:32865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Macc5-0002ap-Ue for incoming@patchwork.ozlabs.org; Mon, 10 Aug 2009 17:41:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Macaq-0001eC-Kb for qemu-devel@nongnu.org; Mon, 10 Aug 2009 17:39:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Macam-0001ab-UH for qemu-devel@nongnu.org; Mon, 10 Aug 2009 17:39:48 -0400 Received: from [199.232.76.173] (port=44543 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Macam-0001aR-LL for qemu-devel@nongnu.org; Mon, 10 Aug 2009 17:39:44 -0400 Received: from verein.lst.de ([213.95.11.210]:43885) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1Macal-0001wt-Io for qemu-devel@nongnu.org; Mon, 10 Aug 2009 17:39:44 -0400 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id n7ALddVL007016 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 10 Aug 2009 23:39:39 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-7.2) id n7ALddGe007015 for qemu-devel@nongnu.org; Mon, 10 Aug 2009 23:39:39 +0200 Date: Mon, 10 Aug 2009 23:39:39 +0200 From: Christoph Hellwig To: qemu-devel@nongnu.org Message-ID: <20090810213939.GA6897@lst.de> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Spam-Score: 0 () X-Scanned-By: MIMEDefang 2.39 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH] make pthreads mandatory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org As requested by Anthony make pthreads mandatory. This means we will always have AIO available on posix hosts, and it will also allow enabling the I/O thread unconditionally once it's ready. Signed-off-by: Christoph Hellwig Index: qemu/configure =================================================================== --- qemu.orig/configure 2009-08-10 18:29:15.181973847 -0300 +++ qemu/configure 2009-08-10 18:31:48.401726743 -0300 @@ -197,8 +197,6 @@ build_docs="yes" uname_release="" curses="yes" curl="yes" -pthread="yes" -aio="yes" io_thread="no" nptl="yes" mixemu="no" @@ -257,7 +255,6 @@ DragonFly) if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then kqemu="yes" fi - aio="no" ;; NetBSD) bsd="yes" @@ -364,7 +361,6 @@ if test "$mingw32" = "yes" ; then EXESUF=".exe" QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" - aio=no fi # find source path @@ -503,10 +499,6 @@ for opt do ;; --enable-mixemu) mixemu="yes" ;; - --disable-pthread) pthread="no" - ;; - --disable-aio) aio="no" - ;; --enable-io-thread) io_thread="yes" ;; --disable-blobs) blobs="no" @@ -644,8 +636,6 @@ echo " --oss-lib path to echo " --enable-uname-release=R Return R for uname -r in usermode emulation" echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" echo " --disable-vde disable support for vde network" -echo " --disable-pthread disable pthread support" -echo " --disable-aio disable AIO support" echo " --enable-io-thread enable IO thread" echo " --disable-blobs disable installing provided firmware blobs" echo " --kerneldir=PATH look for kernel includes in PATH" @@ -1185,24 +1175,25 @@ fi # pthread probe PTHREADLIBS_LIST="-lpthread -lpthreadGC2" -if test "$pthread" = yes; then - pthread=no +pthread=no cat > $TMPC << EOF #include int main(void) { pthread_create(0,0,0,0); return 0; } EOF - for pthread_lib in $PTHREADLIBS_LIST; do - if compile_prog "" "$pthread_lib" ; then - pthread=yes - LIBS="$pthread_lib $LIBS" - break - fi - done -fi +for pthread_lib in $PTHREADLIBS_LIST; do + if compile_prog "" "$pthread_lib" ; then + pthread=yes + LIBS="$pthread_lib $LIBS" + break + fi +done if test "$pthread" = no; then - aio=no - io_thread=no + echo + echo "Error: pthread check failed" + echo "Make sure to have the pthread libs and headers installed." + echo + exit 1 fi ########################################## @@ -1535,7 +1526,6 @@ echo "uname -r $uname_release" echo "NPTL support $nptl" echo "GUEST_BASE $guest_base" echo "vde support $vde" -echo "AIO support $aio" echo "IO thread $io_thread" echo "Install blobs $blobs" echo -e "KVM support $kvm" @@ -1707,9 +1697,6 @@ fi if test "$xen" = "yes" ; then echo "CONFIG_XEN=y" >> $config_host_mak fi -if test "$aio" = "yes" ; then - echo "CONFIG_AIO=y" >> $config_host_mak -fi if test "$io_thread" = "yes" ; then echo "CONFIG_IOTHREAD=y" >> $config_host_mak fi Index: qemu/Makefile =================================================================== --- qemu.orig/Makefile 2009-08-10 18:32:01.952998992 -0300 +++ qemu/Makefile 2009-08-10 18:32:25.388976258 -0300 @@ -55,7 +55,7 @@ recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o block-obj-y += nbd.o block.o aio.o aes.o -block-obj-$(CONFIG_AIO) += posix-aio-compat.o +block-obj-$(CONFIG_POSIX) += posix-aio-compat.o block-nested-y += cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o Index: qemu/block/raw-posix.c =================================================================== --- qemu.orig/block/raw-posix.c 2009-08-10 18:32:30.169724720 -0300 +++ qemu/block/raw-posix.c 2009-08-10 18:33:19.440726312 -0300 @@ -27,9 +27,7 @@ #include "qemu-log.h" #include "block_int.h" #include "module.h" -#ifdef CONFIG_AIO #include "posix-aio-compat.h" -#endif #ifdef CONFIG_COCOA #include @@ -489,7 +487,6 @@ static int raw_write(BlockDriverState *b return ret; } -#ifdef CONFIG_AIO /***********************************************************/ /* Unix AIO using POSIX AIO */ @@ -725,13 +722,6 @@ static BlockDriverAIOCB *raw_aio_writev( } return &acb->common; } -#else /* CONFIG_AIO */ -static int posix_aio_init(void) -{ - return 0; -} -#endif /* CONFIG_AIO */ - static void raw_close(BlockDriverState *bs) { @@ -906,10 +896,8 @@ static BlockDriver bdrv_raw = { .bdrv_create = raw_create, .bdrv_flush = raw_flush, -#ifdef CONFIG_AIO .bdrv_aio_readv = raw_aio_readv, .bdrv_aio_writev = raw_aio_writev, -#endif .bdrv_truncate = raw_truncate, .bdrv_getlength = raw_getlength, @@ -1026,7 +1014,7 @@ static int hdev_open(BlockDriverState *b #endif s->type = FTYPE_FILE; -#if defined(__linux__) && defined(CONFIG_AIO) +#if defined(__linux__) if (strstart(filename, "/dev/sg", NULL)) { bs->sg = 1; } @@ -1092,7 +1080,6 @@ static int hdev_ioctl(BlockDriverState * return ioctl(s->fd, req, buf); } -#ifdef CONFIG_AIO static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, BlockDriverCompletionFunc *cb, void *opaque) @@ -1123,7 +1110,6 @@ static BlockDriverAIOCB *hdev_aio_ioctl( return &acb->common; } -#endif #elif defined(__FreeBSD__) static int fd_open(BlockDriverState *bs) @@ -1183,10 +1169,8 @@ static BlockDriver bdrv_host_device = { .bdrv_create = hdev_create, .bdrv_flush = raw_flush, -#ifdef CONFIG_AIO .bdrv_aio_readv = raw_aio_readv, .bdrv_aio_writev = raw_aio_writev, -#endif .bdrv_read = raw_read, .bdrv_write = raw_write, @@ -1195,10 +1179,8 @@ static BlockDriver bdrv_host_device = { /* generic scsi device */ #ifdef __linux__ .bdrv_ioctl = hdev_ioctl, -#ifdef CONFIG_AIO .bdrv_aio_ioctl = hdev_aio_ioctl, #endif -#endif }; #ifdef __linux__ @@ -1283,10 +1265,8 @@ static BlockDriver bdrv_host_floppy = { .bdrv_create = hdev_create, .bdrv_flush = raw_flush, -#ifdef CONFIG_AIO .bdrv_aio_readv = raw_aio_readv, .bdrv_aio_writev = raw_aio_writev, -#endif .bdrv_read = raw_read, .bdrv_write = raw_write, @@ -1365,10 +1345,8 @@ static BlockDriver bdrv_host_cdrom = { .bdrv_create = hdev_create, .bdrv_flush = raw_flush, -#ifdef CONFIG_AIO .bdrv_aio_readv = raw_aio_readv, .bdrv_aio_writev = raw_aio_writev, -#endif .bdrv_read = raw_read, .bdrv_write = raw_write, @@ -1381,9 +1359,7 @@ static BlockDriver bdrv_host_cdrom = { /* generic scsi device */ .bdrv_ioctl = hdev_ioctl, -#ifdef CONFIG_AIO .bdrv_aio_ioctl = hdev_aio_ioctl, -#endif }; #endif /* __linux__ */ @@ -1488,10 +1464,8 @@ static BlockDriver bdrv_host_cdrom = { .bdrv_create = hdev_create, .bdrv_flush = raw_flush, -#ifdef CONFIG_AIO .bdrv_aio_readv = raw_aio_readv, .bdrv_aio_writev = raw_aio_writev, -#endif .bdrv_read = raw_read, .bdrv_write = raw_write,