Re: [PATCH v3 02/13] genirq: Define ack_irq() and eoi_irq() helpers
From: Marc Zyngier
Date: Thu Aug 12 2021 - 03:49:13 EST
On Tue, 29 Jun 2021 13:49:59 +0100,
Valentin Schneider <valentin.schneider@xxxxxxx> wrote:
>
> The newly-added IRQCHIP_AUTOMASKS_FLOW flag requires some additional
> bookkeeping around chip->{irq_ack, irq_eoi}() calls. Define wrappers around
> those chip callbacks to drive the IRQD_IRQ_FLOW_MASKED state of an IRQ when
> the chip has the IRQCHIP_AUTOMASKS_FLOW flag.
>
> Signed-off-by: Valentin Schneider <valentin.schneider@xxxxxxx>
> ---
> kernel/irq/chip.c | 16 ++++++++++++++++
> kernel/irq/internals.h | 2 ++
> 2 files changed, 18 insertions(+)
>
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index 21a21baa1366..793dbd8307b9 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -408,6 +408,22 @@ void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu)
> cpumask_clear_cpu(cpu, desc->percpu_enabled);
> }
>
> +void ack_irq(struct irq_desc *desc)
> +{
> + desc->irq_data.chip->irq_ack(&desc->irq_data);
> +
> + if (desc->irq_data.chip->flags & IRQCHIP_AUTOMASKS_FLOW)
> + irq_state_set_flow_masked(desc);
> +}
> +
> +void eoi_irq(struct irq_desc *desc)
> +{
> + desc->irq_data.chip->irq_eoi(&desc->irq_data);
> +
> + if (desc->irq_data.chip->flags & IRQCHIP_AUTOMASKS_FLOW)
> + irq_state_clr_flow_masked(desc);
I just realised that this has a good chance to result in a mess with
KVM, and specially the way we let the vGIC deactivate an interrupt
directly from the guest, without any SW intervention (the magic HW bit
in the LRs).
With this, interrupts routed to a guest (such as the timers) will
always have the IRQD_IRQ_FLOW_MASKED flag set, which will never be
cleared.
I wonder whether this have a chance to interact badly with
mask/unmask, or with the rest of the flow...
Thanks,
M.
--
Without deviation from the norm, progress is not possible.