I have some code below that shows the first steps of creating a pfn to mfn lookup table in dom0. This code is based on similar code in the libxc library. The code works on paravirtualized domains, but not HVM domains. { ... live_shinfo = xa_mmap_mfn( instance, PROT_READ, instance->info.shared_info_frame); if (live_shinfo == NULL){ goto error_exit; } /* live_shinfo->arch.pfn_to_mfn_frame_list_list == NULL here for HVM domains */ live_pfn_to_mfn_frame_list_list = xa_mmap_mfn( instance, PROT_READ, live_shinfo- >arch.pfn_to_mfn_frame_list_list); if (live_pfn_to_mfn_frame_list_list == NULL){ goto error_exit; } ... } void *xa_mmap_mfn (xa_instance_t *instance, int prot, unsigned long mfn) { return xc_map_foreign_range( instance->xc_handle, instance->domain_id, XC_PAGE_SIZE, prot, mfn); } When I run this code to setup the pfn to mfn mapping for an HVM domain, the value of live_shinfo->arch.pfn_to_mfn_frame_list_list is NULL where shown by the comment above. However, for a paravirtualized domain, everything works as expected (i.e., the value is not NULL and is used to successfully build the lookup table). Could someone help me understand why this difference exists and what I need to do to build the analogous lookup table for an HVM domain? Thanks, bryan - Bryan D. Payne Graduate Student, Computer Science Georgia Tech Information Security Center http://www.bryanpayne.org _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
> live_shinfo = xa_mmap_mfn( > instance, PROT_READ, instance->info.shared_info_frame); > if (live_shinfo == NULL){ > goto error_exit; > } > > /* live_shinfo->arch.pfn_to_mfn_frame_list_list == NULL here for HVM > domains */Yes, that''s expected. The P2M table in HVM domains is managed entirely by the hypervisor, whereas it''s mostly a guest-controlled thing in PV domains. Try using xc_translate_gpfn_list instead, which does P2M translation on HVM domains. Steven. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
> 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 - Bryan D. Payne Graduate Student, Computer Science Georgia Tech Information Security Center http://www.bryanpayne.org _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel