[Lguest] Communication between host and guest

Earlence Fernandes earlenceferns at gmail.com
Wed May 29 11:35:28 EST 2013


ok. so now I'm completely confused. vhost seems to be some sort of helper
driver.
What do I use?! There seems to be almost no documentation on this.

What is the recommended method to bidirectionally communicate between host
and guest _kernels_ using the virtio API. And where
can I find easy to follow code examples.

Thanks,
Earlence


On Tue, May 28, 2013 at 6:30 PM, Earlence Fernandes <earlenceferns at gmail.com
> wrote:

> I found some test code in tools/virtio and drivers/vhost/test.c
> I guess this is what I wanted.
>
> -Earlence
>
>
> On Tue, May 28, 2013 at 5:59 PM, Earlence Fernandes <
> earlenceferns at gmail.com> wrote:
>
>> 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/c8245464/attachment.html>


More information about the Lguest mailing list