Re: [patch 2/7] genirq/generic-chip: Convert core code to lock guards
From: Geert Uytterhoeven
Date: Tue Apr 08 2025 - 14:10:31 EST
Hi Thomas,
On Thu, 13 Mar 2025 at 15:37, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> Replace the irq_gc_lock/unlock() pairs with guards. There is no point to
> implement a guard wrapper for them as they just wrap around raw_spin_lock*().
>
> Switch the other lock instances in the core code to guards as well.
>
> Conversion was done with Coccinelle plus manual fixups.
>
> No functional change.
>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Thanks for your patch, which is now commit 195298c3b11628a6
("genirq/generic-chip: Convert core code to lock guards") in
irqchip/irq/drivers.
> --- a/kernel/irq/generic-chip.c
> +++ b/kernel/irq/generic-chip.c
> @@ -340,9 +330,8 @@ int irq_domain_alloc_generic_chips(struc
> goto err;
> }
>
> - raw_spin_lock_irqsave(&gc_lock, flags);
> - list_add_tail(&gc->list, &gc_list);
> - raw_spin_unlock_irqrestore(&gc_lock, flags);
> + scoped_guard (raw_spinlock, &gc_lock)
> + list_add_tail(&gc->list, &gc_list);
> /* Calc pointer to the next generic chip */
> tmp += gc_sz;
> }
> @@ -459,7 +448,6 @@ int irq_map_generic_chip(struct irq_doma
> struct irq_chip_generic *gc;
> struct irq_chip_type *ct;
> struct irq_chip *chip;
> - unsigned long flags;
> int idx;
>
> gc = __irq_get_domain_generic_chip(d, hw_irq);
> @@ -479,9 +467,8 @@ int irq_map_generic_chip(struct irq_doma
>
> /* We only init the cache for the first mapping of a generic chip */
> if (!gc->installed) {
> - raw_spin_lock_irqsave(&gc->lock, flags);
> + guard(raw_spinlock_irq)(&gc->lock);
> irq_gc_init_mask_cache(gc, dgc->gc_flags);
> - raw_spin_unlock_irqrestore(&gc->lock, flags);
> }
>
> /* Mark the interrupt as installed */
These two conversions are wrong. I have sent a patch:
https://lore.kernel.org/514f94c5891c61ac0a4a7fdad113e75db1eea367.1744135467.git.geert+renesas@xxxxxxxxx
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds