<div dir="ltr">I found some test code in tools/virtio and drivers/vhost/test.c<div>I guess this is what I wanted.</div><div><br></div><div>-Earlence</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 28, 2013 at 5:59 PM, Earlence Fernandes <span dir="ltr"><<a href="mailto:earlenceferns@gmail.com" target="_blank">earlenceferns@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes. using vring is the best plan.<div><br></div><div>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.</div>


<div><br></div><div>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?</div>

<span class="HOEnZb"><font color="#888888">
<div><br></div><div>-Earlence</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 27, 2013 at 9:34 PM, Rusty Russell <span dir="ltr"><<a href="mailto:rusty@rustcorp.com.au" target="_blank">rusty@rustcorp.com.au</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Earlence Fernandes <<a href="mailto:earlenceferns@gmail.com" target="_blank">earlenceferns@gmail.com</a>> writes:<br>



<br>
> Yep. I was grepping thru the sources.<br>
><br>
> I think the best way would be to create a virtio device coupled with a<br>
> hypercall to return data (which is typically one value).<br>
><br>
> Of course, I was thinking, what if I simply did a write() to lguest_fd and<br>
> pull that in the read loop in the guest...<br>
<br>
</div>That's going to be less efficient than just using a virtio ring<br>
with a writable part in the descriptor for the reply (this is what<br>
virtio-blk does for a write, for example).<br>
<br>
Cheers,<br>
Rusty.<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>