Skip to contentSkip to conversation

meson: Try to clarify TCG / TCI options for new users

PATCH Superseded Philippe Mathieu-Daudé 3 participants 9 messages Jan 22, 2021 – Jan 25, 2021 Arm/Amlogic Meson SoC support

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover meson: Try to clarify TCG / TCI options for new users

Since v2:
- Included Thomas suggestions

Some new users get confused between 'TCG' and 'TCI' and enable TCI when TCG is better for they needs. Try to clarify it is better to not use TCI when native backend is available.

Note, before Meson, warnings were summarized at the end of ./configure. Now they are displayed earlier, and likely missed IMHO. No clue how to improve that :/

Based-on: <[email protected]>

Philippe Mathieu-Daudé (4):
meson: Explicit TCG backend used
meson: Warn when TCI is selected but TCG backend is available
configure: Improve TCI feature description
configure: Reword --enable-tcg-interpreter as --disable-native-tcg

 configure   |  5 +++--
 meson.build | 11 +++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH v3 1/4 meson: Explicit TCG backend used

---
 meson.build | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meson.build +6 -2
index 8535a83fb70..d5b76150e49 100644
@@ -229,7 +229,7 @@
 if not get_option('tcg').disabled()
   if cpu not in supported_cpus
     if 'CONFIG_TCG_INTERPRETER' in config_host
-      warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu))
+      warning('Unsupported CPU @0@, will use TCG with TCI (experimental and slow)'.format(cpu))
     else
       error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
     endif
@@ -2419,8 +2419,12 @@
 endif
 summary_info += {'TCG support':       config_all.has_key('CONFIG_TCG')}
 if config_all.has_key('CONFIG_TCG')
+  if config_host.has_key('CONFIG_TCG_INTERPRETER')
+    summary_info += {'TCG backend':   'TCG interpreter (experimental)'}
+  else
+    summary_info += {'TCG backend':   'native (@0@)'.format(cpu)}
+  endif
   summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
-  summary_info += {'TCG interpreter':   config_host.has_key('CONFIG_TCG_INTERPRETER')}
 endif
 summary_info += {'target list':       ' '.join(target_dirs)}
 if have_system
Signature · 1 line
2.26.2
#2 lore raw

PATCH v3 2/4 meson: Warn when TCI is selected but TCG backend is available

In reply to Philippe Mathieu-Daudé

Some new users get confused with 'TCG' and 'TCI', and enable TCI support expecting to enable TCG.

Emit a warning when native TCG backend is available on the host architecture, mentioning this is a suboptimal configuration.

---
 meson.build | 3 +++
 1 file changed, 3 insertions(+)
meson.build +3 -0
index d5b76150e49..d3df5fa3516 100644
@@ -234,6 +234,9 @@
       error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
     endif
   endif
+  if 'CONFIG_TCG_INTERPRETER' in config_host and cpu in supported_cpus
+    warning('Experimental TCI requested while native TCG is available on @0@, suboptimal performance expected'.format(cpu))
+  endif
   accelerators += 'CONFIG_TCG'
   config_host += { 'CONFIG_TCG': 'y' }
 endif
Signature · 1 line
2.26.2
#3 lore raw

Re: [PATCH v3 2/4] meson: Warn when TCI is selected but TCG backend is available

Quoted 18 lines · Philippe Mathieu-Daudé

Some new users get confused with 'TCG' and 'TCI', and enable TCI support expecting to enable TCG.

Emit a warning when native TCG backend is available on the host architecture, mentioning this is a suboptimal configuration.

---
 meson.build | 3 +++
 1 file changed, 3 insertions(+)
meson.build +0 -0
index d5b76150e49..d3df5fa3516 100644

meson.build line 239

Quoted 6 lines
meson.build +3 -0
@@ -234,6 +234,9 @@
       error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
     endif
   endif
+  if 'CONFIG_TCG_INTERPRETER' in config_host and cpu in supported_cpus
+    warning('Experimental TCI requested while native TCG is available on @0@, suboptimal performance expected'.format(cpu))
+  endif

warning('Use of the TCG interpretor is not recommended on this host
architecture. There is a native TCG execution backend available which provides substantially better performance and reliability. It is strongly recommended to remove the --enable-tcg-interpreter configuration option on this architecture to use the native backend.')

Regards,
Daniel

Signature · 3 lines
|: 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 :|
#4 lore raw

PATCH v3 3/4 configure: Improve TCI feature description

In reply to Philippe Mathieu-Daudé

Users might want to enable all features, without realizing some features have negative effect. Mention the TCI feature is slow and experimental, hoping it will be selected knowingly.

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index 9f016b06b54..48bd6f48d7a 100755
@@ -1753,7 +1753,7 @@ Advanced options (experts only):
   --with-trace-file=NAME   Full PATH,NAME of file to store traces
                            Default:trace-<pid>
   --disable-slirp          disable SLIRP userspace network connectivity
-  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
+  --enable-tcg-interpreter enable TCI (TCG with bytecode interpreter, experimental and slow)
   --enable-malloc-trim     enable libc malloc_trim() for memory optimization
   --oss-lib                path to OSS library
   --cpu=CPU                Build for host CPU [$cpu]
Signature · 1 line
2.26.2
#5 lore raw

PATCH v3 4/4 configure: Reword --enable-tcg-interpreter as --disable-native-tcg

In reply to Philippe Mathieu-Daudé

Users might want to enable all features, without realizing some features have negative effect. Rename '--enable-tcg-interpreter' as '--disable-native-tcg' to avoid user selecting this feature without understanding it. '--enable-tcg-interpreter' is kept in for backward compability with scripts.

---
 configure | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
configure +3 -2
index 48bd6f48d7a..5e5ff779a69 100755
@@ -1121,7 +1121,8 @@ for opt do
   ;;
   --disable-tcg-interpreter) tcg_interpreter="no"
   ;;
-  --enable-tcg-interpreter) tcg_interpreter="yes"
+  --enable-tcg-interpreter) # backward compatibility
+  --disable-native-tcg) tcg_interpreter="yes"
   ;;
   --disable-cap-ng)  cap_ng="disabled"
   ;;
@@ -1753,7 +1754,7 @@ Advanced options (experts only):
   --with-trace-file=NAME   Full PATH,NAME of file to store traces
                            Default:trace-<pid>
   --disable-slirp          disable SLIRP userspace network connectivity
-  --enable-tcg-interpreter enable TCI (TCG with bytecode interpreter, experimental and slow)
+  --disable-native-tcg     enable TCI (TCG with bytecode interpreter, experimental and slow)
   --enable-malloc-trim     enable libc malloc_trim() for memory optimization
   --oss-lib                path to OSS library
   --cpu=CPU                Build for host CPU [$cpu]
Signature · 1 line
2.26.2
#6 lore raw

Re: [PATCH v3 4/4] configure: Reword --enable-tcg-interpreter as --disable-native-tcg

Quoted 18 lines · Philippe Mathieu-Daudé

Users might want to enable all features, without realizing some features have negative effect. Rename '--enable-tcg-interpreter' as '--disable-native-tcg' to avoid user selecting this feature without understanding it. '--enable-tcg-interpreter' is kept in for backward compability with scripts.

---
  configure | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
configure +0 -0
index 48bd6f48d7a..5e5ff779a69 100755

configure for opt do · line 1124

Quoted 5 lines
configure +1 -1
@@ -1121,7 +1121,8 @@ for opt do
    ;;
    --disable-tcg-interpreter) tcg_interpreter="no"
    ;;
-  --enable-tcg-interpreter) tcg_interpreter="yes"
+  --enable-tcg-interpreter) # backward compatibility

Do you really want to break the old option?

Quoted 6 lines
configure +1 -0
+  --disable-native-tcg) tcg_interpreter="yes"
    ;;
    --disable-cap-ng)  cap_ng="disabled"
    ;;

configure Advanced options (experts only): · line 1760

Quoted 8 lines
configure +1 -1
@@ -1753,7 +1754,7 @@ Advanced options (experts only):
    --with-trace-file=NAME   Full PATH,NAME of file to store traces
                             Default:trace-<pid>
    --disable-slirp          disable SLIRP userspace network connectivity
-  --enable-tcg-interpreter enable TCI (TCG with bytecode interpreter, experimental and slow)
+  --disable-native-tcg     enable TCI (TCG with bytecode interpreter, experimental and slow)
    --enable-malloc-trim     enable libc malloc_trim() for memory optimization
    --oss-lib                path to OSS library
    --cpu=CPU                Build for host CPU [$cpu]

The problem here is that for some CPUs there is no native TCG... I mean, what's unclear in "exprimental and slow"?

Paolo

#7 lore raw

Re: [PATCH v3 4/4] configure: Reword --enable-tcg-interpreter as --disable-native-tcg

Quoted 14 lines · Paolo Bonzini
Quoted 13 lines · Philippe Mathieu-Daudé

Users might want to enable all features, without realizing some features have negative effect. Rename '--enable-tcg-interpreter' as '--disable-native-tcg' to avoid user selecting this feature without understanding it. '--enable-tcg-interpreter' is kept in for backward compability with scripts.

---
  configure | 5 +++--

  1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 12 lines
Quoted 10 lines
configure +0 -0
index 48bd6f48d7a..5e5ff779a69 100755
@@ -1121,7 +1121,8 @@ for opt do
     ;;

    --disable-tcg-interpreter) tcg_interpreter="no" ;;
-  --enable-tcg-interpreter) tcg_interpreter="yes" +  --enable-tcg-interpreter) # backward compatibility

Do you really want to break the old option?

I am not breaking it, I'm keeping it, but not listed in the help. Maybe you meant "not break the old option", in that case you suggest me to add a warning such "this option is deprecated and has been replaced by --disable-native-tcg"?

Quoted 13 lines
Quoted 13 lines

+  --disable-native-tcg) tcg_interpreter="yes"
    ;;
    --disable-cap-ng)  cap_ng="disabled"
    ;;

configure +0 -0
@@ -1753,7 +1754,7 @@ Advanced options (experts only):

    --with-trace-file=NAME   Full PATH,NAME of file to store traces Default:trace-<pid> --disable-slirp          disable SLIRP userspace network connectivity -  --enable-tcg-interpreter enable TCI (TCG with bytecode interpreter, experimental and slow)
+  --disable-native-tcg     enable TCI (TCG with bytecode interpreter, experimental and slow)

Quoted 8 lines
Quoted 5 lines

    --enable-malloc-trim     enable libc malloc_trim() for memory optimization
    --oss-lib                path to OSS library --cpu=CPU                Build for host CPU [$cpu]

The problem here is that for some CPUs there is no native TCG...  I mean, what's unclear in "exprimental and slow"?

OK, we can skip this patch then.

Quoted 3 lines

Paolo

#8 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 19 lines · Philippe Mathieu-Daudé

Since v2:
- Included Thomas suggestions

Some new users get confused between 'TCG' and 'TCI' and enable TCI when TCG is better for they needs. Try to clarify it is better to not use TCI when native backend is available.

Note, before Meson, warnings were summarized at the end of ./configure. Now they are displayed earlier, and likely missed IMHO. No clue how to improve that :/

Based-on: <[email protected]>

Philippe Mathieu-Daudé (4):
meson: Explicit TCG backend used
meson: Warn when TCI is selected but TCG backend is available
configure: Improve TCI feature description
configure: Reword --enable-tcg-interpreter as --disable-native-tcg

Quoted 4 lines
  configure   |  5 +++--
  meson.build | 11 +++++++++--
  2 files changed, 12 insertions(+), 4 deletions(-)

This will have to be reworked because the TCI option is moved to Meson in the pull request I have just sent, but patches 1-3 are good in concept.

Paolo