Thanks @Andrew, A LKM to dump the arch->p2m_vaddr solved the issue and answered my questions!
Atenciosamente, *Charles Ferreira Gonçalves * On Fri, Apr 16, 2021 at 4:12 PM Andrew Cooper <andrew.coop...@citrix.com> wrote: > On 16/04/2021 15:58, Charles Gonçalves wrote: > > Hello Guys, > > Does memory on Dom0 also mapped to gpfn or it is mapped directly to mfn? > > If mapped to gpfn, how can I access its p2m mapping? > > I'm trying to use the xen-mfndump but it is not working with dom0 > > ./xen-mfndump dump-p2m 0 > xc: error: Could not map the shared info frame (MFN 0xddfe9) (3 = No such > process): Internal error > xc: error: Could not map domain 0 memory information: Internal error > > The problem that I'm wanting to solve is: > > Given a va in a process on dom0, I can get its physical representation > (mfn or gpfn depending on how this works on PV) using /proc/pid/pagemap > and with this I can access its real mfn. > > This works perfectly with domU but not with dom0, why? > > > There are a lot of operations you're not permitted to perform on yourself, > to prevent problems. > > I think in this case, Xen is rejecting dom0's attempt to foreign map > itself (although -EINVAL would be better than -ESRCH to fail with, IMO), > because otherwise we get into reference counting issues IIRC. > > You'll probably have an easier time asking the dom0 kernel to dump the > p2m. After all, its a kernel-owned datastructure, not a Xen-owned > structure. > > ~Andrew >