[Qemu-devel] [PATCH v2 01/15] configure: add the disable-tcg option

Yang Zhong posted 15 patches 8 years, 7 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v2 01/15] configure: add the disable-tcg option
Posted by Yang Zhong 8 years, 7 months ago
Add the disable-tcg option into configure and echo CONFIG_TCG=y into
$config_target_mak. The default tcg is enabled for all build, only i386
and x86_64 softmmu option can be disabled. 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 --target-list=x86_64-softmmu
   tcg is disabled in x86_64-softmmu

(3)./configure --disable-tcg --target-list=i386-softmmu
   tcg is disabled in i386-softmmu

If the --target-list include other softmmus or user options, the configure
command will report error and configure is aborted.
The error as:
ERROR: The current aarch64-softmmu can't support disable-tcg,
    only i386-softmmu|x86_64-softmmu support disable-tcg
or
ERROR: The user build can't support disable-tcg,
    only i386-softmmu|x86_64-softmmu support disable-tcg

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

diff --git a/configure b/configure
index c571ad1..61ce514 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"
@@ -1715,6 +1720,24 @@ case " $target_list " in
   ;;
 esac
 
+if test "$tcg" = "no"; then
+   for target in $target_list; do
+      if test "$softmmu" = "yes"; then
+        case $target in
+           i386-softmmu|x86_64-softmmu)
+           ;;
+        *)
+           error_exit "The current $target can't support disable-tcg,"\
+              "only i386-softmmu|x86_64-softmmu support disable-tcg"
+           ;;
+        esac
+     else
+        error_exit "The user build can't support disable-tcg,"\
+           "only i386-softmmu|x86_64-softmmu support disable-tcg"
+     fi
+   done
+fi
+
 feature_not_found() {
   feature=$1
   remedy=$2
@@ -5119,7 +5142,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"
@@ -5173,6 +5195,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"
@@ -6231,6 +6258,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
@@ -6250,6 +6278,19 @@ if test "$target_bsd_user" = "yes" ; then
   echo "CONFIG_BSD_USER=y" >> $config_target_mak
 fi
 
+if test "$target_softmmu" = "yes" ; then
+   case "$target_name" in
+     i386|x86_64)
+       if test "$tcg" = "yes" ; then
+         echo "CONFIG_TCG=y" >> $config_target_mak
+       fi
+       ;;
+     *)
+       echo "CONFIG_TCG=y" >> $config_target_mak
+       ;;
+   esac
+fi
+
 # generate QEMU_CFLAGS/LDFLAGS for targets
 
 cflags=""
-- 
1.9.1


Re: [Qemu-devel] [PATCH v2 01/15] configure: add the disable-tcg option
Posted by Daniel P. Berrange 8 years, 7 months ago
On Mon, Jul 03, 2017 at 06:12:09PM +0800, 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, only i386
> and x86_64 softmmu option can be disabled. 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 --target-list=x86_64-softmmu
>    tcg is disabled in x86_64-softmmu
> 
> (3)./configure --disable-tcg --target-list=i386-softmmu
>    tcg is disabled in i386-softmmu
> 
> If the --target-list include other softmmus or user options, the configure
> command will report error and configure is aborted.
> The error as:
> ERROR: The current aarch64-softmmu can't support disable-tcg,
>     only i386-softmmu|x86_64-softmmu support disable-tcg
> or
> ERROR: The user build can't support disable-tcg,
>     only i386-softmmu|x86_64-softmmu support disable-tcg
> 
> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> ---
>  configure | 43 ++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 42 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index c571ad1..61ce514 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"
> @@ -1715,6 +1720,24 @@ case " $target_list " in
>    ;;
>  esac
>  
> +if test "$tcg" = "no"; then
> +   for target in $target_list; do
> +      if test "$softmmu" = "yes"; then
> +        case $target in
> +           i386-softmmu|x86_64-softmmu)
> +           ;;
> +        *)
> +           error_exit "The current $target can't support disable-tcg,"\
> +              "only i386-softmmu|x86_64-softmmu support disable-tcg"
> +           ;;

This looks too simplistic in its logic.

You can disable TCG, if-and-only-if the system emulator supports KVM.

KVM is supported on many architectures, not only x86-64 & i386.

KVM is only supported if the guest emulator architecture matches the
host build target architecture.

ie if you are building an x86_64 system emulator on a PPC64 host,
then you can't disable TCG.

So this needs rewriting to *not* special case x86_64 / i386. Instead
you need to compare & match build target / system emulator architectures,
across all architectures supporting KVM.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [Qemu-devel] [PATCH v2 01/15] configure: add the disable-tcg option
Posted by Paolo Bonzini 8 years, 7 months ago

On 03/07/2017 12:20, Daniel P. Berrange wrote:
>>  
>> +if test "$tcg" = "no"; then
>> +   for target in $target_list; do
>> +      if test "$softmmu" = "yes"; then
>> +        case $target in
>> +           i386-softmmu|x86_64-softmmu)
>> +           ;;
>> +        *)
>> +           error_exit "The current $target can't support disable-tcg,"\
>> +              "only i386-softmmu|x86_64-softmmu support disable-tcg"
>> +           ;;
> This looks too simplistic in its logic.
> 
> You can disable TCG, if-and-only-if the system emulator supports KVM.
> 
> KVM is supported on many architectures, not only x86-64 & i386.
> 
> KVM is only supported if the guest emulator architecture matches the
> host build target architecture.
> 
> ie if you are building an x86_64 system emulator on a PPC64 host,
> then you can't disable TCG.
> 
> So this needs rewriting to *not* special case x86_64 / i386. Instead
> you need to compare & match build target / system emulator architectures,
> across all architectures supporting KVM.

i386-softmmu and x86_64-softmmu are singled out here, because they're
the only targets where --disable-tcg compiles.  For the others, more
work is needed (see patches 6-15 in Yang Zhong's series).

The part that is missing in this patch is disabling non-hypervisor
targets when --disable-tcg is specified.  My original patch built only
i386-softmmu and x86_64-softmmu if you specified --disable-tcg, see

https://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg02570.html
https://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg02571.html

Paolo

Re: [Qemu-devel] [PATCH v2 01/15] configure: add the disable-tcg option
Posted by Daniel P. Berrange 8 years, 7 months ago
On Mon, Jul 03, 2017 at 12:25:36PM +0200, Paolo Bonzini wrote:
> 
> 
> On 03/07/2017 12:20, Daniel P. Berrange wrote:
> >>  
> >> +if test "$tcg" = "no"; then
> >> +   for target in $target_list; do
> >> +      if test "$softmmu" = "yes"; then
> >> +        case $target in
> >> +           i386-softmmu|x86_64-softmmu)
> >> +           ;;
> >> +        *)
> >> +           error_exit "The current $target can't support disable-tcg,"\
> >> +              "only i386-softmmu|x86_64-softmmu support disable-tcg"
> >> +           ;;
> > This looks too simplistic in its logic.
> > 
> > You can disable TCG, if-and-only-if the system emulator supports KVM.
> > 
> > KVM is supported on many architectures, not only x86-64 & i386.
> > 
> > KVM is only supported if the guest emulator architecture matches the
> > host build target architecture.
> > 
> > ie if you are building an x86_64 system emulator on a PPC64 host,
> > then you can't disable TCG.
> > 
> > So this needs rewriting to *not* special case x86_64 / i386. Instead
> > you need to compare & match build target / system emulator architectures,
> > across all architectures supporting KVM.
> 
> i386-softmmu and x86_64-softmmu are singled out here, because they're
> the only targets where --disable-tcg compiles.  For the others, more
> work is needed (see patches 6-15 in Yang Zhong's series).

Even with that, you still can't disable TCG if building on a non-x86
host, since that'd leave you with no available CPU at all. So the
code still needs refactoring to check architectures properly.

> The part that is missing in this patch is disabling non-hypervisor
> targets when --disable-tcg is specified.  My original patch built only
> i386-softmmu and x86_64-softmmu if you specified --disable-tcg, see
> 
> https://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg02570.html
> https://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg02571.html

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [Qemu-devel] [PATCH v2 01/15] configure: add the disable-tcg option
Posted by Paolo Bonzini 8 years, 7 months ago

On 03/07/2017 12:33, Daniel P. Berrange wrote:
>> i386-softmmu and x86_64-softmmu are singled out here, because they're
>> the only targets where --disable-tcg compiles.  For the others, more
>> work is needed (see patches 6-15 in Yang Zhong's series).
>
> Even with that, you still can't disable TCG if building on a non-x86
> host, since that'd leave you with no available CPU at all. So the
> code still needs refactoring to check architectures properly.

It would leave you with a tools-only build; whether that's a good idea,
it's another story.  I think it's acceptable, but others may disagree.

Paolo

>> The part that is missing in this patch is disabling non-hypervisor
>> targets when --disable-tcg is specified.  My original patch built only
>> i386-softmmu and x86_64-softmmu if you specified --disable-tcg, see
>>
>> https://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg02570.html
>> https://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg02571.html

Re: [Qemu-devel] [PATCH v2 01/15] configure: add the disable-tcg option
Posted by Thomas Huth 8 years, 7 months ago
On 03.07.2017 12:55, Paolo Bonzini wrote:
> 
> 
> On 03/07/2017 12:33, Daniel P. Berrange wrote:
>>> i386-softmmu and x86_64-softmmu are singled out here, because they're
>>> the only targets where --disable-tcg compiles.  For the others, more
>>> work is needed (see patches 6-15 in Yang Zhong's series).
>>
>> Even with that, you still can't disable TCG if building on a non-x86
>> host, since that'd leave you with no available CPU at all. So the
>> code still needs refactoring to check architectures properly.
> 
> It would leave you with a tools-only build; whether that's a good idea,
> it's another story.  I think it's acceptable, but others may disagree.

I think this is OK for the first version. We still can refine the checks
later if we then think that there is a need for it.

 Thomas


Re: [Qemu-devel] [PATCH v2 01/15] configure: add the disable-tcg option
Posted by Daniel P. Berrange 8 years, 7 months ago
On Mon, Jul 03, 2017 at 12:55:04PM +0200, Paolo Bonzini wrote:
> 
> 
> On 03/07/2017 12:33, Daniel P. Berrange wrote:
> >> i386-softmmu and x86_64-softmmu are singled out here, because they're
> >> the only targets where --disable-tcg compiles.  For the others, more
> >> work is needed (see patches 6-15 in Yang Zhong's series).
> >
> > Even with that, you still can't disable TCG if building on a non-x86
> > host, since that'd leave you with no available CPU at all. So the
> > code still needs refactoring to check architectures properly.
> 
> It would leave you with a tools-only build; whether that's a good idea,
> it's another story.  I think it's acceptable, but others may disagree.

If you do 'configure --target-list=x86_64-softmmu --disable-tcg' on a
non-x86 host I would be surprised to find  x86_64-softmmu not built.
IMHO if you explicitly request system emulators and its not posisble
to build then, an error should be report, rather than silently ignoring
the request.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [Qemu-devel] [PATCH v2 01/15] configure: add the disable-tcg option
Posted by Paolo Bonzini 8 years, 7 months ago

On 03/07/2017 14:09, Daniel P. Berrange wrote:
>> It would leave you with a tools-only build; whether that's a good idea,
>> it's another story.  I think it's acceptable, but others may disagree.
> If you do 'configure --target-list=x86_64-softmmu --disable-tcg' on a
> non-x86 host I would be surprised to find  x86_64-softmmu not built.
> IMHO if you explicitly request system emulators and its not posisble
> to build then, an error should be report, rather than silently ignoring
> the request.

Technically you could build a qtest-only emulator, but I don't think
_that_ is a good idea (and it's not what the patch does).

Paolo