From: Ted Chen <znscnchen@gmail.com>
To: pbonzini@redhat.com, peterx@redhat.com, david@redhat.com,
philmd@linaro.org
Cc: qemu-devel@nongnu.org, Ted Chen <znscnchen@gmail.com>
Subject: [PATCH] memory: dump HPA and access type of ramblocks
Date: Mon, 5 Dec 2022 20:07:12 +0800 [thread overview]
Message-ID: <20221205120712.269013-1-znscnchen@gmail.com> (raw)
It's convenient to dump HVA and RW/RO status of a ramblock in "info ramblock"
for debug purpose.
Before:
Offset Used Total
0x0000000000000000 0x0000000400000000 0x0000000400000000
After:
Offset Used Total HVA RO
0x0000000000000000 0x0000000400000000 0x0000000400000000 0x00007f12ebe00000 rw
Signed-off-by: Ted Chen <znscnchen@gmail.com>
---
softmmu/physmem.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 1b606a3002..fed4dfb72c 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -1316,15 +1316,21 @@ GString *ram_block_format(void)
GString *buf = g_string_new("");
RCU_READ_LOCK_GUARD();
- g_string_append_printf(buf, "%24s %8s %18s %18s %18s\n",
- "Block Name", "PSize", "Offset", "Used", "Total");
+ g_string_append_printf(buf, "%24s %8s %18s %18s %18s %18s %3s\n",
+ "Block Name", "PSize", "Offset", "Used", "Total",
+ "HVA", "RO");
+
RAMBLOCK_FOREACH(block) {
psize = size_to_str(block->page_size);
g_string_append_printf(buf, "%24s %8s 0x%016" PRIx64 " 0x%016" PRIx64
- " 0x%016" PRIx64 "\n", block->idstr, psize,
+ " 0x%016" PRIx64 " 0x%016" PRIx64 " %3s\n",
+ block->idstr, psize,
(uint64_t)block->offset,
(uint64_t)block->used_length,
- (uint64_t)block->max_length);
+ (uint64_t)block->max_length,
+ (uint64_t)block->host,
+ block->mr->readonly ? "ro" : "rw");
+
g_free(psize);
}
--
2.34.1
next reply other threads:[~2022-12-05 14:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 12:07 Ted Chen [this message]
2022-12-05 12:12 ` [PATCH] memory: dump HPA and access type of ramblocks Philippe Mathieu-Daudé
2022-12-05 12:15 ` David Hildenbrand
2022-12-05 14:54 ` Peter Xu
2023-01-06 18:01 ` Peter Xu
2023-03-01 12:07 ` Ted Chen
2023-03-09 13:33 ` Philippe Mathieu-Daudé
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=20221205120712.269013-1-znscnchen@gmail.com \
--to=znscnchen@gmail.com \
--cc=david@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--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).