From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVkwI-0004x5-Om for qemu-devel@nongnu.org; Mon, 14 Oct 2013 12:24:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVkwA-0000PS-As for qemu-devel@nongnu.org; Mon, 14 Oct 2013 12:24:14 -0400 Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 14 Oct 2013 18:23:59 +0200 Message-Id: <1381767839-11398-1-git-send-email-pbonzini@redhat.com> In-Reply-To: <1379689080-32396-2-git-send-email-pbonzini@redhat.com> References: <1379689080-32396-2-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 12/11] virtio-pci: avoid extra pointer dereferences on fast path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: fred.konrad@greensocs.com, qemu-stable@nongnu.org, mst@redhat.com We do not need to access vdev on the MSI-X fast path of virtio_pci_notify. Signed-off-by: Paolo Bonzini --- It is possible to get rid of BusChild altogether, but even then this would be one less pointer dereference, and it's a simpler patch. So let's do this instead for 1.7. hw/virtio/virtio-pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 1a179ea..a191c24 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -113,12 +113,13 @@ static inline VirtIOPCIProxy *to_virtio_pci_proxy_fast(DeviceState *d) static void virtio_pci_notify(DeviceState *d, uint16_t vector) { VirtIOPCIProxy *proxy = to_virtio_pci_proxy_fast(d); - VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); if (msix_enabled(&proxy->pci_dev)) msix_notify(&proxy->pci_dev, vector); - else + else { + VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); qemu_set_irq(proxy->pci_dev.irq[0], vdev->isr & 1); + } } static void virtio_pci_save_config(DeviceState *d, QEMUFile *f) -- 1.8.3.1