qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: damien.hedde@greensocs.com, berrange@redhat.com,
	mark.burton@greensocs.com, edgar.iglesias@gmail.co,
	mirela.grujic@greensocs.com, marcandre.lureau@redhat.com,
	pbonzini@redhat.com, jsnow@redhat.com
Subject: [PATCH RFC 10/11] vl: Disregard lack of 'allow-preconfig': true
Date: Thu,  2 Dec 2021 08:04:49 +0100	[thread overview]
Message-ID: <20211202070450.264743-11-armbru@redhat.com> (raw)
In-Reply-To: <20211202070450.264743-1-armbru@redhat.com>

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 --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;
 }
-- 
2.31.1



  parent reply	other threads:[~2021-12-02  7:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02  7:04 [PATCH RFC 00/11] vl: Explore redesign of startup Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 01/11] vl: Cut off the CLI with an axe Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 02/11] vl: Drop x-exit-preconfig Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 03/11] vl: Hardcode a QMP monitor on stdio for now Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 04/11] vl: Hardcode a VGA device " Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 05/11] vl: Demonstrate (bad) CLI wrapped around QMP Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 06/11] vl: Factor qemu_until_phase() out of qemu_init() Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 07/11] vl: Implement qemu_until_phase() running from arbitrary phase Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 08/11] vl: Implement qemu_until_phase() running to " Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 09/11] vl: New QMP command until-phase Markus Armbruster
2021-12-02  7:04 ` Markus Armbruster [this message]
2021-12-02  7:04 ` [PATCH RFC 11/11] vl: Enter main loop in phase @machine-initialized Markus Armbruster
2021-12-02 10:26 ` [PATCH RFC 00/11] vl: Explore redesign of startup Markus Armbruster
2021-12-07 16:52 ` Damien Hedde
2021-12-08  7:07   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211202070450.264743-11-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=damien.hedde@greensocs.com \
    --cc=edgar.iglesias@gmail.co \
    --cc=jsnow@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mark.burton@greensocs.com \
    --cc=mirela.grujic@greensocs.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).