From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: Nicholas Piggin <npiggin@gmail.com>, qemu-devel@nongnu.org
Cc: 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>
Subject: Re: [PATCH 3/9] qtest/e1000e|igb: assert irqs are clear before triggering an irq
Date: Sat, 18 Jan 2025 17:14:31 +0900 [thread overview]
Message-ID: <0f1eab33-b5ef-49d5-801e-e579010db784@daynix.com> (raw)
In-Reply-To: <20250117170306.403075-4-npiggin@gmail.com>
On 2025/01/18 2:02, Nicholas Piggin wrote:
> 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.
>
> 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..7154aec0339 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_seen_isr(QE1000E *d, uint16_t msg_id);
I would rather name it e1000e_pending_isr.
We may have seen an interrupt in the past but it may no longer be pending.
> 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..9ab81ecff5b 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_seen_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_seen_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..1bbb4bea4c1 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_seen_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_seen_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..4e4c387b0bf 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_seen_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_seen_isr(d, msg_id)) {
> return;
> }
> qtest_clock_step(d_pci->pci_dev.bus->qts, 10000);
next prev parent reply other threads:[~2025-01-18 8:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-17 17:02 [PATCH 0/9] hw/e1000e|igb: interrupts and qtests fixes Nicholas Piggin
2025-01-17 17:02 ` [PATCH 1/9] qtest/e1000e|igb: Clear interrupt-cause and msix pending bits after irq Nicholas Piggin
2025-01-17 17:02 ` [PATCH 2/9] net/e1000e: Permit disabling interrupt throttling Nicholas Piggin
2025-01-17 17:02 ` [PATCH 3/9] qtest/e1000e|igb: assert irqs are clear before triggering an irq Nicholas Piggin
2025-01-18 8:14 ` Akihiko Odaki [this message]
2025-01-19 9:22 ` Yan Vugenfirer
2025-01-21 4:45 ` Nicholas Piggin
2025-01-17 17:03 ` [PATCH 4/9] net/igb: Fix interrupt throttling interval calculation Nicholas Piggin
2025-01-18 8:22 ` Akihiko Odaki
2025-01-17 17:03 ` [PATCH 5/9] net/igb: Fix EITR LLI and counter fields Nicholas Piggin
2025-01-18 8:37 ` Akihiko Odaki
2025-01-17 17:03 ` [PATCH 6/9] net/e1000e|igb: Fix interrupt throttling logic Nicholas Piggin
2025-01-18 9:50 ` Akihiko Odaki
2025-01-17 17:03 ` [PATCH 7/9] qtest/e1000e|igb: Test interrupt throttling in multiple_transfers test Nicholas Piggin
2025-01-17 17:03 ` [PATCH 8/9] net/e1000e: Fix xITR minimum value Nicholas Piggin
2025-01-18 7:50 ` Akihiko Odaki
2025-01-17 17:03 ` [PATCH 9/9] hw/net/e1000e|igb: Remove xitr_guest_value logic Nicholas Piggin
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=0f1eab33-b5ef-49d5-801e-e579010db784@daynix.com \
--to=akihiko.odaki@daynix.com \
--cc=dmitry.fleytman@gmail.com \
--cc=farosas@suse.de \
--cc=jasowang@redhat.com \
--cc=lvivier@redhat.com \
--cc=npiggin@gmail.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 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).