Re: Sharing variables/memory between host and guest ?

2008-07-19 Thread Avi Kivity

Arn wrote:

How can one share memory (a few variables not necessarily a page)
between host/hypervisor and guest VM ?

  

If you use the -mem-path qemu option, all guest memory will be in a file on
tmpfs.  You can mmap that file and access all guest memory.  Of course, this
is hitting the problem with a fairly bit hammer; more refined approaches are
possible.



Could you outline the other approaches ?

  


Have qemu expose the shared memory as a pci device, and write a guest 
driver to exploit it.  This is what the vga emulation does.


--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Sharing variables/memory between host and guest ?

2008-07-14 Thread Arn
 How can one share memory (a few variables not necessarily a page)
 between host/hypervisor and guest VM ?

 If you use the -mem-path qemu option, all guest memory will be in a file on
 tmpfs.  You can mmap that file and access all guest memory.  Of course, this
 is hitting the problem with a fairly bit hammer; more refined approaches are
 possible.

Could you outline the other approaches ?

Thanks
arn
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Sharing variables/memory between host and guest ?

2008-07-12 Thread Dor Laor

Arn wrote:

How can one share memory (a few variables not necessarily a page)
between host/hypervisor and guest VM ?
Since the guest is just a process within the host, there should be
existing ways to do this.
  
It's not that straight forward since the host has its pfn (page frame 
number) while the guest has gfn (guest frame number) and also use 
virtual memory.



What about using something like debugfs or sysfs, is it possible to
share variables this way ? Note, I want a system that
is fast, i.e. changes to shared variable/memory should be visible instantly.

  
A paravirtualized driver can take care of that with driver in the guest 
and device side in qemu/host kernel.
You can use 9p virtio solution in Linux that implements a shared file 
system.

I search the kvm-devel archives and found emails referring to kshmem
 but a search on the kvm-70 code turns up nothing.
There are also some emails on sharing a page but no final outcome or
what exactly to do.

Thanks
Arn
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Sharing variables/memory between host and guest ?

2008-07-12 Thread Arn
Thanks Dor. More below.

 How can one share memory (a few variables not necessarily a page)
 between host/hypervisor and guest VM ?
 Since the guest is just a process within the host, there should be
 existing ways to do this.

 It's not that straight forward since the host has its pfn (page frame
 number) while the guest has gfn (guest frame number) and also use virtual
 memory.

So does this mean that there is no way to share a page between host
and guest like
can be done in Xen ? Wouldn't such a feature be useful ?


 What about using something like debugfs or sysfs, is it possible to
 share variables this way ? Note, I want a system that
 is fast, i.e. changes to shared variable/memory should be visible
 instantly.

 A paravirtualized driver can take care of that with driver in the guest and
 device side in qemu/host kernel.
 You can use 9p virtio solution in Linux that implements a shared file
 system.

I had a look at the 9p related slides on the KVMForum 2008 page on the
wiki and it may serve my purpose but I need to investigate more.

According to the slides 9p has been in Linux since 2.6.14 . I'm
currently using linux kernel 2.6.22-14 (ubuntu 7.10) with a downloaded
kvm-70 . Is this enough for using 9p with KVM or do i need a newer
linux kernel ?

While on this topic I'd like to point out that its a bit difficult to
understand which version of kvm maps to which linux kernel. The page
on the wiki is dated. Is it ok to use a kvm-70 module with a slightly
older linux kernel ?

thanks for you help
arn
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Sharing variables/memory between host and guest ?

2008-07-12 Thread Eric Van Hensbergen
On Sat, Jul 12, 2008 at 4:03 PM, Arn [EMAIL PROTECTED] wrote:

 A paravirtualized driver can take care of that with driver in the guest and
 device side in qemu/host kernel.
 You can use 9p virtio solution in Linux that implements a shared file
 system.

 I had a look at the 9p related slides on the KVMForum 2008 page on the
 wiki and it may serve my purpose but I need to investigate more.

 According to the slides 9p has been in Linux since 2.6.14 . I'm
 currently using linux kernel 2.6.22-14 (ubuntu 7.10) with a downloaded
 kvm-70 . Is this enough for using 9p with KVM or do i need a newer
 linux kernel ?


The virtio portions of the kernel were just added in 2.6.24, the
server portion has not yet been integrated into the kvm-qemu mainline,
but is fairly trivial to merge.  You can also use the TCP/IP version
of the 9p transport to get access to synthetic file systems until all
the virtio stuff gets merged.

If you really want to stick with the 2.6.22 kernel, it may be possible
to build 9p modules with the back ported virtio changes (in fact we
were doing just that for a bit).

-eric
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Sharing variables/memory between host and guest ?

2008-07-12 Thread Arn
Eric, thanks for the prompt response, a few more questions:

 The virtio portions of the kernel were just added in 2.6.24, the
 server portion has not yet been integrated into the kvm-qemu mainline,
 but is fairly trivial to merge.  You can also use the TCP/IP version
 of the 9p transport to get access to synthetic file systems until all
 the virtio stuff gets merged.

What exactly is kvm-qemu mainline ? Is it the qemu parts of KVM that
have been merged into the kernel ? Could you point to which directory
of the kernel code this refers to (also kernel version) ?

Also would this be a fast way to share a few variables between guest and host ?


 If you really want to stick with the 2.6.22 kernel, it may be possible
 to build 9p modules with the back ported virtio changes (in fact we
 were doing just that for a bit).

No, I can upgrade my kernel. I just need to know which one I should
use. Should I just go with the latest stable 2.6.25.10 kernel with
kvm-70 module ?

Thanks
arn
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Sharing variables/memory between host and guest ?

2008-07-12 Thread Eric Van Hensbergen
On Sat, Jul 12, 2008 at 4:59 PM, Arn [EMAIL PROTECTED] wrote:
 Eric, thanks for the prompt response, a few more questions:

 The virtio portions of the kernel were just added in 2.6.24, the
 server portion has not yet been integrated into the kvm-qemu mainline,
 but is fairly trivial to merge.  You can also use the TCP/IP version
 of the 9p transport to get access to synthetic file systems until all
 the virtio stuff gets merged.

 What exactly is kvm-qemu mainline ? Is it the qemu parts of KVM that
 have been merged into the kernel ? Could you point to which directory
 of the kernel code this refers to (also kernel version) ?


I'm talking about the kvm-userspace pieces, not kernel pieces.

  -eric
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Sharing variables/memory between host and guest ?

2008-07-11 Thread Arn
How can one share memory (a few variables not necessarily a page)
between host/hypervisor and guest VM ?
Since the guest is just a process within the host, there should be
existing ways to do this.
What about using something like debugfs or sysfs, is it possible to
share variables this way ? Note, I want a system that
is fast, i.e. changes to shared variable/memory should be visible instantly.

I search the kvm-devel archives and found emails referring to kshmem
 but a search on the kvm-70 code turns up nothing.
There are also some emails on sharing a page but no final outcome or
what exactly to do.

Thanks
Arn
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html