Thanks Stefan, It's a small bug in the virtio-blk driver in my kernel. After fixing , It works as expected.
Jana On 9 July 2015 at 16:31, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Tue, Jul 07, 2015 at 10:50:59PM +0530, Naredula Janardhana Reddy wrote: > > How to enable MSIX for virtio-blk, this is to avoid extra use of > > VIRTIO_PCI_ISR port reads. > > This is for qemu 2.3.0 with virtio-blk-pci with x-data-plane is on. > > I tried the following with QEMU 2.3.0: > > qemu-system-x86_64 -enable-kvm -m 1024 \ > -drive > if=none,id=drive0,file=test.img,format=raw,aio=native,cache=none \ > -object iothread,id=iothread0 \ > -device virtio-blk-pci,drive=drive0,iothread=iothread0 > > Inside the guest I checked /proc/interrupts and found that the > virtio-pci/virtio-blk driver is using MSI. > > I also checked /proc/ioports and found the virtio-pci registers at > 0xc040. > > Then I used "perf record -a -e kvm:kvm_pio" on the host to record all > PIO accesses. > > Inside the guest I ran "dd if=/dev/vda of=/dev/null iflag=direct bs=4k" > for about 30 seconds. Afterwards I ran "perf script" on the host and > subtracted the 0xc040 base address from the PIO accesses to identify the > virtio-pci registers. > > I didn't see any accesses to the ISR register, only writes to the > QUEUE_NOTIFY register. > > Either your guest operating system is not enabling MSI or you are using > QEMU command-line options that prevent MSI. >