[Lguest] Communication between host and guest

Earlence Fernandes earlenceferns at gmail.com
Wed May 29 07:59:02 EST 2013


Yes. using vring is the best plan.

My need is as follows: in the host kernel, I have a module that kicks off a
kthread which basically services requests from other places in the kernel.
This kthread should in turn make requests to the guest virtio driver. The
guest virtio driver will service the request and hypercall back to the host
indicating completion of the request.

To understand how to implement this I started looking at the virtio_balloon
driver (since it uses the stats_vq to wait for host requests). This is the
guest side of the connection. However, I'm clueless as to how to setup the
host side of the communication. I saw some code in lguest.c (the launcher),
but that seems to be all userspace helpers. can somebody help me understand
how to write the host-side of the communication in a kernel module?

-Earlence


On Mon, May 27, 2013 at 9:34 PM, Rusty Russell <rusty at rustcorp.com.au>wrote:

> Earlence Fernandes <earlenceferns at gmail.com> writes:
>
> > Yep. I was grepping thru the sources.
> >
> > I think the best way would be to create a virtio device coupled with a
> > hypercall to return data (which is typically one value).
> >
> > Of course, I was thinking, what if I simply did a write() to lguest_fd
> and
> > pull that in the read loop in the guest...
>
> That's going to be less efficient than just using a virtio ring
> with a writable part in the descriptor for the reply (this is what
> virtio-blk does for a write, for example).
>
> Cheers,
> Rusty.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/lguest/attachments/20130528/46eee938/attachment.html>


More information about the Lguest mailing list