Re: [PATCH v5 12/12] RFC: monitor: add 'info ramblock-attributes' command

Markus Armbruster <[email protected]> Mon, 08 Jun 2026 15:36:06 +0200
Newsgroups org.nongnu.qemu-rust,org.kernel.vger.kvm,org.nongnu.qemu-devel
Message-ID <[email protected]>
"Dr. David Alan Gilbert" <[email protected]> writes:

> * Marc-Andr=C3=A9 Lureau ([email protected]) wrote:
>> Add a new 'info ramblock-attributes' HMP command and the corresponding
>> 'x-query-ramblock-attributes' QMP command to display the shared/private
>> memory attributes for ram blocks.
>>=20
>> The QMP command returns structured data (RamBlockAttributesInfo list
>> with per-range shared/populated attributes), while HMP formats it for
>> human consumption.
>>=20
>> This is useful for debugging confidential guests (TDX, SNP) to inspect
>> which memory regions are shared vs private, and their population state
>> when a RamDiscardManager is present (e.g. virtio-mem).
>>=20
>> Signed-off-by: Marc-Andr=C3=A9 Lureau <[email protected]>
>> ---
>>  qapi/machine.json             | 56 ++++++++++++++++++++++++++++++++++
>>  include/monitor/hmp.h         |  1 +
>>  hw/core/machine-hmp-cmds.c    | 32 +++++++++++++++++++
>>  system/ram-block-attributes.c | 71 ++++++++++++++++++++++++++++++++++++=
+++++++
>>  hmp-commands-info.hx          | 13 ++++++++
>>  5 files changed, 173 insertions(+)
>>=20
>
> <snip>
>
> For HMP,
>
> Acked-by: Dr. David Alan Gilbert <[email protected]>
>
> however, you might consider whether it would be better to add it
> to the existing "info ramblock"

Valid suggestion.

HMP "info ramblock" wraps around QMP x-query-ramblock, which returns
HumanReadableText.

HMP "info ramblock-attributes" wraps around QMP
x-query-ramblock-attributes, which returns a list of
RamBlockAttributesInfo.

So, basic x-query-ramblock returns unstructured text, and
x-query-ramblock-attributes returns structured data.  Hmm.  Feels a bit
odd.

[...]