[PATCH v2 1/2] irqchip/riscv-aplic: Use handle_edge_irq() for edge-triggered MSI sources
Troy Mitchell
troy.mitchell at linux.dev
Tue Nov 10 17:11:36 PST 2026
Hi Thomas,
On Wed Nov 11, 2026 at 12:07 AM GMT, Thomas Gleixner wrote:
> On Tue, Nov 10 2026 at 12:06, Troy Mitchell wrote:
>> In MSI mode, all APLIC interrupts are handled by handle_fasteoi_irq().
>> For an edge-triggered source the APLIC forwards each edge as an MSI and
>> keeps no state after that, so an edge which the CPU side drops is lost.
>> After an affinity change, the next MSI can arrive on the new CPU while
>> the previous one is still being handled on the old CPU, and
>> handle_fasteoi_irq() then drops it.
>>
>> The fasteoi flow also never calls irq_ack(), which is where IMSIC applies
>> an affinity change that was deferred while a previous vector move was in
>> flight. Such a change stays pending, and later affinity changes of the
>> interrupt only update the pending mask.
>>
>> Use handle_edge_irq() for edge-triggered sources. It acknowledges the
>> interrupt before invoking the handler. If the interrupt is still in
>> progress on the previous target CPU, it either waits for it to complete
>> or marks it pending so that the handler runs again.
>>
>> Fixes: ca8df97fe679 ("irqchip/riscv-aplic: Add support for MSI-mode")
>> Signed-off-by: Troy Mitchell <troy.mitchell at linux.dev>
>
> Not that I care at all about showing up in some made up git-tag metrics,
> but in general it's a matter of courtesy to point out that the solution
> to the problem was suggested by someone else, no?
I'm so orry about that. Will add your Suggested-by in v3.
>
>> + /*
>> + * Edge-triggered sources are fire and forget, so they must be
>> + * acknowledged before the handler runs. The edge flow handler also
>> + * replays an interrupt which arrives while the previous one is
>> + * still being handled on another CPU after an affinity change.
>> + */
>> + if (type & IRQ_TYPE_EDGE_BOTH)
>> + irq_set_chip_handler_name_locked(d, irq_data_get_irq_chip(d),
>> + handle_edge_irq, "edge");
>> + else
>> + irq_set_chip_handler_name_locked(d, irq_data_get_irq_chip(d),
>> + handle_fasteoi_irq, "fasteoi");
>> +
>
> https://docs.kernel.org/process/maintainer-tip.html#bracket-rules
Will add the braces in v3. Thanks for your review!
--
Troy Mitchell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20261111/272c48cb/attachment.sig>
More information about the linux-riscv
mailing list