qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 12/11] virtio-pci: avoid extra pointer dereferences


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 12/11] virtio-pci: avoid extra pointer dereferences on fast path
Date: Mon, 14 Oct 2013 18:23:59 +0200

We do not need to access vdev on the MSI-X fast path of virtio_pci_notify.

Signed-off-by: Paolo Bonzini <address@hidden>
---
        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




reply via email to

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