diff mbox

[01/15] configure: add the disable-tcg option

Message ID 1498040401-16361-2-git-send-email-yang.zhong@intel.com
State New
Headers show

Commit Message

Yang Zhong June 21, 2017, 10:19 a.m. UTC
Add the disable-tcg option into configure and echo CONFIG_TCG=y into
$config_target_mak. The default tcg is enabled for all build. If tcg
is disabled in the build, only i386|x86_64 softmmu option can be disabled,
other softmmu of tagets and users build defaultly enabled the tcg. This
operation do not make big change with the older build command.

The new configure build command like below
(1)./configure
   tcg is defaultly enabled
(2)./configure --disable-tcg
   tcg is disabled in i386 and x86_64 softmmu build
   tcg is enabled in others softmmu and all users build
(3)./configure --disable-tcg --target-list=x86_64-softmmu, x86_64-linux-user
   tcg is disabled in x86_64 softmmu build
   tcg is enabled in x86_64 linux user build

Signed-off-by: Yang Zhong <yang.zhong@intel.com>
---
 configure | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

Comments

Richard Henderson June 21, 2017, 10:33 p.m. UTC | #1
On 06/21/2017 03:19 AM, Yang Zhong wrote:
> +case "$target_name" in
> +  alpha|arm|armeb|aarch64|cris|hppa|lm32|m68k|microblaze|microblazeel|mips|mipsel| \
> +  mipsn32|mipsn32el|mips64|mips64el|moxie|nios2|or1k|ppc|ppcemb|ppc64|ppc64le|ppc64abi32| \
> +  sh4|sh4eb|sparc|sparc64|sparc32plus|s390x|tilegx|tricore|unicore32|xtensa|xtensaeb)
> +  if test "$target_softmmu" = "yes" ; then
> +    echo "CONFIG_TCG=y" >> $config_target_mak
> +  fi
> +  ;;
> +esac
> +case "$target_name" in
> +  i386|x86_64)
> +  if test "$tcg" = "yes" -a "$target_softmmu" = "yes" ; then
> +    echo "CONFIG_TCG=y" >> $config_target_mak
> +  fi
> +  ;;
> +esac

This is definitely the wrong way around.  Test for the thing you want to 
special case -- x86, when running on x86, and softmmu -- and then everything 
else via *.

I strongly suspect this test should be

   case "$cpu-$target-$tcg" in
   x86_64-i386-softmmu-no | x86_64-x86_64-softmmu-no)
     # CONFIG_TCG disabled.
     ;;
   *)
     echo "CONFIG_TCG=y" >> $config_target_mak
   esac

This is easily extendable to allow TCG to be disabled for other KVM hosts.


r~
Thomas Huth June 22, 2017, 4:20 a.m. UTC | #2
On 21.06.2017 12:19, Yang Zhong wrote:
> Add the disable-tcg option into configure and echo CONFIG_TCG=y into
> $config_target_mak. The default tcg is enabled for all build. If tcg
> is disabled in the build, only i386|x86_64 softmmu option can be disabled,
> other softmmu of tagets and users build defaultly enabled the tcg.
Why do you want to limit this disablement to x86 only? There are also
other architectures that support KVM (ARM, PPC, MIPS), so disabling TCG
might be possible there, too. So I think it might be better to check
whether KVM is possible instead.

 Thomas
Paolo Bonzini June 22, 2017, 6:22 a.m. UTC | #3
> On 21.06.2017 12:19, Yang Zhong wrote:
> > Add the disable-tcg option into configure and echo CONFIG_TCG=y into
> > $config_target_mak. The default tcg is enabled for all build. If tcg
> > is disabled in the build, only i386|x86_64 softmmu option can be disabled,
> > other softmmu of tagets and users build defaultly enabled the tcg.
> Why do you want to limit this disablement to x86 only? There are also
> other architectures that support KVM (ARM, PPC, MIPS), so disabling TCG
> might be possible there, too. So I think it might be better to check
> whether KVM is possible instead.

You need to be careful and not use any helper from e.g. KVM or migration
code.  So I would be very surprised if any other architecture compiles
with --disable-tcg.

Paolo
Thomas Huth June 22, 2017, 6:33 a.m. UTC | #4
On 22.06.2017 08:22, Paolo Bonzini wrote:
> 
>> On 21.06.2017 12:19, Yang Zhong wrote:
>>> Add the disable-tcg option into configure and echo CONFIG_TCG=y into
>>> $config_target_mak. The default tcg is enabled for all build. If tcg
>>> is disabled in the build, only i386|x86_64 softmmu option can be disabled,
>>> other softmmu of tagets and users build defaultly enabled the tcg.
>> Why do you want to limit this disablement to x86 only? There are also
>> other architectures that support KVM (ARM, PPC, MIPS), so disabling TCG
>> might be possible there, too. So I think it might be better to check
>> whether KVM is possible instead.
> 
> You need to be careful and not use any helper from e.g. KVM or migration
> code.  So I would be very surprised if any other architecture compiles
> with --disable-tcg.

OK, fair, but we finally might want to get there, so I think we should
allow the parameter in the configure script for other architectures,
too, and then fix the bugs once we can try it out.

 Thomas
Paolo Bonzini June 22, 2017, 9:26 a.m. UTC | #5
On 22/06/2017 08:33, Thomas Huth wrote:
> On 22.06.2017 08:22, Paolo Bonzini wrote:
>>
>>> On 21.06.2017 12:19, Yang Zhong wrote:
>>>> Add the disable-tcg option into configure and echo CONFIG_TCG=y into
>>>> $config_target_mak. The default tcg is enabled for all build. If tcg
>>>> is disabled in the build, only i386|x86_64 softmmu option can be disabled,
>>>> other softmmu of tagets and users build defaultly enabled the tcg.
>>> Why do you want to limit this disablement to x86 only? There are also
>>> other architectures that support KVM (ARM, PPC, MIPS), so disabling TCG
>>> might be possible there, too. So I think it might be better to check
>>> whether KVM is possible instead.
>>
>> You need to be careful and not use any helper from e.g. KVM or migration
>> code.  So I would be very surprised if any other architecture compiles
>> with --disable-tcg.
> 
> OK, fair, but we finally might want to get there, so I think we should
> allow the parameter in the configure script for other architectures,
> too, and then fix the bugs once we can try it out.

I think it's the other way round---when someone wants to fix it, they
should add their architecture to the list of targets that support
--disable-tcg.  "./configure <anything>", as a goal, should fail
immediately if make won't succeed; compilation errors are always a worse
experience.

Paolo
Thomas Huth June 22, 2017, 9:30 a.m. UTC | #6
On 22.06.2017 11:26, Paolo Bonzini wrote:
> 
> 
> On 22/06/2017 08:33, Thomas Huth wrote:
>> On 22.06.2017 08:22, Paolo Bonzini wrote:
>>>
>>>> On 21.06.2017 12:19, Yang Zhong wrote:
>>>>> Add the disable-tcg option into configure and echo CONFIG_TCG=y into
>>>>> $config_target_mak. The default tcg is enabled for all build. If tcg
>>>>> is disabled in the build, only i386|x86_64 softmmu option can be disabled,
>>>>> other softmmu of tagets and users build defaultly enabled the tcg.
>>>> Why do you want to limit this disablement to x86 only? There are also
>>>> other architectures that support KVM (ARM, PPC, MIPS), so disabling TCG
>>>> might be possible there, too. So I think it might be better to check
>>>> whether KVM is possible instead.
>>>
>>> You need to be careful and not use any helper from e.g. KVM or migration
>>> code.  So I would be very surprised if any other architecture compiles
>>> with --disable-tcg.
>>
>> OK, fair, but we finally might want to get there, so I think we should
>> allow the parameter in the configure script for other architectures,
>> too, and then fix the bugs once we can try it out.
> 
> I think it's the other way round---when someone wants to fix it, they
> should add their architecture to the list of targets that support
> --disable-tcg.  "./configure <anything>", as a goal, should fail
> immediately if make won't succeed; compilation errors are always a worse
> experience.

Fine for me, too, but then the configure script should exit with a
proper error message when the user tried to specify --disable-tcg on a
non-x86 architecture. If I get the current patch right, it silently
falls back to CONFIG_TCG=y instead, which is IMHO also a bad experience.

 Thomas
Paolo Bonzini June 22, 2017, 9:32 a.m. UTC | #7
On 22/06/2017 11:30, Thomas Huth wrote:
> On 22.06.2017 11:26, Paolo Bonzini wrote:
>>
>>
>> On 22/06/2017 08:33, Thomas Huth wrote:
>>> On 22.06.2017 08:22, Paolo Bonzini wrote:
>>>>
>>>>> On 21.06.2017 12:19, Yang Zhong wrote:
>>>>>> Add the disable-tcg option into configure and echo CONFIG_TCG=y into
>>>>>> $config_target_mak. The default tcg is enabled for all build. If tcg
>>>>>> is disabled in the build, only i386|x86_64 softmmu option can be disabled,
>>>>>> other softmmu of tagets and users build defaultly enabled the tcg.
>>>>> Why do you want to limit this disablement to x86 only? There are also
>>>>> other architectures that support KVM (ARM, PPC, MIPS), so disabling TCG
>>>>> might be possible there, too. So I think it might be better to check
>>>>> whether KVM is possible instead.
>>>>
>>>> You need to be careful and not use any helper from e.g. KVM or migration
>>>> code.  So I would be very surprised if any other architecture compiles
>>>> with --disable-tcg.
>>>
>>> OK, fair, but we finally might want to get there, so I think we should
>>> allow the parameter in the configure script for other architectures,
>>> too, and then fix the bugs once we can try it out.
>>
>> I think it's the other way round---when someone wants to fix it, they
>> should add their architecture to the list of targets that support
>> --disable-tcg.  "./configure <anything>", as a goal, should fail
>> immediately if make won't succeed; compilation errors are always a worse
>> experience.
> 
> Fine for me, too, but then the configure script should exit with a
> proper error message when the user tried to specify --disable-tcg on a
> non-x86 architecture. If I get the current patch right, it silently
> falls back to CONFIG_TCG=y instead, which is IMHO also a bad experience.

Yes, I agree.  Thanks for reviewing the patch.

Paolo
diff mbox

Patch

diff --git a/configure b/configure
index ff0f8b9..b4d80e5 100755
--- a/configure
+++ b/configure
@@ -224,6 +224,7 @@  cap_ng=""
 attr=""
 libattr=""
 xfs=""
+tcg="yes"
 
 vhost_net="no"
 vhost_scsi="no"
@@ -953,6 +954,10 @@  for opt do
   ;;
   --enable-hax) hax="yes"
   ;;
+  --disable-tcg) tcg="no"
+  ;;
+  --enable-tcg) tcg="yes"
+  ;;
   --disable-tcg-interpreter) tcg_interpreter="no"
   ;;
   --enable-tcg-interpreter) tcg_interpreter="yes"
@@ -5117,7 +5122,6 @@  echo "module support    $modules"
 echo "host CPU          $cpu"
 echo "host big endian   $bigendian"
 echo "target list       $target_list"
-echo "tcg debug enabled $debug_tcg"
 echo "gprof enabled     $gprof"
 echo "sparse enabled    $sparse"
 echo "strip binaries    $strip_opt"
@@ -5171,6 +5175,11 @@  echo "Linux AIO support $linux_aio"
 echo "ATTR/XATTR support $attr"
 echo "Install blobs     $blobs"
 echo "KVM support       $kvm"
+echo "TCG support       $tcg"
+if test "$tcg" = "yes" ; then
+    echo "TCG debug enabled $debug_tcg"
+    echo "TCG interpreter   $tcg_interpreter"
+fi
 echo "HAX support       $hax"
 echo "RDMA support      $rdma"
 echo "TCG interpreter   $tcg_interpreter"
@@ -6229,6 +6238,7 @@  fi
 if test "$target_user_only" = "yes" ; then
   echo "CONFIG_USER_ONLY=y" >> $config_target_mak
   echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
+  echo "CONFIG_TCG=y" >> $config_target_mak
 fi
 if test "$target_linux_user" = "yes" ; then
   echo "CONFIG_LINUX_USER=y" >> $config_target_mak
@@ -6248,6 +6258,22 @@  if test "$target_bsd_user" = "yes" ; then
   echo "CONFIG_BSD_USER=y" >> $config_target_mak
 fi
 
+case "$target_name" in
+  alpha|arm|armeb|aarch64|cris|hppa|lm32|m68k|microblaze|microblazeel|mips|mipsel| \
+  mipsn32|mipsn32el|mips64|mips64el|moxie|nios2|or1k|ppc|ppcemb|ppc64|ppc64le|ppc64abi32| \
+  sh4|sh4eb|sparc|sparc64|sparc32plus|s390x|tilegx|tricore|unicore32|xtensa|xtensaeb)
+  if test "$target_softmmu" = "yes" ; then
+    echo "CONFIG_TCG=y" >> $config_target_mak
+  fi
+  ;;
+esac
+case "$target_name" in
+  i386|x86_64)
+  if test "$tcg" = "yes" -a "$target_softmmu" = "yes" ; then
+    echo "CONFIG_TCG=y" >> $config_target_mak
+  fi
+  ;;
+esac
 # generate QEMU_CFLAGS/LDFLAGS for targets
 
 cflags=""