Skip to contentSkip to conversation

Replace '-machine accel=xyz' with '-accel xyz'

PATCH Applied Thomas Huth 4 participants 6 messages Sep 4, 2019 – Sep 23, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Replace '-machine accel=xyz' with '-accel xyz'

We've got a separate option to configure the accelerator nowadays, which is shorter to type and the preferred way of specifying an accelerator. Use it in the source and examples to show that it is the favored option. (However, do not touch the places yet which also specify other machine options or multiple accelerators - these are currently still better handled with one single "-machine" statement instead)

---
 python/qemu/qtest.py                | 2 +-
 qemu-deprecated.texi                | 3 +--
 qemu-options.hx                     | 2 +-
 tests/libqtest.c                    | 2 +-
 tests/migration/guestperf/engine.py | 2 +-
 tests/qemu-iotests/172              | 2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)
python/qemu/qtest.py +1 -1
index eebcc233ed..3f1d2cb325 100644
@@ -96,7 +96,7 @@ class QEMUQtestMachine(QEMUMachine):
     def _base_args(self):
         args = super(QEMUQtestMachine, self)._base_args()
         args.extend(['-qtest', 'unix:path=' + self._qtest_path,
-                     '-machine', 'accel=qtest'])
+                     '-accel', 'qtest'])
         return args
 
     def _pre_launch(self):
qemu-deprecated.texi +1 -2
index 00a4b6f350..0982e41698 100644
@@ -26,8 +26,7 @@ The @option{enforce-config-section} parameter is replaced by the
 
 @subsection -no-kvm (since 1.3.0)
 
-The ``-no-kvm'' argument is now a synonym for setting
-``-machine accel=tcg''.
+The ``-no-kvm'' argument is now a synonym for setting ``-accel tcg''.
 
 @subsection -usbdevice (since 2.10.0)
 
qemu-options.hx +1 -1
index 09e6439646..e0bba2abd1 100644
@@ -4156,7 +4156,7 @@ STEXI
 Enable FIPS 140-2 compliance mode.
 ETEXI
 
-HXCOMM Deprecated by -machine accel=tcg property
+HXCOMM Deprecated by -accel tcg
 DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386)
 
 DEF("msg", HAS_ARG, QEMU_OPTION_msg,
tests/libqtest.c +1 -1
index 2713b86cf7..67e39c59e7 100644
@@ -238,7 +238,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
                               "-qtest-log %s "
                               "-chardev socket,path=%s,id=char0 "
                               "-mon chardev=char0,mode=control "
-                              "-machine accel=qtest "
+                              "-accel qtest "
                               "-display none "
                               "%s", qemu_binary, socket_path,
                               getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null",
tests/migration/guestperf/engine.py +1 -1
index f13dbea800..1dd04ce33b 100644
@@ -287,7 +287,7 @@ class Engine(object):
             cmdline = "'" + cmdline + "'"
 
         argv = [
-            "-machine", "accel=kvm",
+            "-accel", "kvm",
             "-cpu", "host",
             "-kernel", self._kernel,
             "-initrd", self._initrd,
tests/qemu-iotests/172 +1 -1
index ba7dad9057..d67997e5f6 100755
@@ -55,7 +55,7 @@ do_run_qemu()
             done
         fi
         echo quit
-    ) | $QEMU -machine accel=qtest -nographic -monitor stdio -serial none "$@"
+    ) | $QEMU -accel qtest -nographic -monitor stdio -serial none "$@"
     echo
 }
 
Signature · 1 line
2.18.1
Acked-by on v1 1/1
#1 lore raw
Quoted 89 lines · Thomas Huth

We've got a separate option to configure the accelerator nowadays, which is shorter to type and the preferred way of specifying an accelerator. Use it in the source and examples to show that it is the favored option. (However, do not touch the places yet which also specify other machine options or multiple accelerators - these are currently still better handled with one single "-machine" statement instead)

---
 python/qemu/qtest.py                | 2 +-
 qemu-deprecated.texi                | 3 +--
 qemu-options.hx                     | 2 +-
 tests/libqtest.c                    | 2 +-
 tests/migration/guestperf/engine.py | 2 +-
 tests/qemu-iotests/172              | 2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)
python/qemu/qtest.py +1 -1
index eebcc233ed..3f1d2cb325 100644
@@ -96,7 +96,7 @@ class QEMUQtestMachine(QEMUMachine):
     def _base_args(self):
         args = super(QEMUQtestMachine, self)._base_args()
         args.extend(['-qtest', 'unix:path=' + self._qtest_path,
-                     '-machine', 'accel=qtest'])
+                     '-accel', 'qtest'])
         return args
 
     def _pre_launch(self):
qemu-deprecated.texi +1 -2
index 00a4b6f350..0982e41698 100644
@@ -26,8 +26,7 @@ The @option{enforce-config-section} parameter is replaced by the
 
 @subsection -no-kvm (since 1.3.0)
 
-The ``-no-kvm'' argument is now a synonym for setting
-``-machine accel=tcg''.
+The ``-no-kvm'' argument is now a synonym for setting ``-accel tcg''.
 
 @subsection -usbdevice (since 2.10.0)
 
qemu-options.hx +1 -1
index 09e6439646..e0bba2abd1 100644
@@ -4156,7 +4156,7 @@ STEXI
 Enable FIPS 140-2 compliance mode.
 ETEXI
 
-HXCOMM Deprecated by -machine accel=tcg property
+HXCOMM Deprecated by -accel tcg
 DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386)
 
 DEF("msg", HAS_ARG, QEMU_OPTION_msg,
tests/libqtest.c +1 -1
index 2713b86cf7..67e39c59e7 100644
@@ -238,7 +238,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
                               "-qtest-log %s "
                               "-chardev socket,path=%s,id=char0 "
                               "-mon chardev=char0,mode=control "
-                              "-machine accel=qtest "
+                              "-accel qtest "
                               "-display none "
                               "%s", qemu_binary, socket_path,
                               getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null",
tests/migration/guestperf/engine.py +1 -1
index f13dbea800..1dd04ce33b 100644
@@ -287,7 +287,7 @@ class Engine(object):
             cmdline = "'" + cmdline + "'"
 
         argv = [
-            "-machine", "accel=kvm",
+            "-accel", "kvm",
             "-cpu", "host",
             "-kernel", self._kernel,
             "-initrd", self._initrd,
tests/qemu-iotests/172 +0 -0
index ba7dad9057..d67997e5f6 100755

tests/qemu-iotests/172 do_run_qemu() · line 61

Quoted 8 lines
tests/qemu-iotests/172 +1 -1
@@ -55,7 +55,7 @@ do_run_qemu()
             done
         fi
         echo quit
-    ) | $QEMU -machine accel=qtest -nographic -monitor stdio -serial none "$@"
+    ) | $QEMU -accel qtest -nographic -monitor stdio -serial none "$@"
     echo
 }
 

Thanks. While "-accel kvm:tcg" is not going to be supported, the above replacement are all good.

Paolo

#2 lore raw

On 09/09/2019 19.06, Paolo Bonzini wrote:
[...]

Quoted 3 lines

Thanks. While "-accel kvm:tcg" is not going to be supported, the above replacement are all good.

I guess we should really do something about that before people start using it in the wild...

Thomas

Reviewed-by Richard Henderson
#3 lore raw
In reply to Paolo Bonzini
Quoted 101 lines · Paolo Bonzini
Quoted 89 lines · Thomas Huth

We've got a separate option to configure the accelerator nowadays, which is shorter to type and the preferred way of specifying an accelerator. Use it in the source and examples to show that it is the favored option. (However, do not touch the places yet which also specify other machine options or multiple accelerators - these are currently still better handled with one single "-machine" statement instead)

---
 python/qemu/qtest.py                | 2 +-
 qemu-deprecated.texi                | 3 +--
 qemu-options.hx                     | 2 +-
 tests/libqtest.c                    | 2 +-
 tests/migration/guestperf/engine.py | 2 +-
 tests/qemu-iotests/172              | 2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)
python/qemu/qtest.py +1 -1
index eebcc233ed..3f1d2cb325 100644
@@ -96,7 +96,7 @@ class QEMUQtestMachine(QEMUMachine):
     def _base_args(self):
         args = super(QEMUQtestMachine, self)._base_args()
         args.extend(['-qtest', 'unix:path=' + self._qtest_path,
-                     '-machine', 'accel=qtest'])
+                     '-accel', 'qtest'])
         return args
 
     def _pre_launch(self):
qemu-deprecated.texi +1 -2
index 00a4b6f350..0982e41698 100644
@@ -26,8 +26,7 @@ The @option{enforce-config-section} parameter is replaced by the
 
 @subsection -no-kvm (since 1.3.0)
 
-The ``-no-kvm'' argument is now a synonym for setting
-``-machine accel=tcg''.
+The ``-no-kvm'' argument is now a synonym for setting ``-accel tcg''.
 
 @subsection -usbdevice (since 2.10.0)
 
qemu-options.hx +1 -1
index 09e6439646..e0bba2abd1 100644
@@ -4156,7 +4156,7 @@ STEXI
 Enable FIPS 140-2 compliance mode.
 ETEXI
 
-HXCOMM Deprecated by -machine accel=tcg property
+HXCOMM Deprecated by -accel tcg
 DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386)
 
 DEF("msg", HAS_ARG, QEMU_OPTION_msg,
tests/libqtest.c +1 -1
index 2713b86cf7..67e39c59e7 100644
@@ -238,7 +238,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
                               "-qtest-log %s "
                               "-chardev socket,path=%s,id=char0 "
                               "-mon chardev=char0,mode=control "
-                              "-machine accel=qtest "
+                              "-accel qtest "
                               "-display none "
                               "%s", qemu_binary, socket_path,
                               getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null",
tests/migration/guestperf/engine.py +1 -1
index f13dbea800..1dd04ce33b 100644
@@ -287,7 +287,7 @@ class Engine(object):
             cmdline = "'" + cmdline + "'"
 
         argv = [
-            "-machine", "accel=kvm",
+            "-accel", "kvm",
             "-cpu", "host",
             "-kernel", self._kernel,
             "-initrd", self._initrd,
tests/qemu-iotests/172 +0 -0
index ba7dad9057..d67997e5f6 100755

tests/qemu-iotests/172 do_run_qemu() · line 61

Quoted 8 lines
tests/qemu-iotests/172 +1 -1
@@ -55,7 +55,7 @@ do_run_qemu()
             done
         fi
         echo quit
-    ) | $QEMU -machine accel=qtest -nographic -monitor stdio -serial none "$@"
+    ) | $QEMU -accel qtest -nographic -monitor stdio -serial none "$@"
     echo
 }
 
Quoted 2 lines

Thanks. While "-accel kvm:tcg" is not going to be supported, the above replacement are all good.

-accel is yet another convenience option. We have so many of them. I dislike the complexity they add to the CLI. Here's how this one got in:

commit 8d4e9146b3568022ea5730d92841345d41275d66

Author: KONRAD Frederic <[email protected]>
Date:   Thu Feb 23 18:29:08 2017 +0000

tcg: add options for enabling MTTCG

We know there will be cases where MTTCG won't work until additional work is done in the front/back ends to support. It will however be useful to be able to turn it on.

As a result MTTCG will default to off unless the combination is supported. However the user can turn it on for the sake of testing.

[AJB: move to -accel tcg,thread=multi|single, defaults]

Not a peep on why the existing options are so insufficient we must have another one.

Our CLI will remain the steaming mess it has become until we reform the habits that got us there.

No objection to your patch.

#4 lore raw
Quoted 21 lines · Markus Armbruster

-accel is yet another convenience option. We have so many of them. I dislike the complexity they add to the CLI. Here's how this one got in:

commit 8d4e9146b3568022ea5730d92841345d41275d66

Author: KONRAD Frederic <[email protected]>
Date:   Thu Feb 23 18:29:08 2017 +0000

tcg: add options for enabling MTTCG

We know there will be cases where MTTCG won't work until additional work is done in the front/back ends to support. It will however be useful to be able to turn it on.

As a result MTTCG will default to off unless the combination is supported. However the user can turn it on for the sake of testing.

[AJB: move to -accel tcg,thread=multi|single, defaults]
Quoted 5 lines

Not a peep on why the existing options are so insufficient we must have another one.

Our CLI will remain the steaming mess it has become until we reform the habits that got us there.

-accel's accel suboption is currently defined as a convenience option, but it shouldn't be. It's the older "-M accel=foo:bar" that should become "-accel foo -accel bar" and -accel then is the preferred way.

The existing option "-M accel" was insufficient because it didn't allow accelerator-specific suboptions; they were all over the place ("-machine kernel_irqchip", "-tb-size", etc.) and indeed mostly in wrong places.

Paolo

#5 lore raw
In reply to Thomas Huth

Le 04/09/2019 à 07:27, Thomas Huth a écrit :

Quoted 89 lines

We've got a separate option to configure the accelerator nowadays, which is shorter to type and the preferred way of specifying an accelerator. Use it in the source and examples to show that it is the favored option. (However, do not touch the places yet which also specify other machine options or multiple accelerators - these are currently still better handled with one single "-machine" statement instead)

---
 python/qemu/qtest.py                | 2 +-
 qemu-deprecated.texi                | 3 +--
 qemu-options.hx                     | 2 +-
 tests/libqtest.c                    | 2 +-
 tests/migration/guestperf/engine.py | 2 +-
 tests/qemu-iotests/172              | 2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)
python/qemu/qtest.py +1 -1
index eebcc233ed..3f1d2cb325 100644
@@ -96,7 +96,7 @@ class QEMUQtestMachine(QEMUMachine):
     def _base_args(self):
         args = super(QEMUQtestMachine, self)._base_args()
         args.extend(['-qtest', 'unix:path=' + self._qtest_path,
-                     '-machine', 'accel=qtest'])
+                     '-accel', 'qtest'])
         return args
 
     def _pre_launch(self):
qemu-deprecated.texi +1 -2
index 00a4b6f350..0982e41698 100644
@@ -26,8 +26,7 @@ The @option{enforce-config-section} parameter is replaced by the
 
 @subsection -no-kvm (since 1.3.0)
 
-The ``-no-kvm'' argument is now a synonym for setting
-``-machine accel=tcg''.
+The ``-no-kvm'' argument is now a synonym for setting ``-accel tcg''.
 
 @subsection -usbdevice (since 2.10.0)
 
qemu-options.hx +1 -1
index 09e6439646..e0bba2abd1 100644
@@ -4156,7 +4156,7 @@ STEXI
 Enable FIPS 140-2 compliance mode.
 ETEXI
 
-HXCOMM Deprecated by -machine accel=tcg property
+HXCOMM Deprecated by -accel tcg
 DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386)
 
 DEF("msg", HAS_ARG, QEMU_OPTION_msg,
tests/libqtest.c +1 -1
index 2713b86cf7..67e39c59e7 100644
@@ -238,7 +238,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
                               "-qtest-log %s "
                               "-chardev socket,path=%s,id=char0 "
                               "-mon chardev=char0,mode=control "
-                              "-machine accel=qtest "
+                              "-accel qtest "
                               "-display none "
                               "%s", qemu_binary, socket_path,
                               getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null",
tests/migration/guestperf/engine.py +1 -1
index f13dbea800..1dd04ce33b 100644
@@ -287,7 +287,7 @@ class Engine(object):
             cmdline = "'" + cmdline + "'"
 
         argv = [
-            "-machine", "accel=kvm",
+            "-accel", "kvm",
             "-cpu", "host",
             "-kernel", self._kernel,
             "-initrd", self._initrd,
tests/qemu-iotests/172 +0 -0
index ba7dad9057..d67997e5f6 100755

tests/qemu-iotests/172 do_run_qemu() · line 61

Quoted 8 lines
tests/qemu-iotests/172 +1 -1
@@ -55,7 +55,7 @@ do_run_qemu()
             done
         fi
         echo quit
-    ) | $QEMU -machine accel=qtest -nographic -monitor stdio -serial none "$@"
+    ) | $QEMU -accel qtest -nographic -monitor stdio -serial none "$@"
     echo
 }
 

Applied to my trivial-patches branch.

Thanks,
Laurent