From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: "Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/3] kvm: irqchip: skip update msi when disabled
Date: Thu, 11 May 2017 10:56:49 +0800 [thread overview]
Message-ID: <20170511025649.GC28293@pxdev.xzpeter.org> (raw)
In-Reply-To: <1494309644-18743-4-git-send-email-peterx@redhat.com>
On Tue, May 09, 2017 at 02:00:44PM +0800, Peter Xu wrote:
> 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 <peterx@redhat.com>
> ---
> target/i386/kvm.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 55865db..554950d 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/migration.h"
> #include "exec/memattrs.h"
> #include "trace.h"
> @@ -3510,12 +3511,16 @@ 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++;
Oops, I think this line should be kept. It does not affect too much,
only the trace below. But still, no reason to remove it.
Paolo, would it still possible to touch it up in your queue?
Sorry for the inconvenience!
> - 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);
> --
> 2.7.4
>
--
Peter Xu
next prev parent reply other threads:[~2017-05-11 2:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 6:00 [Qemu-devel] [PATCH v2 0/3] kvm: irqchip: skip msi update when msi disabled Peter Xu
2017-05-09 6:00 ` [Qemu-devel] [PATCH v2 1/3] kvm: irqchip: trace changes on msi add/remove Peter Xu
2017-05-10 10:45 ` Philippe Mathieu-Daudé
2017-05-09 6:00 ` [Qemu-devel] [PATCH v2 2/3] msix: trace control bit write op Peter Xu
2017-05-10 10:44 ` Philippe Mathieu-Daudé
2017-05-10 18:30 ` Michael S. Tsirkin
2017-05-10 18:30 ` Michael S. Tsirkin
2017-05-09 6:00 ` [Qemu-devel] [PATCH v2 3/3] kvm: irqchip: skip update msi when disabled Peter Xu
2017-05-11 2:56 ` Peter Xu [this message]
2017-05-11 7:48 ` Paolo Bonzini
2017-05-11 7:54 ` Peter Xu
2017-05-10 15:32 ` [Qemu-devel] [PATCH v2 0/3] kvm: irqchip: skip msi update when msi disabled Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170511025649.GC28293@pxdev.xzpeter.org \
--to=peterx@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).