Re: [patch V2 09/45] genirq/cpuhotplug: Convert to lock guards

Marek Szyprowski
2025-05-08T14:56:38Z

Hi Thomas,

On 29.04.2025 08:55, Thomas Gleixner wrote:
> Convert all lock/unlock pairs to guards and tidy up the code.
>
> No functional change.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
>
> ---
> kernel/irq/cpuhotplug.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> --- a/kernel/irq/cpuhotplug.c
> +++ b/kernel/irq/cpuhotplug.c
> @@ -177,9 +177,8 @@ void irq_migrate_all_off_this_cpu(void)
> bool affinity_broken;
>
> desc = irq_to_desc(irq);
> - raw_spin_lock(&desc->lock);
> - affinity_broken = migrate_one_irq(desc);
> - raw_spin_unlock(&desc->lock);
> + scoped_guard(raw_spinlock, &desc->lock)
> + affinity_broken = migrate_one_irq(desc);
>
> if (affinity_broken) {
> pr_debug_ratelimited("IRQ %u: no longer affine to CPU%u\n",
> @@ -244,9 +243,8 @@ int irq_affinity_online_cpu(unsigned int
> irq_lock_sparse();
> for_each_active_irq(irq) {
> desc = irq_to_desc(irq);
> - raw_spin_lock_irq(&desc->lock);
> - irq_restore_affinity_of_irq(desc, cpu);
> - raw_spin_unlock_irq(&desc->lock);
> + scoped_guard(raw_spinlock, &desc->lock)

The above should be "scoped_guard(raw_spinlock_irq, &desc->lock)", otherwise the cpu hotplug is broken as in today's linux-next.

> + irq_restore_affinity_of_irq(desc, cpu);
> }
> irq_unlock_sparse();
>
>
>
>
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland