diff mbox series

[RFC,10/11] vl: Disregard lack of 'allow-preconfig': true

Message ID 20211202070450.264743-11-armbru@redhat.com (mailing list archive)
State New, archived
Headers show
Series vl: Explore redesign of startup | expand

Commit Message

Markus Armbruster Dec. 2, 2021, 7:04 a.m. UTC
I'd like to use device cold plug as an example for how how the user
can now interleave CLI with startup.  Doesn't work, because only
commands with 'allow-preconfig': true are available before phase
@machine-ready, and device_add isn't.  Instead of changing just
device_add, this hack allows all commands all the time, for easy
experimentation.  Some commands don't work, but this is RFC.

Hot pci-serial works:

    $ qemu-system-x86_64 '{"execute": "until-phase", "arguments": {"phase": "machine-ready"}}' '{"execute": "device_add", "arguments": {"driver": "pci-serial"}}'

Hot isa-serial fails as it should:

    $ qemu-system-x86_64 '{"execute": "until-phase", "arguments": {"phase": "machine-ready"}}' '{"execute": "device_add", "arguments": {"driver": "isa-serial"}}'
    [...]
    qemu-system-x86_64: {"execute": "device_add", "arguments": {"driver": "isa-serial"}}: Bus 'isa.0' does not support hotplugging

Cold isa-serial works:

    $ qemu-system-x86_64 '{"execute": "until-phase", "arguments": {"phase": "machine-initialized"}}' '{"execute": "device_add", "arguments": {"driver": "isa-serial"}}'

A command that works even in phase @no-machine:

    $ qemu-system-x86_64 '{"execute": "chardev-add", "arguments": {"id": "chr0", "backend": {"type": "null", "data": {}}}}'
    {"QMP": {"version": {"qemu": {"micro": 92, "minor": 1, "major": 6}, "package": "v6.2.0-rc2-38-gff2c6103bf"}, "capabilities": ["oob"]}}
    {"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}}
    {"return": {}}
    {"execute": "query-chardev"}
    {"return": [{"frontend-open": false, "filename": "null", "label": "chr0"}, {"frontend-open": true, "filename": "stdio", "label": "compat_monitor0"}]}

A command that doesn't work there:

    $ qemu-system-x86_64 '{"execute": "screendump", "arguments": {"filename": "scr"}}'
    qemu-system-x86_64: ../qapi/qmp-dispatch.c:226: qmp_dispatch: Assertion `!oob && qemu_in_coroutine() && !(cmd->options & QCO_COROUTINE)' failed.
    Aborted (core dumped)

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 softmmu/qdev-monitor.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index 067f6cdeab..ddb12c68e6 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -1041,11 +1041,13 @@  int qemu_global_option(const char *str)
 
 bool qmp_command_available(const QmpCommand *cmd, Error **errp)
 {
+#if 0
     if (!phase_check(PHASE_MACHINE_READY) &&
         !(cmd->options & QCO_ALLOW_PRECONFIG)) {
         error_setg(errp, "The command '%s' is permitted only after machine initialization has completed",
                    cmd->name);
         return false;
     }
+#endif
     return true;
 }