All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: Ake Koomsin <ake@igel.co.jp>, Jason Wang <jasowang@redhat.com>
Subject: [PULL 1/3] e1000e: Fix possible interrupt loss when using MSI
Date: Tue, 26 Jul 2022 16:50:53 +0800	[thread overview]
Message-ID: <20220726085055.17239-2-jasowang@redhat.com> (raw)
In-Reply-To: <20220726085055.17239-1-jasowang@redhat.com>

From: Ake Koomsin <ake@igel.co.jp>

Commit "e1000e: Prevent MSI/MSI-X storms" introduced msi_causes_pending
to prevent interrupt storms problem. It was tested with MSI-X.

In case of MSI, the guest can rely solely on interrupts to clear ICR.
Upon clearing all pending interrupts, msi_causes_pending gets cleared.
However, when e1000e_itr_should_postpone() in e1000e_send_msi() returns
true, MSI never gets fired by e1000e_intrmgr_on_throttling_timer()
because msi_causes_pending is still set. This results in interrupt loss.

To prevent this, we need to clear msi_causes_pending when MSI is going
to get fired by the throttling timer. The guest can then receive
interrupts eventually.

Signed-off-by: Ake Koomsin <ake@igel.co.jp>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/net/e1000e_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index 2c51089..208e3e0 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -159,6 +159,8 @@ e1000e_intrmgr_on_throttling_timer(void *opaque)
 
     if (msi_enabled(timer->core->owner)) {
         trace_e1000e_irq_msi_notify_postponed();
+        /* Clear msi_causes_pending to fire MSI eventually */
+        timer->core->msi_causes_pending = 0;
         e1000e_set_interrupt_cause(timer->core, 0);
     } else {
         trace_e1000e_irq_legacy_notify_postponed();
-- 
2.7.4



  reply	other threads:[~2022-07-26  8:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26  8:50 [PULL 0/3] Net patches Jason Wang
2022-07-26  8:50 ` Jason Wang [this message]
2022-07-26  8:50 ` [PULL 2/3] vhost: Get vring base from vq, not svq Jason Wang
2022-07-26  8:50 ` [PULL 3/3] vdpa: Fix memory listener deletions of iova tree Jason Wang
2022-07-28  6:14   ` Lei Yang
2022-07-28  6:26     ` Jason Wang
2022-07-28  8:29       ` Lei Yang
2022-07-26 12:28 ` [PULL 0/3] Net patches Peter Maydell

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=20220726085055.17239-2-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=ake@igel.co.jp \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.