|
|
|
|
|
|
|
|
|
|
xen-devel
RE: [Xen-devel] pfn to mfn mapping for HVM domains?
>From: Bryan D. Payne
>Sent: 2006年11月1日 14:31
>
>> thing in PV domains. Try using xc_translate_gpfn_list instead, which
>> does P2M translation on HVM domains.
>
>I'm having trouble with the value returned from this function. I've
>been working on this for a while and my conclusion is that there must
>be an error in my logic (most likely!) or a bug in this function.
>Perhaps someone could help me figure out which it is...
>
>These are the steps that I'm taking:
>
>* Assume that I have an HVM domain running fedora core 5. My goal is
>to view the memory page holding the symbol swapper_pg_dir (the kernel
>page global directory, or kpgd for short).
>
>* I lookup the virtual address for kpgd in the System.map file
>
>* I subtract 0xc0000000 from the virtual address to get the physical
>address (which should be valid since this is kernel memory and the
>PAGE_OFFSET for this kernel is 0xc0000000).
>
>* I convert the physical address to a pfn by bit shifting PAGE_SHIFT
>bits to the right
>
>* I translate the pfn to a mfn using the
>xc_domain_translate_gpfn_list function
>
>* I mmap the mfn using xc_map_foreign_range
>
>After doing this, the page that is returned from xc_map_foreign_range
>does not appear to be the correct page. The offset where the kpgd
>should be located contains all zeros, which can't be correct.
>
>I've tried the same steps with other kernel symbols as well. Each
>time I get a valid mfn returned by xc_domain_translate_gpfn_list.
>But each time when I map this mfn, the expected information is not on
>that page, so I conclude that the mfn is not correct.
>
>With the exception of the pfn to mfn conversion step, I can do the
>exact same steps on a PV domain and it works every time. So I'm
>inclined to think that my logic for converting a virtual address to a
>pfn is valid. Does this imply that there's a bug in
>xc_domain_translate_gpfn_list or am I misinterpreting the function's
>output?
>
>Thanks,
>bryan
>
Xc_domain_translate_gpfn_list should look at target domain's
p2m table directly. One simple way you may make a check, since
swapper_pg_dir sits at fixed virtual address and thus fixed guest
physical address by identity mapping:
- First calculate gpfn of swapper_pg_dir as what you're doing now
- Add a check upon target gpfn in shadow_set_p2m_entry. If
gfn equals to target gpfn, print the corresponding mfn. This is the first
time when p2m entry is setup for target gpfn.
- compile xen, reboot machine, re-create your hvm guest.
Then check whether the result of Xc_domain_translate_gpfn_list
equals to above xen print. If they don't equal, something definitely
goes wrong.
Thanks,
Kevin
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|