From: Don Porter <porter@cs.unc.edu>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, dave@treblig.org
Subject: Re: Add 'info pg' command to monitor
Date: Tue, 16 Apr 2024 12:53:10 -0400 [thread overview]
Message-ID: <fadb288a-4c44-42c9-b706-f5595d97f952@cs.unc.edu> (raw)
In-Reply-To: <CAFEAcA88myOeQwZ212q9R4EHBPpJbQ1qZYjuz6SS=HZbqS+NCQ@mail.gmail.com>
On 4/15/24 12:37, Peter Maydell wrote:
> On Mon, 15 Apr 2024 at 17:09, Don Porter <porter@cs.unc.edu> wrote:
>
> This patch set adds an 'info pg' command to the monitor, which prints
> a nicer view of the page tables. A project in my graduate OS course
> involves implementing x86 page table support, and my students have
> found this helpful for debugging.
> So, my issue with this is that it's x86 specific, and it adds
> yet another monitor command that is doing "show some kind of debug
> info related to the guest page tables", along with "info mem"
> and "info tlb". Plus it is yet another lump of code that's
> walking the guest page tables and interpreting them.
>
> What I'd really like to see is some infrastructure that is
> at least somewhat guest-architecture-agnostic, so we can
> minimise what a guest architecture needs to implement (and
> then make providing that mandatory).
>
> The other thing I'd like to see is perhaps some investigation of
> whether there's any way to implement something useful by
> using/extending the existing get_phys_page_attrs_debug() and
> similar functions, so that you don't have to write one lot
> of page-table-walking code for QEMU to use when it's executing
> guest code and a separate lot (that's bound to get out of
> sync or not support new functionality/changes) that's only
> handling these monitor debug commands. There's a lot of
> complexity in figuring out things like permissions in a
> modern architecture...
>
> thanks
> -- PMM
>
Thank you for the feedback!
There is still a lot I am learning about the code base, but it seems
that qemu_get_guest_memory_mapping() does most of what one would need.
It currently only returns the "leaves" of the page table tree in a list.
What if I extend this function with an optional argument to either
1) return the interior nodes of the page table in additional lists (and
then parse+print in the monitor code), or
2) inline the monitor printing in the arch-specific hook, and pass a
flag to get_guest_memory_mapping() that turns on/off the statements that
pretty print the page tables?
It looks like most CPUs implement this function as part of checkpointing.
Thoughts?
Don
next prev parent reply other threads:[~2024-04-16 16:53 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 16:08 Add 'info pg' command to monitor Don Porter
2024-04-15 16:08 ` [PATCH 1/2] monitor: Implement a generic x86 page table iterator Don Porter
2024-04-15 16:08 ` [PATCH 2/2] monitor: Add an "info pg" command that prints the current page tables Don Porter
2024-04-15 16:37 ` Add 'info pg' command to monitor Peter Maydell
2024-04-16 16:53 ` Don Porter [this message]
2024-04-16 17:03 ` Peter Maydell
2024-04-16 18:11 ` Don Porter
2024-04-17 8:30 ` Nadav Amit
2024-04-17 20:05 ` Nadav Amit
2024-04-17 21:03 ` Dr. David Alan Gilbert
2024-04-17 21:26 ` Richard Henderson
2024-04-19 14:47 ` Peter Maydell
2024-04-19 17:05 ` Dr. David Alan Gilbert
2024-05-24 17:07 ` [PATCH v2 0/6] Rework x86 page table walks Don Porter
2024-05-24 17:07 ` [PATCH v2 1/6] Add an "info pg" command that prints the current page tables Don Porter
2024-05-31 14:11 ` Dr. David Alan Gilbert
2024-06-03 8:46 ` Philippe Mathieu-Daudé
2024-06-03 9:34 ` Peter Maydell
2024-06-03 14:14 ` Don Porter
2024-06-03 14:07 ` Don Porter
2024-05-24 17:07 ` [PATCH v2 2/6] Convert 'info tlb' to use generic iterator Don Porter
2024-05-31 14:18 ` Dr. David Alan Gilbert
2024-06-05 18:35 ` Don Porter
2024-06-05 18:44 ` Richard Henderson
2024-06-05 18:53 ` Don Porter
2024-05-24 17:07 ` [PATCH v2 3/6] Convert 'info mem' " Don Porter
2024-05-24 17:07 ` [PATCH v2 4/6] Convert x86_cpu_get_memory_mapping() to use generic iterators Don Porter
2024-05-24 17:07 ` [PATCH v2 5/6] Move tcg implementation of x86 get_physical_address into common helper code Don Porter
2024-05-24 17:07 ` [PATCH v2 6/6] Convert x86_mmu_translate() to use common code Don Porter
2024-05-31 13:48 ` [PATCH v2 0/6] Rework x86 page table walks Peter Maydell
2024-05-31 14:23 ` Peter Maydell
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=fadb288a-4c44-42c9-b706-f5595d97f952@cs.unc.edu \
--to=porter@cs.unc.edu \
--cc=dave@treblig.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@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).