qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Markus Armbruster" <armbru@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Cc: Eric Blake <eblake@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 0/5] Stop adding HMP-only commands, allow QMP for all
Date: Wed, 8 Sep 2021 18:15:57 +0200	[thread overview]
Message-ID: <e1ad6243-7967-3035-d6db-f6b3087a620c@redhat.com> (raw)
In-Reply-To: <875yvbrtnq.fsf@dusky.pond.sub.org>

On 9/8/21 5:09 PM, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
> 
>> We are still adding HMP commands without any QMP counterparts. This is
>> done because there are a reasonable number of scenarios where the cost
>> of designing a QAPI data type for the command is not justified.
>>
>> This has the downside, however, that we will never be able to fully
>> isolate the monitor code from the remainder of QEMU internals. It is
>> desirable to be able to get to a point where subsystems in QEMU are
>> exclusively implemented using QAPI types and never need to have any
>> knowledge of the monitor APIs.
>>
>> The way to get there is to stop adding commands to HMP only. All
>> commands must be implemented using QMP, and any HMP implementation
>> be a shim around the QMP implementation.
>>
>> We don't want to compromise our supportability of QMP long term though.
>>
>> This series proposes that we relax our requirements around fine grained
>> QAPI data design,
> 
> Specifics?  QMP command returns a string, HMP wrapper prints that
> string?
> 
>>                   but with the caveat that any command taking this
>> design approach is mandated to use the 'x-' name prefix.
>>
>> This tradeoff should be suitable for any commands we have been adding
>> exclusively to HMP in recent times, and thus mean we have mandate QMP
>> support for all new commands going forward.
>>
>> This series illustrates the concept by converting the "info registers"
>> HMP to invoke a new 'x-query-registers' QMP command. Note that only
>> the i386 CPU target is converted to work with this new approach, so
>> this series needs to be considered incomplete. If we go forward with
>> this idea, then a subsequent version of this series would need to
>> obviously convert all other CPU targets.
>>
>> After doing that conversion the only use of qemu_fprintf() would be
>> the disas.c file. Remaining uses of qemu_fprintf and qemu_printf
>> could be tackled in a similar way and eventually eliminate the need
>> for any of these printf wrappers in QEMU.
>>
>> NB: I added docs to devel/writing-qmp-commands.rst about the two
>> design approaches to QMP. I didn't see another good place to put
>> an explicit note that we will not add any more HMP-only commands.
>> Obviously HMP/QMP maintainers control this in their reviews of
>> patches, and maybe that's sufficient ?
> 
> We could add devel/writing-hmp-commands.rst, or go with a single
> document devel/writing-monitor-commands.rst.
> 
>> NB: if we take this approach we'll want to figure out how many
>> HMP-only commands we actually have left and then perhaps have
>> HMP-only commands we actually have left
> 
> Yes.
> 
> For many HMP commands, a QMP commands with the same name exists, and the
> former is probably a wrapper around the latter.  Same for HMP "info FOO"
> and QMP query-FOO.
> 
> HMP commands without such a match:

(1) Handy HMP commands while debugging:

- help
- info *
- i/o
- loadvm/savevm
- trace-event/trace-file
- wavcapture/stopcapture
- xp

Eventually also:

- hostfwd_add/hostfwd_remove
- log
- logfile
- print
- sendkey

(2) I suppose these are pre-QMP and wonder about their
    usefulness in the monitor (I'd certainly use a QMP
    equivalent to test).

- migrate_set_capability
- migrate_set_parameter
- migration_mode
- mouse_button
- mouse_move
- mouse_set
- nmi
- pcie_aer_inject_error
- exit_preconfig
- singlestep
- snapshot_blkdev_internal
- snapshot_delete_blkdev_internal

(3) I don't use them, I expect them to belong
    in either (1) or (2).

>     boot_set
>     change
>     commit
>     cpu
>     delvm
>     drive_add
>     drive_del
>     gdbserver
>     gpa2hpa
>     gpa2hva
>     gva2gpa
>     mce
>     qemu-io
>     snapshot_blkdev
>     sum
>     sync-profile
>     watchdog_action

> 
> This is 77 out of 170 HMP commands.  I was hoping for fewer.



  parent reply	other threads:[~2021-09-08 16:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 10:37 [PATCH 0/5] Stop adding HMP-only commands, allow QMP for all Daniel P. Berrangé
2021-09-08 10:37 ` [PATCH 1/5] docs/devel: document expectations for QAPI data modelling for QMP Daniel P. Berrangé
2021-09-08 17:42   ` Eric Blake
2021-09-09  9:33   ` Markus Armbruster
2021-09-10 12:46     ` Daniel P. Berrangé
2021-09-10 13:45       ` Markus Armbruster
2021-09-10 13:52         ` Daniel P. Berrangé
2021-09-08 10:37 ` [PATCH 2/5] hw/core: introduce 'format_state' callback to replace 'dump_state' Daniel P. Berrangé
2021-09-08 10:37 ` [PATCH 3/5] target/i386: convert to use format_state instead of dump_state Daniel P. Berrangé
2021-09-08 12:17   ` Ján Tomko
2021-09-08 18:05   ` Eric Blake
2021-09-08 22:06     ` Daniel P. Berrangé
2021-09-09  9:55       ` Daniel P. Berrangé
2021-09-08 10:37 ` [PATCH 4/5] qapi: introduce x-query-registers QMP command Daniel P. Berrangé
2021-09-08 18:06   ` Eric Blake
2021-09-09  9:05   ` Markus Armbruster
2021-09-09 10:01     ` Daniel P. Berrangé
2021-09-08 10:37 ` [PATCH 5/5] monitor: rewrite 'info registers' in terms of 'x-query-registers' Daniel P. Berrangé
2021-09-08 11:01   ` Philippe Mathieu-Daudé
2021-09-08 11:02     ` Daniel P. Berrangé
2021-09-08 12:18 ` [PATCH 0/5] Stop adding HMP-only commands, allow QMP for all Ján Tomko
2021-09-08 15:09 ` Markus Armbruster
2021-09-08 15:24   ` Daniel P. Berrangé
2021-09-09  4:48     ` Markus Armbruster
2021-09-09  8:13       ` Markus Armbruster
2021-09-09  8:40       ` Daniel P. Berrangé
2021-09-08 16:15   ` Philippe Mathieu-Daudé [this message]
2021-09-09  6:15   ` Paolo Bonzini

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=e1ad6243-7967-3035-d6db-f6b3087a620c@redhat.com \
    --to=philmd@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@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).