[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Virtqueue Kick functions in QEMU

From: Alex Bennée
Subject: Re: Virtqueue Kick functions in QEMU
Date: Tue, 06 Oct 2020 11:55:26 +0100
User-agent: mu4e 1.5.5; emacs 28.0.50

Arnabjyoti Kalita <akalita@cs.stonybrook.edu> writes:

> Hello all,
> I am running the QEMU stable version of 3.0 in KVM mode with the host as
> well as target architecture being x86_64. I am using a virtio-net device
> using the command line -
> -device virtio-net-pci,netdev=tap1,mac=00:00:00:00:00:00
> I have been trying to record all the virtqueue kicks that happen when the
> virtio driver notifies QEMU by doing a register write. I know that, a
> virtqueue kick, essentially means that there is a VMEXIT. I'd like to know
> which register does the Virtqueue kick operation write to.

This will be somewhat dependent on the virtio backend. For a Linux guest
with a PCI backend the function you eventually end at is:

  /* the notify function used when creating a virt queue */
  bool vp_notify(struct virtqueue *vq)
          /* we write the queue's selector into the notification register to
           * signal the other end */
          iowrite16(vq->index, (void __iomem *)vq->priv);
          return true;

(see drivers/virtio/virtio_pci_common.c in the Linux source code)

> Where in the source code can I find the virtqueue kick operation actually
> writing to a register? I have specifically tried putting breakpoints at
> *virtio_pci_device_write* and *virtio_pci_isr_write*, but I do not see
> these functions getting triggered.

With KVM these might well be handled in the kernel itself and
potentially never exit all the way to QEMU to handle (which is the most
expensive round trip to handle IO).

To trace all the vmexits that get to qemu you can enable:


If you want to see all the vmexits that make it to your host you'll need
to trace the kvm_exit trace point in the kernel. See:


although you might find it easier using some of the higher level
analysis tools.

> Best Regards,
> Arnab

Alex Bennée

reply via email to

[Prev in Thread] Current Thread [Next in Thread]