mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/1] spinlock: Fix failing build for PREEMPT_RT
@ 2024-01-15 20:19 Leonardo Bras
  2024-01-15 21:54 ` Kent Overstreet
  0 siblings, 1 reply; 5+ messages in thread
From: Leonardo Bras @ 2024-01-15 20:19 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Will Deacon, Waiman Long,
	Boqun Feng, Kent Overstreet, Marcelo Tosatti
  Cc: Leonardo Bras, linux-kernel

Since 1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to
spinlock.h") build fails for PREEMPT_RT, since there is no definition
available of either spin_needbreak() and rwlock_needbreak().

Since it was moved on the mentioned commit, it was placed inside a
!PREEMPT_RT part of the code, making it out of reach for an RT kernel.

Fix this by moving code it a few lines down so it can be reached by an
RT build, where it can also make use of the *_is_contended() definition
added by the spinlock_rt.h.

Fixes: d1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to
spinlock.h")
Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
 include/linux/spinlock.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index eaac8b0da25b8..3fcd20de6ca88 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -449,6 +449,12 @@ static __always_inline int spin_is_contended(spinlock_t *lock)
 	return raw_spin_is_contended(&lock->rlock);
 }
 
+#define assert_spin_locked(lock)	assert_raw_spin_locked(&(lock)->rlock)
+
+#else  /* !CONFIG_PREEMPT_RT */
+# include <linux/spinlock_rt.h>
+#endif /* CONFIG_PREEMPT_RT */
+
 /*
  * Does a critical section need to be broken due to another
  * task waiting?: (technically does not depend on CONFIG_PREEMPTION,
@@ -480,12 +486,6 @@ static inline int rwlock_needbreak(rwlock_t *lock)
 #endif
 }
 
-#define assert_spin_locked(lock)	assert_raw_spin_locked(&(lock)->rlock)
-
-#else  /* !CONFIG_PREEMPT_RT */
-# include <linux/spinlock_rt.h>
-#endif /* CONFIG_PREEMPT_RT */
-
 /*
  * Pull the atomic_t declaration:
  * (asm-mips/atomic.h needs above definitions)
-- 
2.43.0


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

* Re: [PATCH v1 1/1] spinlock: Fix failing build for PREEMPT_RT
  2024-01-15 20:19 [PATCH v1 1/1] spinlock: Fix failing build for PREEMPT_RT Leonardo Bras
@ 2024-01-15 21:54 ` Kent Overstreet
  2024-01-16  4:02   ` Leonardo Bras
  0 siblings, 1 reply; 5+ messages in thread
From: Kent Overstreet @ 2024-01-15 21:54 UTC (permalink / raw)
  To: Leonardo Bras
  Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Waiman Long,
	Boqun Feng, Marcelo Tosatti, linux-kernel

On Mon, Jan 15, 2024 at 05:19:34PM -0300, Leonardo Bras wrote:
> Since 1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to
> spinlock.h") build fails for PREEMPT_RT, since there is no definition
> available of either spin_needbreak() and rwlock_needbreak().
> 
> Since it was moved on the mentioned commit, it was placed inside a
> !PREEMPT_RT part of the code, making it out of reach for an RT kernel.
> 
> Fix this by moving code it a few lines down so it can be reached by an
> RT build, where it can also make use of the *_is_contended() definition
> added by the spinlock_rt.h.
> 
> Fixes: d1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to
> spinlock.h")
> Signed-off-by: Leonardo Bras <leobras@redhat.com>

I've picked this up - thanks!

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

* Re: [PATCH v1 1/1] spinlock: Fix failing build for PREEMPT_RT
  2024-01-15 21:54 ` Kent Overstreet
@ 2024-01-16  4:02   ` Leonardo Bras
  0 siblings, 0 replies; 5+ messages in thread
From: Leonardo Bras @ 2024-01-16  4:02 UTC (permalink / raw)
  To: Kent Overstreet
  Cc: Leonardo Bras, Peter Zijlstra, Ingo Molnar, Will Deacon,
	Waiman Long, Boqun Feng, Marcelo Tosatti, linux-kernel

On Mon, Jan 15, 2024 at 04:54:14PM -0500, Kent Overstreet wrote:
> On Mon, Jan 15, 2024 at 05:19:34PM -0300, Leonardo Bras wrote:
> > Since 1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to
> > spinlock.h") build fails for PREEMPT_RT, since there is no definition
> > available of either spin_needbreak() and rwlock_needbreak().
> > 
> > Since it was moved on the mentioned commit, it was placed inside a
> > !PREEMPT_RT part of the code, making it out of reach for an RT kernel.
> > 
> > Fix this by moving code it a few lines down so it can be reached by an
> > RT build, where it can also make use of the *_is_contended() definition
> > added by the spinlock_rt.h.
> > 
> > Fixes: d1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to
> > spinlock.h")
> > Signed-off-by: Leonardo Bras <leobras@redhat.com>
> 
> I've picked this up - thanks!
> 

Awesome! Thanks!

Leo


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

* Re: [PATCH v1 1/1] spinlock: Fix failing build for PREEMPT_RT
  2024-01-16  7:32 ` [PATCH v1 1/1] spinlock: Fix failing build " Leonardo Bras
@ 2024-01-16  7:37   ` Leonardo Bras
  0 siblings, 0 replies; 5+ messages in thread
From: Leonardo Bras @ 2024-01-16  7:37 UTC (permalink / raw)
  To: Leonardo Bras
  Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Waiman Long,
	Boqun Feng, Kent Overstreet, Marcelo Tosatti, linux-kernel

On Tue, Jan 16, 2024 at 04:32:32AM -0300, Leonardo Bras wrote:
> Since 1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to
> spinlock.h") build fails for PREEMPT_RT, since there is no definition
> available of either spin_needbreak() and rwlock_needbreak().
> 
> Since it was moved on the mentioned commit, it was placed inside a
> !PREEMPT_RT part of the code, making it out of reach for an RT kernel.
> 
> Fix this by moving code it a few lines down so it can be reached by an
> RT build, where it can also make use of the *_is_contended() definition
> added by the spinlock_rt.h.
> 
> Fixes: d1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to
> spinlock.h")
> Signed-off-by: Leonardo Bras <leobras@redhat.com>
> ---
>  include/linux/spinlock.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
> index eaac8b0da25b8..3fcd20de6ca88 100644
> --- a/include/linux/spinlock.h
> +++ b/include/linux/spinlock.h
> @@ -449,6 +449,12 @@ static __always_inline int spin_is_contended(spinlock_t *lock)
>  	return raw_spin_is_contended(&lock->rlock);
>  }
>  
> +#define assert_spin_locked(lock)	assert_raw_spin_locked(&(lock)->rlock)
> +
> +#else  /* !CONFIG_PREEMPT_RT */
> +# include <linux/spinlock_rt.h>
> +#endif /* CONFIG_PREEMPT_RT */
> +
>  /*
>   * Does a critical section need to be broken due to another
>   * task waiting?: (technically does not depend on CONFIG_PREEMPTION,
> @@ -480,12 +486,6 @@ static inline int rwlock_needbreak(rwlock_t *lock)
>  #endif
>  }
>  
> -#define assert_spin_locked(lock)	assert_raw_spin_locked(&(lock)->rlock)
> -
> -#else  /* !CONFIG_PREEMPT_RT */
> -# include <linux/spinlock_rt.h>
> -#endif /* CONFIG_PREEMPT_RT */
> -
>  /*
>   * Pull the atomic_t declaration:
>   * (asm-mips/atomic.h needs above definitions)
> -- 
> 2.43.0
> 


Nevermind, sent this one by mistake.


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

* [PATCH v1 1/1] spinlock: Fix failing build for PREEMPT_RT
  2024-01-16  7:32 [RFC PATCH v1 0/2] Fix serial console " Leonardo Bras
@ 2024-01-16  7:32 ` Leonardo Bras
  2024-01-16  7:37   ` Leonardo Bras
  0 siblings, 1 reply; 5+ messages in thread
From: Leonardo Bras @ 2024-01-16  7:32 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Will Deacon, Waiman Long,
	Boqun Feng, Kent Overstreet, Marcelo Tosatti
  Cc: Leonardo Bras, linux-kernel

Since 1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to
spinlock.h") build fails for PREEMPT_RT, since there is no definition
available of either spin_needbreak() and rwlock_needbreak().

Since it was moved on the mentioned commit, it was placed inside a
!PREEMPT_RT part of the code, making it out of reach for an RT kernel.

Fix this by moving code it a few lines down so it can be reached by an
RT build, where it can also make use of the *_is_contended() definition
added by the spinlock_rt.h.

Fixes: d1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to
spinlock.h")
Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
 include/linux/spinlock.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index eaac8b0da25b8..3fcd20de6ca88 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -449,6 +449,12 @@ static __always_inline int spin_is_contended(spinlock_t *lock)
 	return raw_spin_is_contended(&lock->rlock);
 }
 
+#define assert_spin_locked(lock)	assert_raw_spin_locked(&(lock)->rlock)
+
+#else  /* !CONFIG_PREEMPT_RT */
+# include <linux/spinlock_rt.h>
+#endif /* CONFIG_PREEMPT_RT */
+
 /*
  * Does a critical section need to be broken due to another
  * task waiting?: (technically does not depend on CONFIG_PREEMPTION,
@@ -480,12 +486,6 @@ static inline int rwlock_needbreak(rwlock_t *lock)
 #endif
 }
 
-#define assert_spin_locked(lock)	assert_raw_spin_locked(&(lock)->rlock)
-
-#else  /* !CONFIG_PREEMPT_RT */
-# include <linux/spinlock_rt.h>
-#endif /* CONFIG_PREEMPT_RT */
-
 /*
  * Pull the atomic_t declaration:
  * (asm-mips/atomic.h needs above definitions)
-- 
2.43.0


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

end of thread, other threads:[~2024-01-16  7:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-15 20:19 [PATCH v1 1/1] spinlock: Fix failing build for PREEMPT_RT Leonardo Bras
2024-01-15 21:54 ` Kent Overstreet
2024-01-16  4:02   ` Leonardo Bras
2024-01-16  7:32 [RFC PATCH v1 0/2] Fix serial console " Leonardo Bras
2024-01-16  7:32 ` [PATCH v1 1/1] spinlock: Fix failing build " Leonardo Bras
2024-01-16  7:37   ` Leonardo Bras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®