[patch V2 00/45] genirq: Cleanups and conversion to lock guards

Thomas Gleixner posted 45 patches 7 months, 3 weeks ago
include/linux/irq.h     |    2
kernel/irq/autoprobe.c  |   26 -
kernel/irq/chip.c       |  609 ++++++++++---------------
kernel/irq/cpuhotplug.c |   10
kernel/irq/debugfs.c    |    3
kernel/irq/internals.h  |   47 -
kernel/irq/irqdesc.c    |  127 +----
kernel/irq/manage.c     | 1154 ++++++++++++++++++++----------------------------
kernel/irq/pm.c         |   38 -
kernel/irq/proc.c       |   65 --
kernel/irq/resend.c     |   50 --
kernel/irq/spurious.c   |  104 +---
12 files changed, 913 insertions(+), 1322 deletions(-)
[patch V2 00/45] genirq: Cleanups and conversion to lock guards
Posted by Thomas Gleixner 7 months, 3 weeks ago
This is V2 of the generic interrupt locking overhaul. V1 can be found here:

   https://lore.kernel.org/all/20250313154615.860723120@linutronix.de

The generic interrupt core code has accumulated quite some inconsistencies
over time and a common pattern in various API functions is:

    unsigned long flags;
    struct irq_desc *desc = irq_get_desc_[bus]lock(irq, &flags, mode);

    if (!desc)
       return -EINVAL;
    ....
    irq_put_desc_[bus]unlock(desc, flags);

That's awkward and requires gotos in failure paths.

This series provides conditional lock guards and converts the core code
over to use those guards. Along with that it converts the other open coded
lock/unlock pairs and fixes up coding and kernel doc formatting.  The
conversions were partially done with Coccinelle where possible.

Changes vs. V1:

  - Rebase on latest tip irq/core

  - Make coding style consistent (Jiri, Shrikanth)

The series applies on

    git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core

and is also available from git:

    git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git irq/core

Thanks,

	tglx

---
 include/linux/irq.h     |    2 
 kernel/irq/autoprobe.c  |   26 -
 kernel/irq/chip.c       |  609 ++++++++++---------------
 kernel/irq/cpuhotplug.c |   10 
 kernel/irq/debugfs.c    |    3 
 kernel/irq/internals.h  |   47 -
 kernel/irq/irqdesc.c    |  127 +----
 kernel/irq/manage.c     | 1154 ++++++++++++++++++++----------------------------
 kernel/irq/pm.c         |   38 -
 kernel/irq/proc.c       |   65 --
 kernel/irq/resend.c     |   50 --
 kernel/irq/spurious.c   |  104 +---
 12 files changed, 913 insertions(+), 1322 deletions(-)
Re: [patch V2 00/45] genirq: Cleanups and conversion to lock guards
Posted by Peter Zijlstra 7 months, 2 weeks ago
On Tue, Apr 29, 2025 at 08:54:47AM +0200, Thomas Gleixner wrote:
> This is V2 of the generic interrupt locking overhaul. V1 can be found here:
> 
>    https://lore.kernel.org/all/20250313154615.860723120@linutronix.de
> 
> The generic interrupt core code has accumulated quite some inconsistencies
> over time and a common pattern in various API functions is:
> 
>     unsigned long flags;
>     struct irq_desc *desc = irq_get_desc_[bus]lock(irq, &flags, mode);
> 
>     if (!desc)
>        return -EINVAL;
>     ....
>     irq_put_desc_[bus]unlock(desc, flags);
> 
> That's awkward and requires gotos in failure paths.
> 
> This series provides conditional lock guards and converts the core code
> over to use those guards. Along with that it converts the other open coded
> lock/unlock pairs and fixes up coding and kernel doc formatting.  The
> conversions were partially done with Coccinelle where possible.


So while my eyes glazed over near the end of the series, the general
shape of things looks right.

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Jiri found a few nice cases where mixing the conditional scoped guard
with return variables went side-ways. I did a quick scan to see if I
could find more of that same pattern, but I think that's all of them.