views:

37

answers:

1

Hello, I am trying to understand the virtio mechanism in linux. I read that the kick function will notify the host side about the newly published buffers. I am looking especially at virtio_net.Once a packet is ready for transmission the kick function is called here. From here i traced the call and i think it goes to this. From here where does it go? Which code contains the backend driver of virtio. Where is the code in the hypervisor which this kick will go to? Thank you...

Thanks, Bala

+2  A: 

The IO port accesses here are communicating with the "hardware" of the virtual machine, which is implemented by the QEMU instance which supports the VM. The place to start in the QEMU code is virtio_ioport_write() in hw/virtio-pci.c.

Matthew Slattery
Thank you very much. One more question. Is the qemu instance running in user-space of the guestOS or the userspace of HostOS?
User space of the host OS. Have you read the original [kvm paper](http://www.kernel.org/doc/ols/2007/ols2007v1-pages-225-230.pdf)? QEMU is the userspace code providing I/O virtualisation as described in sections 3.1 and 5.1. The guest OS doesn't _need_ anything special to run; but the use of a mechanism such as virtio (where the guest has knowledge that it is virtualised, and makes use of special support) allows for much higher I/O performance. (This is "paravirtualisation" as described briefly in section 8.2 of the paper.)
Matthew Slattery