On 11/06/2024 08:57, Daniel P. Berrangé wrote:

On Tue, Jun 11, 2024 at 07:49:12AM +0200, Markus Armbruster wrote:
Philippe Mathieu-Daudé <phi...@linaro.org> writes:

Officialise the QMP command, use the existing
hmp_info_human_readable_text() helper.

I'm not sure "officialise" is a word :)

Taking a step back...  "info via" and its new QMP counterpart
x-query-mos6522-devices dump device state.  I understand why examining
device state via monitor can be useful for debugging.  However, we have
more than 2000 devices in the tree.  Clearly, we don't want 2000 device
state queries.  Not even 100.  Could we have more generic means instead?

We could use QOM (read-only) properties to expose device state.

If we use one QOM property per "thing", examining device state becomes
quite tedious.  Also, you'd have to stop the guest to get a consistent
view, and adding lots of QOM properties bloats the code.

If we use a single, object-valued property for the entire state, we get
to define the objects in QAPI.  Differently tedious, and bloats the
generated code.

We could use a single string-valued property.  Too much of an abuse of
QOM?

Yeah, I'd suggest we just keep it dumb and free form, adding a
callback like this to the QOM base class:

   HumanReadableText (*debug_state)(Error **errp);

I think that's a little bit too restrictive: certainly I can see the need for allowing parameters for the output to be customised, and there may also be cases where a device may want to register more than one debug (or monitor) command.

Currently I quite like Manos' solution since it allows a MonitorInterface to be defined, and that could have separate methods for registering both "info" and "debug" commands. Longer term this could allow for e.g. TYPE_TCG_ACCEL to register "info jit" and devices can add whatever debug monitor commands they need.


ATB,

Mark.


Reply via email to