From: Nicholas Piggin <npiggin@gmail.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: Nicholas Piggin <npiggin@gmail.com>,
qemu-devel@nongnu.org,
Dmitry Fleytman <dmitry.fleytman@gmail.com>,
Jason Wang <jasowang@redhat.com>,
Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>,
Fabiano Rosas <farosas@suse.de>,
Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Subject: [PATCH v3 04/12] qtest/e1000e|igb: assert irqs are clear before triggering an irq
Date: Fri, 2 May 2025 13:16:56 +1000 [thread overview]
Message-ID: <20250502031705.100768-5-npiggin@gmail.com> (raw)
In-Reply-To: <20250502031705.100768-1-npiggin@gmail.com>
Assert there is no existing irq raised that would lead to a false
positive interrupt test.
e1000e has to disable interrupt throttling for this test, because
it can cause delayed superfluous interrupts which trip the assertions.
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: Dmitry Fleytman <dmitry.fleytman@gmail.com>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
tests/qtest/libqos/e1000e.h | 1 +
tests/qtest/e1000e-test.c | 10 ++++++++++
tests/qtest/igb-test.c | 6 ++++++
tests/qtest/libqos/e1000e.c | 9 ++++++++-
4 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/tests/qtest/libqos/e1000e.h b/tests/qtest/libqos/e1000e.h
index 30643c80949..e693670119f 100644
--- a/tests/qtest/libqos/e1000e.h
+++ b/tests/qtest/libqos/e1000e.h
@@ -54,6 +54,7 @@ static inline uint32_t e1000e_macreg_read(QE1000E *d, uint32_t reg)
return qpci_io_readl(&d_pci->pci_dev, d_pci->mac_regs, reg);
}
+bool e1000e_pending_isr(QE1000E *d, uint16_t msg_id);
void e1000e_wait_isr(QE1000E *d, uint16_t msg_id);
void e1000e_tx_ring_push(QE1000E *d, void *descr);
void e1000e_rx_ring_push(QE1000E *d, void *descr);
diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c
index 746d26cfb67..a538c72cc84 100644
--- a/tests/qtest/e1000e-test.c
+++ b/tests/qtest/e1000e-test.c
@@ -61,6 +61,9 @@ static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
E1000_TXD_DTYP_D |
sizeof(buffer));
+ /* Ensure the interrupt has not been taken already */
+ g_assert(!e1000e_pending_isr(d, E1000E_TX0_MSG_ID));
+
/* Put descriptor to the ring */
e1000e_tx_ring_push(d, &descr);
@@ -105,6 +108,9 @@ static void e1000e_receive_verify(QE1000E *d, int *test_sockets, QGuestAllocator
char buffer[64];
int ret;
+ /* Ensure the interrupt has not been taken already */
+ g_assert(!e1000e_pending_isr(d, E1000E_RX0_MSG_ID));
+
/* Send a dummy packet to device's socket*/
ret = iov_send(test_sockets[0], iov, 2, 0, sizeof(len) + sizeof(packet));
g_assert_cmpint(ret, == , sizeof(packet) + sizeof(len));
@@ -188,6 +194,10 @@ static void test_e1000e_multiple_transfers(void *obj, void *data,
return;
}
+ /* Clear EITR because buggy QEMU throttle timer causes superfluous irqs */
+ e1000e_macreg_write(d, E1000_EITR + E1000E_RX0_MSG_ID * 4, 0);
+ e1000e_macreg_write(d, E1000_EITR + E1000E_TX0_MSG_ID * 4, 0);
+
for (i = 0; i < iterations; i++) {
e1000e_send_verify(d, data, alloc);
e1000e_receive_verify(d, data, alloc);
diff --git a/tests/qtest/igb-test.c b/tests/qtest/igb-test.c
index cf8b4131cf2..12cdd8b498a 100644
--- a/tests/qtest/igb-test.c
+++ b/tests/qtest/igb-test.c
@@ -64,6 +64,9 @@ static void igb_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *allo
E1000_TXD_DTYP_D |
sizeof(buffer));
+ /* Ensure the interrupt has not been taken already */
+ g_assert(!e1000e_pending_isr(d, E1000E_TX0_MSG_ID));
+
/* Put descriptor to the ring */
e1000e_tx_ring_push(d, &descr);
@@ -119,6 +122,9 @@ static void igb_receive_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
memset(&descr, 0, sizeof(descr));
descr.read.pkt_addr = cpu_to_le64(data);
+ /* Ensure the interrupt has not been taken already */
+ g_assert(!e1000e_pending_isr(d, E1000E_RX0_MSG_ID));
+
/* Put descriptor to the ring */
e1000e_rx_ring_push(d, &descr);
diff --git a/tests/qtest/libqos/e1000e.c b/tests/qtest/libqos/e1000e.c
index 925654c7fd4..0bf70e25389 100644
--- a/tests/qtest/libqos/e1000e.c
+++ b/tests/qtest/libqos/e1000e.c
@@ -77,13 +77,20 @@ static void e1000e_foreach_callback(QPCIDevice *dev, int devfn, void *data)
g_free(dev);
}
+bool e1000e_pending_isr(QE1000E *d, uint16_t msg_id)
+{
+ QE1000E_PCI *d_pci = container_of(d, QE1000E_PCI, e1000e);
+
+ return qpci_msix_pending(&d_pci->pci_dev, msg_id);
+}
+
void e1000e_wait_isr(QE1000E *d, uint16_t msg_id)
{
QE1000E_PCI *d_pci = container_of(d, QE1000E_PCI, e1000e);
guint64 end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
do {
- if (qpci_msix_pending(&d_pci->pci_dev, msg_id)) {
+ if (e1000e_pending_isr(d, msg_id)) {
return;
}
qtest_clock_step(d_pci->pci_dev.bus->qts, 10000);
--
2.47.1
next prev parent reply other threads:[~2025-05-02 3:17 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-02 3:16 [PATCH v3 00/12] hw/e1000e|igb: interrupts and qtests fixes Nicholas Piggin
2025-05-02 3:16 ` [PATCH v3 01/12] qtest/e1000e|igb: Clear interrupt-cause and msix pending bits after irq Nicholas Piggin
2025-05-19 15:06 ` Fabiano Rosas
2025-05-02 3:16 ` [PATCH v3 02/12] net/e1000e: Permit disabling interrupt throttling Nicholas Piggin
2025-05-05 5:41 ` Akihiko Odaki
2025-05-05 6:36 ` Nicholas Piggin
2025-05-02 3:16 ` [PATCH v3 03/12] hw/net/e1000e|igb: Remove xitr_guest_value logic Nicholas Piggin
2025-05-05 5:45 ` Akihiko Odaki
2025-05-05 6:38 ` Nicholas Piggin
2025-05-02 3:16 ` Nicholas Piggin [this message]
2025-05-19 15:07 ` [PATCH v3 04/12] qtest/e1000e|igb: assert irqs are clear before triggering an irq Fabiano Rosas
2025-05-02 3:16 ` [PATCH v3 05/12] net/igb: Fix interrupt throttling interval calculation Nicholas Piggin
2025-05-02 3:16 ` [PATCH v3 06/12] net/igb: Implement EITR Moderation Counter Nicholas Piggin
2025-05-02 3:16 ` [PATCH v3 07/12] igb: Add a note about re-loading timers breaking deterministic replay Nicholas Piggin
2025-05-02 3:17 ` [PATCH v3 08/12] hw/net/e1000e: Postponed msix interrupt processing should auto-clear cause Nicholas Piggin
2025-05-02 3:17 ` [PATCH v3 09/12] hw/net/e1000e: Do not auto-clear cause on postponed msix interrupt Nicholas Piggin
2025-05-02 3:17 ` [PATCH v3 10/12] net/e1000e|igb: Only send delayed msix interrupts that have a cause Nicholas Piggin
2025-05-05 5:51 ` Akihiko Odaki
2025-05-05 6:48 ` Nicholas Piggin
2025-05-02 3:17 ` [PATCH v3 11/12] net/e1000e|igb: Fix interrupt throttling rearming Nicholas Piggin
2025-05-05 6:03 ` Akihiko Odaki
2025-05-05 6:49 ` Nicholas Piggin
2025-05-02 3:17 ` [PATCH v3 12/12] qtest/e1000e|igb: Test interrupt throttling in multiple_transfers test Nicholas Piggin
2025-05-19 15:08 ` Fabiano Rosas
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=20250502031705.100768-5-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=akihiko.odaki@daynix.com \
--cc=dmitry.fleytman@gmail.com \
--cc=farosas@suse.de \
--cc=jasowang@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sriram.yagnaraman@ericsson.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 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.