Re: [PATCH v5 net-next 01/15] locking/local_lock: Introduce guard definition for local_lock.

From: Thomas Gleixner
Date: Fri Jun 07 2024 - 09:55:25 EST


On Fri, Jun 07 2024 at 08:53, Sebastian Andrzej Siewior wrote:

> Introduce lock guard definition for local_lock_t. There are no users
> yet.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
> include/linux/local_lock.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/include/linux/local_lock.h b/include/linux/local_lock.h
> index e55010fa73296..82366a37f4474 100644
> --- a/include/linux/local_lock.h
> +++ b/include/linux/local_lock.h
> @@ -51,4 +51,15 @@
> #define local_unlock_irqrestore(lock, flags) \
> __local_unlock_irqrestore(lock, flags)
>
> +DEFINE_GUARD(local_lock, local_lock_t __percpu*,
> + local_lock(_T),
> + local_unlock(_T))
> +DEFINE_GUARD(local_lock_irq, local_lock_t __percpu*,
> + local_lock_irq(_T),
> + local_unlock_irq(_T))
> +DEFINE_LOCK_GUARD_1(local_lock_irqsave, local_lock_t __percpu,
> + local_lock_irqsave(_T->lock, _T->flags),
> + local_unlock_irqrestore(_T->lock, _T->flags),
> + unsigned long flags)
> +
> #endif

Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>