[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/33] kvm: irqchip: skip update msi when disabled
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 08/33] kvm: irqchip: skip update msi when disabled |
Date: |
Thu, 1 Jun 2017 14:41:26 +0200 |
From: Peter Xu <address@hidden>
It's possible that one device kept its irqfd/virq there even when
MSI/MSIX was disabled globally for that device. One example is
virtio-net-pci (see commit f1d0f15a6 and virtio_pci_vq_vector_mask()).
It is used as a fast path to avoid allocate/release irqfd/virq
frequently when guest enables/disables MSIX.
However, this fast path brought a problem to msi_route_list, that the
device MSIRouteEntry is still dangling there even if MSIX disabled -
then we cannot know which message to fetch, even if we can, the messages
are meaningless. In this case, we can just simply ignore this entry.
It's safe, since when MSIX is enabled again, we'll rebuild them no
matter what.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1448813
Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
target/i386/kvm.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 011d4a5..82c72d2 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -43,6 +43,7 @@
#include "standard-headers/asm-x86/hyperv.h"
#include "hw/pci/pci.h"
#include "hw/pci/msi.h"
+#include "hw/pci/msix.h"
#include "migration/blocker.h"
#include "exec/memattrs.h"
#include "trace.h"
@@ -3510,12 +3511,17 @@ static void kvm_update_msi_routes_all(void *private,
bool global,
int cnt = 0;
MSIRouteEntry *entry;
MSIMessage msg;
+ PCIDevice *dev;
+
/* TODO: explicit route update */
QLIST_FOREACH(entry, &msi_route_list, list) {
cnt++;
- msg = pci_get_msi_message(entry->dev, entry->vector);
- kvm_irqchip_update_msi_route(kvm_state, entry->virq,
- msg, entry->dev);
+ dev = entry->dev;
+ if (!msix_enabled(dev) && !msi_enabled(dev)) {
+ continue;
+ }
+ msg = pci_get_msi_message(dev, entry->vector);
+ kvm_irqchip_update_msi_route(kvm_state, entry->virq, msg, dev);
}
kvm_irqchip_commit_routes(kvm_state);
trace_kvm_x86_update_msi_routes(cnt);
--
1.8.3.1
- [Qemu-devel] [PULL 00/33] Misc patches for 2017-06-01, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 01/33] mc146818rtc: update periodic timer only if it is needed, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 04/33] mc146818rtc: drop unnecessary '#ifdef TARGET_I386', Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 07/33] msix: trace control bit write op, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 03/33] mc146818rtc: ensure LOST_TICK_POLICY_SLEW is only enabled on TARGET_I386, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 02/33] mc146818rtc: precisely count the clock for periodic timer, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 08/33] kvm: irqchip: skip update msi when disabled,
Paolo Bonzini <=
- [Qemu-devel] [PULL 09/33] Check the return value of fcntl in qemu_set_cloexec, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 05/33] mc146818rtc: embrace all x86 specific code, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 10/33] nbd: strict nbd_wr_syncv, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 06/33] kvm: irqchip: trace changes on msi add/remove, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 15/33] exec: simplify phys_page_find() params, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 14/33] nbd/client.c: use errp instead of LOG, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 12/33] nbd: add errp parameter to nbd_wr_syncv(), Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 13/33] nbd: add errp to read_sync, write_sync and drop_sync, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 16/33] virtio-scsi: Unset hotplug handler when unrealize, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 11/33] nbd: read_sync and friends: return 0 on success, Paolo Bonzini, 2017/06/01