Re: [PATCH v5 4/7] genirq: Integrate GSIM into interrupt flow
| Newsgroups | org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Overloading IRQD_IRQ_INPROGRESS for GSIM breaks __synchronize_hardirq() by introducing prolonged busy-waiting and potential deadlocks. -- --- Patch [4]: [PATCH v5 4/7] genirq: Integrate GSIM into interrupt flow --- commit 8749b57516c52ba231f3249d6f52173005693e96 Author: Luigi Rizzo <[email protected]> Subject: genirq: Integrate GSIM into interrupt flow This commit integrates Generic Software Interrupt Moderation (GSIM) into the handle_edge_irq() and handle_fasteoi_irq() flows. It introduces irq_moderation_allow() to validate IRQ eligibility, defaults moderation to disabled during setup, and ensures the state is cleared during IRQ teardown. > diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c > index de754db414d1d..04a30ba04e78b 100644 > --- a/kernel/irq/chip.c > +++ b/kernel/irq/chip.c [ ... ] > @@ -500,6 +501,10 @@ static bool irq_can_handle_pm(struct irq_desc *desc) > return false; > } > > + /* Moderated interrupts have IRQD_IRQ_INPROGRESS and need early return. */ > + if (irqd_is_moderated(irqd)) > + return false; > + [Severity: High] The comment mentions that moderated interrupts have IRQD_IRQ_INPROGRESS set. Could this cause a prolonged busy-wait or deadlock in __synchronize_hardirq() when a driver calls disable_irq() or free_irq() while the moderation timer is active? __synchronize_hardirq() uses a tight loop to wait for this flag to clear: kernel/irq/manage.c:__synchronize_hardirq() { ... while (irqd_irq_inprogress(&desc->irq_data)) cpu_relax(); ... } If the flag remains active for the entire duration of the moderation hrtimer, any teardown or suspend/resume operation would busy-spin for that entire duration. Additionally, if synchronize_irq() is called with local interrupts disabled on the CPU where the moderation timer is pinned, would this hard-deadlock the system since the hrtimer can never fire to clear the flag? [ ... ] -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4