All of lore.kernel.org
 help / color / mirror / Atom feed
* [dovetail-6.7][PATCH 1/2] genirq: irq_pipeline: Add lock guard support for hard spinlocks
@ 2023-12-09  9:02 Jan Kiszka
  2023-12-12  8:39 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2023-12-09  9:02 UTC (permalink / raw)
  To: Xenomai, Philippe Gerum

From: Jan Kiszka <jan.kiszka@siemens.com>

Will be needed when converting guard users of raw spinlocks to hard
ones.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/linux/spinlock.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index d5ab32d64cab..0f01c1cce343 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -554,6 +554,26 @@ DEFINE_LOCK_GUARD_1(raw_spinlock_irqsave, raw_spinlock_t,
 		    raw_spin_unlock_irqrestore(_T->lock, _T->flags),
 		    unsigned long flags)
 
+DEFINE_LOCK_GUARD_1(hard_spinlock, hard_spinlock_t,
+		    hard_spin_lock((raw_spinlock_t *)_T->lock),
+		    hard_spin_unlock((raw_spinlock_t *)_T->lock))
+
+DEFINE_LOCK_GUARD_1(hard_spinlock_nested, hard_spinlock_t,
+		    hard_spin_lock_nested((raw_spinlock_t *)_T->lock,
+					  SINGLE_DEPTH_NESTING),
+		    hard_spin_unlock((raw_spinlock_t *)_T->lock))
+
+DEFINE_LOCK_GUARD_1(hard_spinlock_irq, hard_spinlock_t,
+		    hard_spin_lock_irq((raw_spinlock_t *)_T->lock),
+		    hard_spin_unlock_irq((raw_spinlock_t *)_T->lock))
+
+DEFINE_LOCK_GUARD_1(hard_spinlock_irqsave, hard_spinlock_t,
+		    hard_spin_lock_irqsave((raw_spinlock_t *)_T->lock,
+					   _T->flags),
+		    hard_spin_unlock_irqrestore((raw_spinlock_t *)_T->lock,
+						_T->flags),
+		    unsigned long flags)
+
 DEFINE_LOCK_GUARD_1(spinlock, spinlock_t,
 		    spin_lock(_T->lock),
 		    spin_unlock(_T->lock))
-- 
2.35.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [dovetail-6.7][PATCH 1/2] genirq: irq_pipeline: Add lock guard support for hard spinlocks
  2023-12-09  9:02 [dovetail-6.7][PATCH 1/2] genirq: irq_pipeline: Add lock guard support for hard spinlocks Jan Kiszka
@ 2023-12-12  8:39 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2023-12-12  8:39 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai


Jan Kiszka <jan.kiszka@siemens.com> writes:

> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Will be needed when converting guard users of raw spinlocks to hard
> ones.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  include/linux/spinlock.h | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
> index d5ab32d64cab..0f01c1cce343 100644
> --- a/include/linux/spinlock.h
> +++ b/include/linux/spinlock.h
> @@ -554,6 +554,26 @@ DEFINE_LOCK_GUARD_1(raw_spinlock_irqsave, raw_spinlock_t,
>  		    raw_spin_unlock_irqrestore(_T->lock, _T->flags),
>  		    unsigned long flags)
>  
> +DEFINE_LOCK_GUARD_1(hard_spinlock, hard_spinlock_t,
> +		    hard_spin_lock((raw_spinlock_t *)_T->lock),
> +		    hard_spin_unlock((raw_spinlock_t *)_T->lock))
> +
> +DEFINE_LOCK_GUARD_1(hard_spinlock_nested, hard_spinlock_t,
> +		    hard_spin_lock_nested((raw_spinlock_t *)_T->lock,
> +					  SINGLE_DEPTH_NESTING),
> +		    hard_spin_unlock((raw_spinlock_t *)_T->lock))
> +
> +DEFINE_LOCK_GUARD_1(hard_spinlock_irq, hard_spinlock_t,
> +		    hard_spin_lock_irq((raw_spinlock_t *)_T->lock),
> +		    hard_spin_unlock_irq((raw_spinlock_t *)_T->lock))
> +
> +DEFINE_LOCK_GUARD_1(hard_spinlock_irqsave, hard_spinlock_t,
> +		    hard_spin_lock_irqsave((raw_spinlock_t *)_T->lock,
> +					   _T->flags),
> +		    hard_spin_unlock_irqrestore((raw_spinlock_t *)_T->lock,
> +						_T->flags),
> +		    unsigned long flags)
> +
>  DEFINE_LOCK_GUARD_1(spinlock, spinlock_t,
>  		    spin_lock(_T->lock),
>  		    spin_unlock(_T->lock))

Series merged, thanks.

-- 
Philippe.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-12  8:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-09  9:02 [dovetail-6.7][PATCH 1/2] genirq: irq_pipeline: Add lock guard support for hard spinlocks Jan Kiszka
2023-12-12  8:39 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.