From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Avi Kivity <avi@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH 1/5] qemu-kvm: msix: Don't fire notifier spuriously on set/unset
Date: Tue, 18 Oct 2011 13:06:07 +0200 [thread overview]
Message-ID: <20111018110607.GB28776@redhat.com> (raw)
In-Reply-To: <0cc8d4ef4adb06b4ee6370488609352dae6fa3df.1318924251.git.jan.kiszka@siemens.com>
On Tue, Oct 18, 2011 at 09:50:50AM +0200, Jan Kiszka wrote:
> If MSI-X is disabled or the global mask is set, don't fire the notifier
> during registration or removal, reporting a wrong state.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Hmm. Could you please describe how does one trigger the incorrect behaviour?
Looking at the upstream code, I notice that msix_notify_if_unmasked
already calls msix_is_masked which checks the function mask. And it
also checks msix_entry_used which, ATM, is only set when msix is
enabled.
> ---
> hw/msix.c | 22 ++++++++++++++--------
> 1 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/hw/msix.c b/hw/msix.c
> index 60d6d1e..6493937 100644
> --- a/hw/msix.c
> +++ b/hw/msix.c
> @@ -563,10 +563,13 @@ int msix_set_mask_notifier(PCIDevice *dev, msix_mask_notifier_func f)
> int r, n;
> assert(!dev->msix_mask_notifier);
> dev->msix_mask_notifier = f;
> - for (n = 0; n < dev->msix_entries_nr; ++n) {
> - r = msix_set_mask_notifier_for_vector(dev, n);
> - if (r < 0) {
> - goto undo;
> + if ((dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &
> + (MSIX_ENABLE_MASK | MSIX_MASKALL_MASK)) == MSIX_ENABLE_MASK) {
> + for (n = 0; n < dev->msix_entries_nr; ++n) {
> + r = msix_set_mask_notifier_for_vector(dev, n);
> + if (r < 0) {
> + goto undo;
> + }
> }
> }
> return 0;
> @@ -583,10 +586,13 @@ int msix_unset_mask_notifier(PCIDevice *dev)
> {
> int r, n;
> assert(dev->msix_mask_notifier);
> - for (n = 0; n < dev->msix_entries_nr; ++n) {
> - r = msix_unset_mask_notifier_for_vector(dev, n);
> - if (r < 0) {
> - goto undo;
> + if ((dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &
> + (MSIX_ENABLE_MASK | MSIX_MASKALL_MASK)) == MSIX_ENABLE_MASK) {
> + for (n = 0; n < dev->msix_entries_nr; ++n) {
> + r = msix_unset_mask_notifier_for_vector(dev, n);
> + if (r < 0) {
> + goto undo;
> + }
> }
> }
> dev->msix_mask_notifier = NULL;
> --
> 1.7.3.4
next prev parent reply other threads:[~2011-10-18 11:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-18 7:50 [PATCH 0/5] qemu-kvm: MSI-X fixes Jan Kiszka
2011-10-18 7:50 ` [PATCH 1/5] qemu-kvm: msix: Don't fire notifier spuriously on set/unset Jan Kiszka
2011-10-18 11:06 ` Michael S. Tsirkin [this message]
2011-10-18 11:34 ` Jan Kiszka
2011-10-18 7:50 ` [PATCH 2/5] qemu-kvm: msix: Only invoke msix_handle_mask_update on changes Jan Kiszka
2011-10-18 11:43 ` Michael S. Tsirkin
2011-10-18 11:54 ` Jan Kiszka
2011-10-18 12:11 ` Michael S. Tsirkin
2011-10-18 12:22 ` Jan Kiszka
2011-10-18 12:37 ` Michael S. Tsirkin
2011-10-18 12:44 ` Jan Kiszka
2011-10-18 13:20 ` Michael S. Tsirkin
2011-10-18 13:49 ` Michael S. Tsirkin
2011-10-18 13:52 ` Jan Kiszka
2011-10-18 7:50 ` [PATCH 3/5] qemu-kvm: msix: Fire mask notifier on global mask changes Jan Kiszka
2011-10-18 7:50 ` [PATCH 4/5] msix: Don't process table changes while disabled Jan Kiszka
2011-10-18 11:18 ` Michael S. Tsirkin
2011-10-18 11:35 ` Jan Kiszka
2011-10-18 12:01 ` Michael S. Tsirkin
2011-10-18 11:26 ` Michael S. Tsirkin
2011-10-18 7:50 ` [PATCH 5/5] msix: Prevent bogus mask updates on MMIO accesses Jan Kiszka
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=20111018110607.GB28776@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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).