All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc: pci_endpoint_test: Add WARN_ON() to detect broken EPC drivers
@ 2026-07-29 20:28 Niklas Cassel
  2026-07-29 20:38 ` sashiko-bot
  2026-07-29 20:49 ` DWC eDMA weirdness Niklas Cassel
  0 siblings, 2 replies; 3+ messages in thread
From: Niklas Cassel @ 2026-07-29 20:28 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Krzysztof Wilczyński, Bjorn Helgaas
  Cc: linux-pci, Koichiro Den, Niklas Cassel

Getting two IRQs when we are only expecting a single IRQ is a very
serious error, and suggests that something is very wrong in the EPC
driver.

Scream loudly so that EPC driver developers can see the problem,
which might otherwise be very hard to detect.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
 drivers/misc/pci_endpoint_test.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 3635741c3e7a..a212e53654c6 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -178,6 +178,19 @@ static irqreturn_t pci_endpoint_test_irqhandler(int irq, void *dev_id)
 	if (reg & STATUS_IRQ_RAISED) {
 		test->last_irq = irq;
 		complete(&test->irq_raised);
+		/*
+		 * The endpoint test driver performs all testing sequentially.
+		 * This means that test->irq_raised.done should never exceed 1.
+		 * If it does, then we received two IRQs in a row, without a
+		 * successful wait_for_completion_timeout() call in between.
+		 *
+		 * While complete() increases test->irq_raised.done by one,
+		 * wait_for_completion_timeout() reduces test->irq_raised.done
+		 * by one on success.
+		 *
+		 * Please debug your EPC driver if you see this warning.
+		 */
+		WARN_ON(test->irq_raised.done > 1);
 	}
 
 	return IRQ_HANDLED;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-29 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 20:28 [PATCH] misc: pci_endpoint_test: Add WARN_ON() to detect broken EPC drivers Niklas Cassel
2026-07-29 20:38 ` sashiko-bot
2026-07-29 20:49 ` DWC eDMA weirdness Niklas Cassel

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.