Skip to contentSkip to conversation

xc_domain_translate_gpfn_list vanished from unstable

DISCUSSION Tomáš Kouba 4 participants 7 messages Jan 7, 2007 – Jan 10, 2007

lore
Share & tools
lore
#0 lore raw

Hello,
in xen-3.0.3 there was function xc_domain_translate_gpfn_list in libxc but it is not in unstable now. I have checked hg log but cannot find the patch that did it (and would explain).
Can somebody point me to the patch, or mail that discussed this removal (I was unable to find it either :( )

Thank you

--
Tomas Kouba

#1 lore raw
Quoted 5 lines · Tomáš Kouba

in xen-3.0.3 there was function xc_domain_translate_gpfn_list in libxc but it is not in unstable now. I have checked hg log but cannot find the patch that did it (and would explain).
Can somebody point me to the patch, or mail that discussed this removal (I was unable to find it either :( )

This was part of a cleanup in which translated-guest addresses are always referenced by pseudo-physical address rather than machine address. The function is still provided by Xen (for compatibility) but it shouldn't be needed by tools any more.

-- Keir

#2 lore raw
Quoted 8 lines · Keir Fraser
Quoted 5 lines · Tomáš Kouba

in xen-3.0.3 there was function xc_domain_translate_gpfn_list in libxc but it is not in unstable now. I have checked hg log but cannot find the patch that did it (and would explain).
Can somebody point me to the patch, or mail that discussed this removal (I was unable to find it either :( )

Quoted 4 lines

This was part of a cleanup in which translated-guest addresses are always referenced by pseudo-physical address rather than machine address. The function is still provided by Xen (for compatibility) but it shouldn't be needed by tools any more.

I am sorry, I don't understand one thing: if the translated-guest addresses are always referenced by pseudo-physical address (or pfn?) then why the "xc_map_foreign_range" has its last parameter as mfn and not pfn?

Thank you

--
Tomas Kouba

#3 lore raw
Quoted 4 lines · Tomáš Kouba

I am sorry, I don't understand one thing: if the translated-guest addresses are always referenced by pseudo-physical address (or pfn?) then why the "xc_map_foreign_range" has its last parameter as mfn and not pfn?

xc_map_foreign_* functions all actually take 'gmfn' -- that is the guest-apparent machine address. Paravirtualised guests usually see machine addresses, so gmfn==mfn. HVM guests have the translation done for them by the hypervisor, so they see gmfn==gpfn (guest pseudophysical frame number). Function prototypes and comments in xenctrl.h have unfortuantely not been updated to reflect this change.

-- Keir

#4 lore raw
Quoted 7 lines · Keir Fraser
Quoted 4 lines · Tomáš Kouba

I am sorry, I don't understand one thing: if the translated-guest addresses are always referenced by pseudo-physical address (or pfn?) then why the "xc_map_foreign_range" has its last parameter as mfn and not pfn?

Quoted 7 lines

xc_map_foreign_* functions all actually take 'gmfn' -- that is the guest-apparent machine address. Paravirtualised guests usually see machine addresses, so gmfn==mfn. HVM guests have the translation done for them by the hypervisor, so they see gmfn==gpfn (guest pseudophysical frame number). Function prototypes and comments in xenctrl.h have unfortuantely not been updated to reflect this change.

Thanks for clearing this up, the xenctrl header and libxc source code do not indicate that the "mfn" parameter is in fact not an mfn but a gpfn.
But I think it has been causing me some difficulty.
I've been confused trying to map pages based on known guest virtual addresses from HVM's
for some time. For paravirtualized guests this is as easy as using xc_translate_foreign_address followed by xc_map_foreign_range on the result, but this fails for HVM's (changeset 13282:9865145e53eb) when xc_translate_foreign_address claims that it is unable to map the PD of the HVM.

Presumably this is because the cr3 value returned by xc_vcpu_getcontext holds the machine frame number page tables (presumably this is the guest cr3 so the page tables map gvas to gpfns and not the host cr3 that is used by the hardware to map gvas to gmfns).

Can you suggest an approach that would actually work?

thanks
-aaron

Quoted 8 lines

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw
Quoted 10 lines · James Pendergrass

but this fails for
HVM's (changeset 13282:9865145e53eb)
when xc_translate_foreign_address claims that it is unable to map the PD of the HVM.

Presumably this is because the cr3 value returned by xc_vcpu_getcontext holds the machine frame number
page tables (presumably this is the guest cr3 so the page tables map gvas to gpfns and not the host cr3 that
is used by the hardware to map gvas to gmfns).

No, CR3 is a pseudophysical address (it's the value that the guest wrote, with no translation done on it). If the failure message mentions 'PD' rather than 'PML4' then I think it's the table 2 levels down that isn't getting mapped. Add some extra tracing to the function and check that the PDEs you've seen on the pagetable walk actually look sane.

Quoted 1 line

Can you suggest an approach that would actually work?

Expect to need to fix up functions in libxc. Some of these are only used by debug/diagnostic tools so they're not always up to date.

-- Keir

#6 lore raw
In reply to Keir Fraser
Quoted 8 lines · Keir Fraser
Quoted 5 lines · Tomáš Kouba

in xen-3.0.3 there was function xc_domain_translate_gpfn_list in libxc but it is not in unstable now. I have checked hg log but cannot find the patch that did it (and would explain).
Can somebody point me to the patch, or mail that discussed this removal (I was unable to find it either :( )

Quoted 4 lines

This was part of a cleanup in which translated-guest addresses are always referenced by pseudo-physical address rather than machine address. The function is still provided by Xen (for compatibility) but it shouldn't be needed by tools any more.

Is there some versioning of libxc interface? I see just __XEN_INTERFACE_VERSION__ which works for hypervisor iface. I think similar thing for libxc would be handy too (I believe more tools
use its API to access xen).

Signature · 1 line
Tomas Kouba