RE: [PATCH 1/2] genirq: Allow an interrupt to be marked as 'naked'
From: David Laight
Date: Sun Nov 01 2020 - 09:34:58 EST
From: Marc Zyngier
> Sent: 01 November 2020 13:14
>
> Some interrupts (such as the rescheduling IPI) rely on not going through
> the irq_enter()/irq_exit() calls. To distinguish such interrupts, add
> a new IRQ flag that allows the low-level handling code to sidestep the
> enter()/exit() calls.
>
> Only the architecture code is expected to use this. It will do the wrong
> thing on normal interrupts.
>
> Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
> ---
> include/linux/irq.h | 4 +++-
> kernel/irq/debugfs.c | 1 +
> kernel/irq/irqdesc.c | 17 ++++++++++++-----
> kernel/irq/settings.h | 7 +++++++
> 4 files changed, 23 insertions(+), 6 deletions(-)
>
...
> diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
> index 1a7723604399..c08a1c19d061 100644
> --- a/kernel/irq/irqdesc.c
> +++ b/kernel/irq/irqdesc.c
> @@ -667,10 +667,9 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
> {
> struct pt_regs *old_regs = set_irq_regs(regs);
> unsigned int irq = hwirq;
> + struct irq_desc *desc;
> int ret = 0;
>
> - irq_enter();
> -
> #ifdef CONFIG_IRQ_DOMAIN
> if (lookup)
> irq = irq_find_mapping(domain, hwirq);
> @@ -680,14 +679,22 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
> * Some hardware gives randomly wrong interrupts. Rather
> * than crashing, do something sensible.
> */
> - if (unlikely(!irq || irq >= nr_irqs)) {
> + desc = irq_to_desc(irq);
> + if (unlikely(!desc || irq >= nr_irqs)) {
Should those tests be in the other order?
Probably as:
if (unlikely(irq >= nr_irqs || !(desc = irq_to_desc(irq))) {
...
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)