qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG


From: Stefano Stabellini
Subject: Re: [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG
Date: Mon, 5 Sep 2011 15:53:36 +0100
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

On Fri, 2 Sep 2011, Anthony Liguori wrote:
> Hi,
> 
> There have been a few attempts in the past to allow TCG to be disabled
> at build time.  Recently, Alex made the suggestion that we could do it by 
> using
> the same trick that we used to introduce kvm support.  That involves 
> introducing
> a tcg_enabled() macro that will be (0) if TCG is disabled in the build.
> 
> GCC is smart enough to do dead code elimination if it sees an if (0) and the
> result is that if you can do:
> 
> if (tcg_enabled()) {
>   foo();
> }
> 
> and it's more or less equivalent to:
> 
> #ifdef CONFIG_TCG
>   foo();
> #endif
> 
> Without the ugliness that comes from using the preprocessor.  I think this 
> ended
> up being pretty straight forward.  exec.c could use a fair bit of cleanup but
> other than that, this pretty much eliminates all of the TCG code from the 
> build.
> 
> This absolutely is going to break non-x86 KVM builds if they use the
> --disable-tcg flag as I haven't tested those yet.  The normal TCG build
> shouldn't be affected at all though.
> 
> In principle, the code assumes that you need KVM if you don't have TCG.  Of
> course, some extra logic could be added to allow for Xen if TCG isn't present.

I like the goal if the series very much and compilation with
--disable-tcg --enable-xen works out of the box!


However there are two problems:

- compilation with --disable-kvm --disable-xen (--enable-tcg) breaks on
my box, log attached;

- the automatic filtering on the target list introduced by the first
patch effectively prevents users from enabling xen with --disable-tcg,
unless they also enable kvm. See appended patch.



diff --git a/configure b/configure
index 3f2cf6a..64f85b6 100755
--- a/configure
+++ b/configure
@@ -3148,7 +3148,7 @@ if test "$static" = "no" -a "$user_pie" = "yes" ; then
   echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
 fi
 
-kvm_incompatible() {
+virt_incompatible() {
     if test "$kvm" = "yes" -a \
       \( "$1" = "$cpu" -o \
       \( "$1" = "ppcemb" -a "$cpu" = "ppc" \) -o \
@@ -3158,9 +3158,14 @@ kvm_incompatible() {
       \( "$1" = "x86_64" -a "$cpu" = "i386"   \) -o \
       \( "$1" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
        return 1
-    else
-       return 0
     fi
+    if test "$xen" = "yes" -a \ 
+      \( "$1" = "$cpu" -o \
+      \( "$1" = "x86_64" -a "$cpu" = "i386"   \) -o \
+      \( "$1" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
+       return 1
+    fi
+    return 0
 }
 
 target_list2=
@@ -3219,7 +3224,7 @@ if test "$tcg" = "no"; then
     if test "$target_softmmu" = "no"; then
        continue;
     fi
-    if kvm_incompatible "$target_arch2"; then
+    if virt_incompatible "$target_arch2"; then
        continue;
     fi
 fi

Attachment: log.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]