mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: "Thomas Gleixner" <tglx@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Joerg Roedel <joro@8bytes.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	iommu@lists.linux.dev
Subject: [PATCH v2 03/20] iommu/amd: Use core's primary handler and set IRQF_ONESHOT
Date: Wed, 28 Jan 2026 10:55:23 +0100	[thread overview]
Message-ID: <20260128095540.863589-4-bigeasy@linutronix.de> (raw)
In-Reply-To: <20260128095540.863589-1-bigeasy@linutronix.de>

request_threaded_irq() is invoked with a primary and a secondary handler
and no flags are passed. The primary handler is the same as
irq_default_primary_handler() so there is no need to have an identical
copy.
The lack of the IRQF_ONESHOT can be dangerous because the interrupt
source is not masked while the threaded handler is active. This means,
especially on LEVEL typed interrupt lines, the interrupt can fire again
before the threaded handler had a chance to run.

Use the default primary interrupt handler by specifying NULL and set
IRQF_ONESHOT so the interrupt source is masked until the secondary
handler is done.

Fixes: 72fe00f01f9a3 ("x86/amd-iommu: Use threaded interupt handler")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: iommu@lists.linux.dev
---
 drivers/iommu/amd/amd_iommu.h |  1 -
 drivers/iommu/amd/init.c      | 12 ++++--------
 drivers/iommu/amd/iommu.c     |  5 -----
 3 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h
index b742ef1adb352..df1c238dc8885 100644
--- a/drivers/iommu/amd/amd_iommu.h
+++ b/drivers/iommu/amd/amd_iommu.h
@@ -15,7 +15,6 @@ irqreturn_t amd_iommu_int_thread(int irq, void *data);
 irqreturn_t amd_iommu_int_thread_evtlog(int irq, void *data);
 irqreturn_t amd_iommu_int_thread_pprlog(int irq, void *data);
 irqreturn_t amd_iommu_int_thread_galog(int irq, void *data);
-irqreturn_t amd_iommu_int_handler(int irq, void *data);
 void amd_iommu_restart_log(struct amd_iommu *iommu, const char *evt_type,
 			   u8 cntrl_intr, u8 cntrl_log,
 			   u32 status_run_mask, u32 status_overflow_mask);
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 384c90b4f90a0..62a7a718acf8f 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -2356,12 +2356,8 @@ static int iommu_setup_msi(struct amd_iommu *iommu)
 	if (r)
 		return r;
 
-	r = request_threaded_irq(iommu->dev->irq,
-				 amd_iommu_int_handler,
-				 amd_iommu_int_thread,
-				 0, "AMD-Vi",
-				 iommu);
-
+	r = request_threaded_irq(iommu->dev->irq, NULL, amd_iommu_int_thread,
+				 IRQF_ONESHOT, "AMD-Vi", iommu);
 	if (r) {
 		pci_disable_msi(iommu->dev);
 		return r;
@@ -2535,8 +2531,8 @@ static int __iommu_setup_intcapxt(struct amd_iommu *iommu, const char *devname,
 		return irq;
 	}
 
-	ret = request_threaded_irq(irq, amd_iommu_int_handler,
-				   thread_fn, 0, devname, iommu);
+	ret = request_threaded_irq(irq, NULL, thread_fn, IRQF_ONESHOT, devname,
+				   iommu);
 	if (ret) {
 		irq_domain_free_irqs(irq, 1);
 		irq_domain_remove(domain);
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 7c12be1b247f4..0f9045ce93af1 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1151,11 +1151,6 @@ irqreturn_t amd_iommu_int_thread(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-irqreturn_t amd_iommu_int_handler(int irq, void *data)
-{
-	return IRQ_WAKE_THREAD;
-}
-
 /****************************************************************************
  *
  * IOMMU command queuing functions
-- 
2.51.0


  parent reply	other threads:[~2026-01-28  9:55 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28  9:55 [PATCH v2 00/20] IRQF_ONESHOT clean up Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 01/20] genirq: Set IRQF_COND_ONESHOT in devm_request_irq() Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 02/20] platform/x86: int0002: Remove IRQF_ONESHOT from request_irq() Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` Sebastian Andrzej Siewior [this message]
2026-02-01 17:13   ` [tip: irq/cleanups] iommu/amd: Use core's primary handler and set IRQF_ONESHOT tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 04/20] mailbox: bcm-ferxrm-mailbox: Use default primary handler Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-02-02  0:56   ` [PATCH v2 04/20] " Jassi Brar
2026-01-28  9:55 ` [PATCH v2 05/20] bus: fsl-mc: " Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 06/20] Bluetooth: btintel_pcie: Use IRQF_ONESHOT and " Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 07/20] scsi: efct: " Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 08/20] ARM: versatile: Remove IRQF_ONESHOT Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 09/20] char: tpm: cr50: " Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 10/20] EDAC/altera: " Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 11/20] usb: typec: fusb302: " Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 12/20] rtc: amlogic-a4: " Sebastian Andrzej Siewior
2026-01-28 11:28   ` (subset) " Alexandre Belloni
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 13/20] thermal/qcom/lmh: Replace IRQF_ONESHOT with IRQF_NO_THREAD Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 14/20] perf/cxlpmu: " Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 15/20] mfd: wm8350-core: Use IRQF_ONESHOT Sebastian Andrzej Siewior
2026-01-28 13:07   ` Andy Shevchenko
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 16/20] iio: Use IRQF_NO_THREAD Sebastian Andrzej Siewior
2026-01-28 13:03   ` Andy Shevchenko
2026-01-29 16:11     ` Jonathan Cameron
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 17/20] iio: Replace IRQF_ONESHOT with IRQF_NO_THREAD Sebastian Andrzej Siewior
2026-01-29 16:12   ` Jonathan Cameron
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 18/20] iio: magnetometer: Remove IRQF_ONESHOT Sebastian Andrzej Siewior
2026-01-28 13:04   ` Andy Shevchenko
2026-01-29 16:13     ` Jonathan Cameron
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 19/20] iio: adc: ad7766: Use iio_trigger_generic_data_rdy_poll() Sebastian Andrzej Siewior
2026-01-28 13:05   ` Andy Shevchenko
2026-01-29 16:14     ` Jonathan Cameron
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-28  9:55 ` [PATCH v2 20/20] media: pci: mg4b: Use IRQF_NO_THREAD Sebastian Andrzej Siewior
2026-02-01 17:13   ` [tip: irq/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2026-02-03  8:23   ` tip-bot2 for Sebastian Andrzej Siewior
2026-02-03 13:22   ` [PATCH v2 20/20] " Martin Tůma
2026-01-28 16:12 ` [PATCH v2 00/20] IRQF_ONESHOT clean up Will Deacon

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=20260128095540.863589-4-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tglx@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®