[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r0m3q32t.ffs@tglx>
Date: Mon, 09 Oct 2023 16:32:10 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Wei Gong <gongwei833x@...il.com>
Cc: linux-kernel@...r.kernel.org, Wei Gong <gongwei833x@...il.com>
Subject: Re: [PATCH v3] genirq: avoid long loops in handle_edge_irq
On Thu, Sep 28 2023 at 18:06, Wei Gong wrote:
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -831,7 +831,9 @@ void handle_edge_irq(struct irq_desc *desc)
> handle_irq_event(desc);
>
> } while ((desc->istate & IRQS_PENDING) &&
> - !irqd_irq_disabled(&desc->irq_data));
> + !irqd_irq_disabled(&desc->irq_data) &&
> + cpumask_test_cpu(smp_processor_id(),
> + irq_data_get_effective_affinity_mask(&desc->irq_data)));
Ok. So now that mask part is correct, but what guarantees that this does
not lose interrupts?
Assume the following scenario:
CPU 0 CPU 1
interrupt
set IN_PROGRESS
do {
change_affinity_to(CPU1);
handle_irq_event()
ack_in_device()
interrupt
set PENDING
} while (COND)
Now $COND is not true due to the affinity change and the edge handler
returns. As a consequence nothing acks the device and no further
interrupts are sent by the device.
That might not be true for your case, but that's a generic function and the
zoo of hardware which uses that is massive.
So no, we are not taking a risk here.
Thanks,
tglx
Powered by blists - more mailing lists