On Wed, Aug 13, 2008 at 08:33:24AM +0100, Richard W.M. Jones wrote:
On Wed, Aug 13, 2008 at 01:19:42PM +0900, Jun Koi wrote:
> According to the comment in your driver code for virDomainMemoryPeek,
> libvirt is not currently supporting Xen. Why is that? As far as I see,
> Xen is use the same GPL2 version as libvirt.
>
> I am thinking about implementing the driver for Xen, so have this question.
It'd be really good to have a driver for this for libvirt.
Yes, it would be very useful indeed
On Xen things are a bit different. You can map in physical pages
from
another guest using the libxc call xc_map_foreign_range. Note that
you cannot just call xc_map_foreign_range because the libxc & libvirt
licenses are _not_ compatible. So instead you'd need to do the
underlying sequence of mmap / ioctl / munmap. (See tools/libxc/
xc_linux.c in the Xen source).
But you still need to do virtual to physical page translation, either
using the qemu source as an example, or using
xc_translate_foreign_address as a guide (or just using the Intel
Programmers Reference Manual and doing it from first principles).
Alot of work, but ultimately it has to be done if we want tools like
virt-mem to be usable with Xen.
Another alternative is to implement virDomainMemoryPeek
(...VIR_MEMORY_PHYSICAL...). It is not possible to implement this for
QEMU at all, at least not without changing QEMU. Implementing this
for Xen would be much easier because you don't need to do address
translation, but it does push the problem of address translation up to
the callers.
And it wouldn't help getting any of your guest debugging programs
working bevacuse they all need VIR_MEMORY_VIRTUAL
Places to look in the QEMU source for inspiration:
monitor.c:do_memory_save
target-i386/helper2.c:cpu_get_phys_page_debug
Other places to look in the Xen source for inspiration:
tools/libxc/xc_linux.c
tools/libxc/xc_pagetab.c
tools/xentrace/xenctx.c (thanks Mark McLoughlin)
NB, just a another reminder - do not copy code from these files if doing
a libvirt implementation for Xen since they are not license compatible.
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|