From: Peter Xu <peterx@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org,
Richard Henderson <richard.henderson@linaro.org>,
Mark Cave-Ayland <mark.caveayland@nutanix.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Subject: Re: [PATCH 5/7] system/memory: Display address spaces starting at 0x0000.0000
Date: Wed, 4 Mar 2026 13:24:19 -0500 [thread overview]
Message-ID: <aah40xnBszzsWyT0@x1.local> (raw)
In-Reply-To: <20260226220226.20164-6-philmd@linaro.org>
Hi, Phil!
On Thu, Feb 26, 2026 at 11:02:23PM +0100, Philippe Mathieu-Daudé wrote:
> Since AddressSpace root MemoryRegion can be remapped, it is
> bogus to use the MemoryRegion address as the AddressSpace
> absolute address. Besides, the AddressSpace APIs take an
> @addr argument expecting AddressSpaces start at 0x0000.0000.
Could you share an example where a root MR can have addr!=0, and be
remapped while being the root MR of an AS?
Thanks,
>
> Substract the MemoryRegion address in mtree_print_mr() to
> display AddressSpaces starting at 0x0000.0000.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> system/memory.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/system/memory.c b/system/memory.c
> index d5060774834..1106f48d0d5 100644
> --- a/system/memory.c
> +++ b/system/memory.c
> @@ -3360,7 +3360,7 @@ static void mtree_print_mr_owner(const MemoryRegion *mr)
> }
>
> static void mtree_print_mr(const MemoryRegion *mr, unsigned int level,
> - hwaddr base,
> + hwaddr offset, bool detect_overflow,
> MemoryRegionListHead *alias_print_queue,
> bool owner, bool display_disabled)
> {
> @@ -3374,7 +3374,7 @@ static void mtree_print_mr(const MemoryRegion *mr, unsigned int level,
> return;
> }
>
> - cur_start = base + mr->addr;
> + cur_start = mr->addr + offset;
> cur_end = cur_start + MR_SIZE(mr->size);
>
> /*
> @@ -3382,7 +3382,7 @@ static void mtree_print_mr(const MemoryRegion *mr, unsigned int level,
> * happen normally. When it happens, we dump something to warn the
> * user who is observing this.
> */
> - if (cur_start < base || cur_end < cur_start) {
> + if (detect_overflow && (cur_start < offset || cur_end < cur_start)) {
> qemu_printf("[DETECTED OVERFLOW!] ");
> }
>
> @@ -3462,7 +3462,7 @@ static void mtree_print_mr(const MemoryRegion *mr, unsigned int level,
> }
>
> QTAILQ_FOREACH(ml, &submr_print_queue, mrqueue) {
> - mtree_print_mr(ml->mr, level + 1, cur_start,
> + mtree_print_mr(ml->mr, level + 1, cur_start, true,
> alias_print_queue, owner, display_disabled);
> }
>
> @@ -3641,7 +3641,8 @@ static void mtree_print_as(gpointer key, gpointer value, gpointer user_data)
> struct AddressSpaceInfo *asi = user_data;
>
> g_slist_foreach(as_same_root_mr_list, mtree_print_as_name, NULL);
> - mtree_print_mr(mr, 1, 0, asi->ml_head, asi->owner, asi->disabled);
> + mtree_print_mr(mr, 1, -mr->addr, false,
> + asi->ml_head, asi->owner, asi->disabled);
> qemu_printf("\n");
> }
>
> @@ -3688,7 +3689,7 @@ static void mtree_info_as(bool dispatch_tree, bool owner, bool disabled)
> const MemoryRegion *mr = ml->mr;
>
> qemu_printf("memory-region: %s\n", memory_region_name(mr));
> - mtree_print_mr(mr, 1, 0, &ml_head, owner, disabled);
> + mtree_print_mr(mr, 1, 0, false, &ml_head, owner, disabled);
> qemu_printf("\n");
> }
>
> --
> 2.52.0
>
--
Peter Xu
next prev parent reply other threads:[~2026-03-04 18:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 22:02 [PATCH 0/7] system/memory: Improve 'info mtree' readability Philippe Mathieu-Daudé
2026-02-26 22:02 ` [PATCH 1/7] stubs: Merge physmem.c within ram-block.c Philippe Mathieu-Daudé
2026-02-26 22:21 ` Pierrick Bouvier
2026-02-26 22:22 ` BALATON Zoltan
2026-03-02 6:21 ` Akihiko Odaki
2026-03-03 16:15 ` Philippe Mathieu-Daudé
2026-03-03 17:20 ` BALATON Zoltan
2026-03-04 6:27 ` Philippe Mathieu-Daudé
2026-03-04 11:41 ` BALATON Zoltan
2026-03-04 18:32 ` Peter Xu
2026-02-26 22:02 ` [PATCH 2/7] system/ramblock: Constify various RAMBlock arguments Philippe Mathieu-Daudé
2026-02-26 22:22 ` Pierrick Bouvier
2026-03-04 18:33 ` Peter Xu
2026-02-26 22:02 ` [PATCH 3/7] system/memory: Constify various MemoryRegion arguments Philippe Mathieu-Daudé
2026-02-26 22:22 ` Pierrick Bouvier
2026-03-04 18:33 ` Peter Xu
2026-02-26 22:02 ` [PATCH 4/7] system/memory: Have memory_region_type() correctly describe containers Philippe Mathieu-Daudé
2026-02-26 22:22 ` Pierrick Bouvier
2026-03-04 18:33 ` Peter Xu
2026-02-26 22:02 ` [PATCH 5/7] system/memory: Display address spaces starting at 0x0000.0000 Philippe Mathieu-Daudé
2026-02-26 22:23 ` Pierrick Bouvier
2026-03-04 18:24 ` Peter Xu [this message]
2026-02-26 22:02 ` [PATCH 6/7] system/memory: Allow mtree_print_mr() to display distinct address width Philippe Mathieu-Daudé
2026-02-26 22:24 ` Pierrick Bouvier
2026-03-04 18:34 ` Peter Xu
2026-02-26 22:02 ` [PATCH 7/7] system/memory: Have 'info mtree' display addresses nicely Philippe Mathieu-Daudé
2026-02-26 22:26 ` Pierrick Bouvier
2026-02-26 22:35 ` BALATON Zoltan
2026-02-27 16:20 ` Philippe Mathieu-Daudé
2026-03-04 18:35 ` Peter Xu
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=aah40xnBszzsWyT0@x1.local \
--to=peterx@redhat.com \
--cc=mark.caveayland@nutanix.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.