From: David Hildenbrand <david@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Chao Liu" <lc00631@tecorigin.com>,
pbonzini@redhat.com, peterx@redhat.com
Cc: zhangtj@tecorigin.com, zqz00548@tecorigin.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v3 1/1] system: optimizing info mtree printing for monitors
Date: Wed, 30 Apr 2025 23:38:14 +0200 [thread overview]
Message-ID: <f5f540a2-a6d6-47fd-9b7c-8fd4a4927684@redhat.com> (raw)
In-Reply-To: <15227d0a-c459-4bea-bec7-13dc88d22c3c@linaro.org>
On 30.04.25 11:58, Philippe Mathieu-Daudé wrote:
> Hi Chao,
>
> On 30/4/25 11:02, Chao Liu wrote:
>> Make the hierarchical relationship between nodes clearer by adding characters
>
> W.r.t. $Subject, it isn't really about "optimization" but making
> output clearer, as you describe.
>
>>
>> e.g.
>>
>> qemu-system-riscv64 -M virt -monitor stdio -display none
>>
>> ```
>> (qemu) info mtree
>> ...
>> memory-region: system
>> │ ├── 0000000000000000-ffffffffffffffff (prio 0, i/o): system
>> │ │ ├── 0000000003000000-000000000300ffff (prio 0, i/o): gpex_ioport_window
>> │ │ │ └── 0000000003000000-000000000300ffff (prio 0, i/o): gpex_ioport
>> ...
>> │ │ └── 0000000400000000-00000007ffffffff (prio 0, i/o): alias ...
>> ```
>>
>> Signed-off-by: Chao Liu <lc00631@tecorigin.com>
>> Reviewed-by: Qingze Zhao <zqz00548@tecorigin.com>
>> Reviewed-by: Tingjian Zhang <zhangtj@tecorigin.com>
>> ---
>> system/memory.c | 36 ++++++++++++++++++++++++++++++------
>> 1 file changed, 30 insertions(+), 6 deletions(-)
>>
>> diff --git a/system/memory.c b/system/memory.c
>> index 71434e7ad0..cf91718bcc 100644
>> --- a/system/memory.c
>> +++ b/system/memory.c
>> @@ -3296,6 +3296,21 @@ typedef QTAILQ_HEAD(, MemoryRegionList) MemoryRegionListHead;
>> int128_sub((size), int128_one())) : 0)
>> #define MTREE_INDENT " "
>>
>> +enum mtree_node_type {
>> + MTREE_NODE_T_INNER,
>> + MTREE_NODE_T_TAIL,
>> +};
>> +
>> +static void mtree_print_node(enum mtree_node_type is_tail)
>
> Either rename 'is_tail' as 'node_type', or really use a boolean
> (maybe '[is_]last_node' is clearer?), since the mtree_node_type enum
> doesn't bring much (see [*] below).
>
Note that I suggested that, because the passing or true/false in the
code is horrible for readability.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-04-30 21:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 9:02 [PATCH v3 0/1] Optimizing the print format of the QEMU monitor 'info mtree' Chao Liu
2025-04-30 9:02 ` [PATCH v3 1/1] system: optimizing info mtree printing for monitors Chao Liu
2025-04-30 9:58 ` Philippe Mathieu-Daudé
2025-04-30 21:38 ` David Hildenbrand [this message]
2025-05-01 12:51 ` Philippe Mathieu-Daudé
2025-05-05 17:20 ` Mario Casquero
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=f5f540a2-a6d6-47fd-9b7c-8fd4a4927684@redhat.com \
--to=david@redhat.com \
--cc=lc00631@tecorigin.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=zhangtj@tecorigin.com \
--cc=zqz00548@tecorigin.com \
/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).