From: "Dr. David Alan Gilbert" <dave@treblig.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Don Porter <porter@cs.unc.edu>,
qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: Add 'info pg' command to monitor
Date: Fri, 19 Apr 2024 17:05:28 +0000 [thread overview]
Message-ID: <ZiKkWCjreGOMFX5p@gallifrey> (raw)
In-Reply-To: <CAFEAcA-nLjJoqujX-4kW4kWrrWbaQ037jGCNG75OB+KJybe8Ng@mail.gmail.com>
* Peter Maydell (peter.maydell@linaro.org) wrote:
> On Tue, 16 Apr 2024 at 19:11, Don Porter <porter@cs.unc.edu> wrote:
> >
> > On 4/16/24 13:03, Peter Maydell wrote:
> > > On Tue, 16 Apr 2024 at 17:53, Don Porter <porter@cs.unc.edu> wrote:
> > >> 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.
> > > As far as I can see only x86 implements the get_memory_mapping
> > > function, so once again somebody has added some bit of
> > > functionality that does a walk of the page tables that is
> > > x86 only and that shares no code with any of the other
> > > page table walking code :-(
> >
> > My mistake - get_memory_mappings() is only implemented in x86.
> >
> > In doing some searching of the code, many architectures implement
> > mmu_translate() and
> > get_physical_address() functions, but they are not standardized. I also
> > see your larger point
> > about replicating page walking code in x86.
> >
> > I imagine you have something in mind that abstracts things like the
> > height of the radix tree,
> > entries per node, checking permissions, printing the contents, etc.
> >
> > Perhaps I should start by trying to merge the x86 page walking code into
> > one set of common
> > helper functions, get more feedback (perhaps on a new patch thread?),
> > and then consider
> > how to abstract across architectures after getting feedback on this?
>
> I think the cross-architecture abstraction is probably the
> trickiest part. I would actually be happy for us to drop
> 'info tlb' and 'info mem' entirely if we have a cross-arch
> command that gives basically the same information -- we don't
> IMHO need more than one command for this, and we only have
> multiple commands for basically legacy reasons. And for the
> human monitor (HMP) we don't need to keep things around
> for backwards compatibility.
I'm not sure what happens for the (MIPS/SPARC ?) where it's not
a traditional table hierarchy.
The other thing you might want (and I'm not sure how it interacts
with any of this) is to specify the root of the MMU tree (i.e. CR3
value for those in Intel thinking) to dump different processes etc.
Dave
> thanks
> -- PMM
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ dave @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
next prev parent reply other threads:[~2024-04-19 17:06 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
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 [this message]
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=ZiKkWCjreGOMFX5p@gallifrey \
--to=dave@treblig.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=porter@cs.unc.edu \
--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).