Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iommu/amd: Use core's primary handler and set IRQF_ONESHOT

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>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260128095540.863589-4-bigeasy@linutronix.de

authored by

Sebastian Andrzej Siewior and committed by
Thomas Gleixner
5bfcdccb f6bc7128

+4 -14
-1
drivers/iommu/amd/amd_iommu.h
··· 15 15 irqreturn_t amd_iommu_int_thread_evtlog(int irq, void *data); 16 16 irqreturn_t amd_iommu_int_thread_pprlog(int irq, void *data); 17 17 irqreturn_t amd_iommu_int_thread_galog(int irq, void *data); 18 - irqreturn_t amd_iommu_int_handler(int irq, void *data); 19 18 void amd_iommu_restart_log(struct amd_iommu *iommu, const char *evt_type, 20 19 u8 cntrl_intr, u8 cntrl_log, 21 20 u32 status_run_mask, u32 status_overflow_mask);
+4 -8
drivers/iommu/amd/init.c
··· 2356 2356 if (r) 2357 2357 return r; 2358 2358 2359 - r = request_threaded_irq(iommu->dev->irq, 2360 - amd_iommu_int_handler, 2361 - amd_iommu_int_thread, 2362 - 0, "AMD-Vi", 2363 - iommu); 2364 - 2359 + r = request_threaded_irq(iommu->dev->irq, NULL, amd_iommu_int_thread, 2360 + IRQF_ONESHOT, "AMD-Vi", iommu); 2365 2361 if (r) { 2366 2362 pci_disable_msi(iommu->dev); 2367 2363 return r; ··· 2531 2535 return irq; 2532 2536 } 2533 2537 2534 - ret = request_threaded_irq(irq, amd_iommu_int_handler, 2535 - thread_fn, 0, devname, iommu); 2538 + ret = request_threaded_irq(irq, NULL, thread_fn, IRQF_ONESHOT, devname, 2539 + iommu); 2536 2540 if (ret) { 2537 2541 irq_domain_free_irqs(irq, 1); 2538 2542 irq_domain_remove(domain);
-5
drivers/iommu/amd/iommu.c
··· 1151 1151 return IRQ_HANDLED; 1152 1152 } 1153 1153 1154 - irqreturn_t amd_iommu_int_handler(int irq, void *data) 1155 - { 1156 - return IRQ_WAKE_THREAD; 1157 - } 1158 - 1159 1154 /**************************************************************************** 1160 1155 * 1161 1156 * IOMMU command queuing functions