mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rcu: include rtmutex_common.h in tree_stall.h
@ 2026-09-25 13:39 Arnd Bergmann
  2026-09-27 20:03 ` Bradley Morgan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arnd Bergmann @ 2026-09-25 13:39 UTC (permalink / raw)
  To: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Uladzislau Rezki
  Cc: Arnd Bergmann, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Zqiang, Thomas Gleixner, Tejun Heo, Andrea Righi,
	Cheng-Yang Chou, Gustavo Luiz Duarte, Kunwu Chan, rcu,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The added call to rt_mutex_owner() makes this fail to build in
some configurations:

In file included from kernel/rcu/tree.c:5121:
kernel/rcu/tree_stall.h:333:8: error: call to undeclared function 'rt_mutex_owner'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
      |                             ^
kernel/rcu/tree_stall.h:333:48: error: comparison between pointer and integer ('int' and 'struct task_struct *') [-Werror,-Wpointer-integer-compare]
  333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
In file included from kernel/rcu/tree.c:5124:
In file included from kernel/rcu/tree_plugin.h:14:
kernel/rcu/../locking/rtmutex_common.h:231:35: error: conflicting types for 'rt_mutex_owner'
  231 | static inline struct task_struct *rt_mutex_owner(struct rt_mutex_base *lock)
      |                                   ^
kernel/rcu/tree_stall.h:333:8: note: previous implicit declaration is here
  333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
      |                             ^

There are already a couple of inclusions of "../locking/rtmutex_common.h",
so assume this is safe to do here.

Fixes: 1eccf02fb8d5 ("rcu: Add running and boosted indications to RCU task stall dump")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I wonder if it would be better to either move the rt_mutex_owner()
definition into a global header like include/linux/rtmutex.h, or to
move the code out of tree_stall.h into a .c file, as this feels like a
layering violation.
---
 kernel/rcu/tree_stall.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
index 5dded1e89197..803a56af3259 100644
--- a/kernel/rcu/tree_stall.h
+++ b/kernel/rcu/tree_stall.h
@@ -12,6 +12,7 @@
 #include <linux/rcu_notifier.h>
 #include <linux/smp.h>
 #include <linux/rtmutex.h>
+#include "../locking/rtmutex_common.h"
 
 //////////////////////////////////////////////////////////////////////////////
 //
-- 
2.53.0


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

* Re: [PATCH] rcu: include rtmutex_common.h in tree_stall.h
  2026-09-25 13:39 [PATCH] rcu: include rtmutex_common.h in tree_stall.h Arnd Bergmann
@ 2026-09-27 20:03 ` Bradley Morgan
  2026-09-28  2:54 ` KunWu Chan
  2026-09-29 21:07 ` Paul E. McKenney
  2 siblings, 0 replies; 6+ messages in thread
From: Bradley Morgan @ 2026-09-27 20:03 UTC (permalink / raw)
  To: arnd
  Cc: arighi, arnd, boqun, frederic, gustavold, jiangshanlai,
	joelagnelf, josh, kunwu.chan, linux-kernel, mathieu.desnoyers,
	neeraj.upadhyay, paulmck, qiang.zhang, rcu, rostedt, tglx, tj,
	urezki, yphbchou0911

On 25 September 2026 14:39:04 BST, Arnd Bergmann <arnd@kernel.org> wrote:
>From: Arnd Bergmann <arnd@arndb.de>
>
>The added call to rt_mutex_owner() makes this fail to build in
>some configurations:
>
>In file included from kernel/rcu/tree.c:5121:
>kernel/rcu/tree_stall.h:333:8: error: call to undeclared function
>'rt_mutex_owner'; ISO C99 and later do not support implicit function
>declarations [-Wimplicit-function-declaration]
>  333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
>      |                             ^
>kernel/rcu/tree_stall.h:333:48: error: comparison between pointer and
>integer ('int' and 'struct task_struct *')
>[-Werror,-Wpointer-integer-compare]
>  333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
>      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
>In file included from kernel/rcu/tree.c:5124:
>In file included from kernel/rcu/tree_plugin.h:14:
>kernel/rcu/../locking/rtmutex_common.h:231:35: error: conflicting types
>for 'rt_mutex_owner'
>  231 | static inline struct task_struct *rt_mutex_owner(struct rt_mutex_base *lock)
>      |                                   ^
>kernel/rcu/tree_stall.h:333:8: note: previous implicit declaration is here
>  333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
>      |                             ^
>
>There are already a couple of inclusions of "../locking/rtmutex_common.h",
>so assume this is safe to do here.
>
>Fixes: 1eccf02fb8d5 ("rcu: Add running and boosted indications to RCU task stall dump")
>Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Looks "ok" 

Reviewed-by: Bradley Morgan <brads@mainlining.org>

Perhaps Paul could suggest another alternative M

>---
>I wonder if it would be better to either move the rt_mutex_owner()
>definition into a global header like include/linux/rtmutex.h, or to
>move the code out of tree_stall.h into a .c file, as this feels like a
>layering violation.
>---
> kernel/rcu/tree_stall.h | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
>index 5dded1e89197..803a56af3259 100644
>--- a/kernel/rcu/tree_stall.h
>+++ b/kernel/rcu/tree_stall.h
>@@ -12,6 +12,7 @@
> #include <linux/rcu_notifier.h>
> #include <linux/smp.h>
> #include <linux/rtmutex.h>
>+#include "../locking/rtmutex_common.h"
> 
> //////////////////////////////////////////////////////////////////////////////
> //
>

--- Thanks!
"I'm not a very positive person" - Linus torvalds

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

* Re: [PATCH] rcu: include rtmutex_common.h in tree_stall.h
  2026-09-25 13:39 [PATCH] rcu: include rtmutex_common.h in tree_stall.h Arnd Bergmann
  2026-09-27 20:03 ` Bradley Morgan
@ 2026-09-28  2:54 ` KunWu Chan
  2026-09-29 21:08   ` Paul E. McKenney
  2026-09-29 21:07 ` Paul E. McKenney
  2 siblings, 1 reply; 6+ messages in thread
From: KunWu Chan @ 2026-09-28  2:54 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Uladzislau Rezki,
	Arnd Bergmann, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Zqiang, Thomas Gleixner, Tejun Heo, Andrea Righi,
	Cheng-Yang Chou, Gustavo Luiz Duarte, rcu, linux-kernel

Thanks, Arnd.

Tested on top of 1eccf02fb8d5 with CONFIG_PREEMPT_RCU=y:

CONFIG_RT_MUTEXES=y: build passes
CONFIG_RT_MUTEXES=n: fails without this patch, passes with it

The failure is in tree_stall.h, where rt_mutex_owner() is used
before tree_plugin.h includes rtmutex_common.h. This matches the
reported failure, and the added include fixes it.

Reviewed-by: Kunwu Chan <kunwu.chan@gmail.com>
Tested-by: Kunwu Chan <kunwu.chan@gmail.com>

Thanks,
Kunwu

On Fri, Sep 25, 2026 at 9:39 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The added call to rt_mutex_owner() makes this fail to build in
> some configurations:
>
> In file included from kernel/rcu/tree.c:5121:
> kernel/rcu/tree_stall.h:333:8: error: call to undeclared function 'rt_mutex_owner'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>   333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
>       |                             ^
> kernel/rcu/tree_stall.h:333:48: error: comparison between pointer and integer ('int' and 'struct task_struct *') [-Werror,-Wpointer-integer-compare]
>   333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
>       |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
> In file included from kernel/rcu/tree.c:5124:
> In file included from kernel/rcu/tree_plugin.h:14:
> kernel/rcu/../locking/rtmutex_common.h:231:35: error: conflicting types for 'rt_mutex_owner'
>   231 | static inline struct task_struct *rt_mutex_owner(struct rt_mutex_base *lock)
>       |                                   ^
> kernel/rcu/tree_stall.h:333:8: note: previous implicit declaration is here
>   333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
>       |                             ^
>
> There are already a couple of inclusions of "../locking/rtmutex_common.h",
> so assume this is safe to do here.
>
> Fixes: 1eccf02fb8d5 ("rcu: Add running and boosted indications to RCU task stall dump")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> I wonder if it would be better to either move the rt_mutex_owner()
> definition into a global header like include/linux/rtmutex.h, or to
> move the code out of tree_stall.h into a .c file, as this feels like a
> layering violation.
> ---
>  kernel/rcu/tree_stall.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> index 5dded1e89197..803a56af3259 100644
> --- a/kernel/rcu/tree_stall.h
> +++ b/kernel/rcu/tree_stall.h
> @@ -12,6 +12,7 @@
>  #include <linux/rcu_notifier.h>
>  #include <linux/smp.h>
>  #include <linux/rtmutex.h>
> +#include "../locking/rtmutex_common.h"
>
>  //////////////////////////////////////////////////////////////////////////////
>  //
> --
> 2.53.0
>

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

* Re: [PATCH] rcu: include rtmutex_common.h in tree_stall.h
  2026-09-25 13:39 [PATCH] rcu: include rtmutex_common.h in tree_stall.h Arnd Bergmann
  2026-09-27 20:03 ` Bradley Morgan
  2026-09-28  2:54 ` KunWu Chan
@ 2026-09-29 21:07 ` Paul E. McKenney
  2026-09-30  7:07   ` Arnd Bergmann
  2 siblings, 1 reply; 6+ messages in thread
From: Paul E. McKenney @ 2026-09-29 21:07 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki, Arnd Bergmann,
	Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Zqiang,
	Thomas Gleixner, Tejun Heo, Andrea Righi, Cheng-Yang Chou,
	Gustavo Luiz Duarte, Kunwu Chan, rcu, linux-kernel

On Fri, Sep 25, 2026 at 03:39:04PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The added call to rt_mutex_owner() makes this fail to build in
> some configurations:
> 
> In file included from kernel/rcu/tree.c:5121:
> kernel/rcu/tree_stall.h:333:8: error: call to undeclared function 'rt_mutex_owner'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>   333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
>       |                             ^
> kernel/rcu/tree_stall.h:333:48: error: comparison between pointer and integer ('int' and 'struct task_struct *') [-Werror,-Wpointer-integer-compare]
>   333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
>       |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
> In file included from kernel/rcu/tree.c:5124:
> In file included from kernel/rcu/tree_plugin.h:14:
> kernel/rcu/../locking/rtmutex_common.h:231:35: error: conflicting types for 'rt_mutex_owner'
>   231 | static inline struct task_struct *rt_mutex_owner(struct rt_mutex_base *lock)
>       |                                   ^
> kernel/rcu/tree_stall.h:333:8: note: previous implicit declaration is here
>   333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
>       |                             ^
> 
> There are already a couple of inclusions of "../locking/rtmutex_common.h",
> so assume this is safe to do here.
> 
> Fixes: 1eccf02fb8d5 ("rcu: Add running and boosted indications to RCU task stall dump")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> I wonder if it would be better to either move the rt_mutex_owner()
> definition into a global header like include/linux/rtmutex.h, or to
> move the code out of tree_stall.h into a .c file, as this feels like a
> layering violation.

Good catch, and thank you!!!

What I am going to do in the name of bisectability is to merge this into
the commit that added that call to rt_mutex_owner(), which attribution:

1eccf02fb8d5 ("rcu: Add running and boosted indications to RCU task stall dump")

I am also removing the #include of that same file from it old place in
kernel/rcu/tree_plugin.h, where it has lived since 2014.

But you are right that this is the only #include of that file outside
of kernel/locking.

Fair enough?

							Thanx, Paul

> ---
>  kernel/rcu/tree_stall.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> index 5dded1e89197..803a56af3259 100644
> --- a/kernel/rcu/tree_stall.h
> +++ b/kernel/rcu/tree_stall.h
> @@ -12,6 +12,7 @@
>  #include <linux/rcu_notifier.h>
>  #include <linux/smp.h>
>  #include <linux/rtmutex.h>
> +#include "../locking/rtmutex_common.h"
>  
>  //////////////////////////////////////////////////////////////////////////////
>  //
> -- 
> 2.53.0
> 

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

* Re: [PATCH] rcu: include rtmutex_common.h in tree_stall.h
  2026-09-28  2:54 ` KunWu Chan
@ 2026-09-29 21:08   ` Paul E. McKenney
  0 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2026-09-29 21:08 UTC (permalink / raw)
  To: KunWu Chan
  Cc: Arnd Bergmann, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Uladzislau Rezki,
	Arnd Bergmann, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Zqiang, Thomas Gleixner, Tejun Heo, Andrea Righi,
	Cheng-Yang Chou, Gustavo Luiz Duarte, rcu, linux-kernel

On Mon, Sep 28, 2026 at 10:54:13AM +0800, KunWu Chan wrote:
> Thanks, Arnd.
> 
> Tested on top of 1eccf02fb8d5 with CONFIG_PREEMPT_RCU=y:
> 
> CONFIG_RT_MUTEXES=y: build passes
> CONFIG_RT_MUTEXES=n: fails without this patch, passes with it
> 
> The failure is in tree_stall.h, where rt_mutex_owner() is used
> before tree_plugin.h includes rtmutex_common.h. This matches the
> reported failure, and the added include fixes it.
> 
> Reviewed-by: Kunwu Chan <kunwu.chan@gmail.com>
> Tested-by: Kunwu Chan <kunwu.chan@gmail.com>

Bradley and Kunwu, are you OK with my applying your tags to the commit
that I am merging this into?

1eccf02fb8d5 ("rcu: Add running and boosted indications to RCU task stall dump")

							Thanx, Paul

> Thanks,
> Kunwu
> 
> On Fri, Sep 25, 2026 at 9:39 PM Arnd Bergmann <arnd@kernel.org> wrote:
> >
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The added call to rt_mutex_owner() makes this fail to build in
> > some configurations:
> >
> > In file included from kernel/rcu/tree.c:5121:
> > kernel/rcu/tree_stall.h:333:8: error: call to undeclared function 'rt_mutex_owner'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> >   333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
> >       |                             ^
> > kernel/rcu/tree_stall.h:333:48: error: comparison between pointer and integer ('int' and 'struct task_struct *') [-Werror,-Wpointer-integer-compare]
> >   333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
> >       |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
> > In file included from kernel/rcu/tree.c:5124:
> > In file included from kernel/rcu/tree_plugin.h:14:
> > kernel/rcu/../locking/rtmutex_common.h:231:35: error: conflicting types for 'rt_mutex_owner'
> >   231 | static inline struct task_struct *rt_mutex_owner(struct rt_mutex_base *lock)
> >       |                                   ^
> > kernel/rcu/tree_stall.h:333:8: note: previous implicit declaration is here
> >   333 |                         if (rt_mutex_owner(&rnp->boost_mtx.rtmutex) == t)
> >       |                             ^
> >
> > There are already a couple of inclusions of "../locking/rtmutex_common.h",
> > so assume this is safe to do here.
> >
> > Fixes: 1eccf02fb8d5 ("rcu: Add running and boosted indications to RCU task stall dump")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > I wonder if it would be better to either move the rt_mutex_owner()
> > definition into a global header like include/linux/rtmutex.h, or to
> > move the code out of tree_stall.h into a .c file, as this feels like a
> > layering violation.
> > ---
> >  kernel/rcu/tree_stall.h | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> > index 5dded1e89197..803a56af3259 100644
> > --- a/kernel/rcu/tree_stall.h
> > +++ b/kernel/rcu/tree_stall.h
> > @@ -12,6 +12,7 @@
> >  #include <linux/rcu_notifier.h>
> >  #include <linux/smp.h>
> >  #include <linux/rtmutex.h>
> > +#include "../locking/rtmutex_common.h"
> >
> >  //////////////////////////////////////////////////////////////////////////////
> >  //
> > --
> > 2.53.0
> >
> 

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

* Re: [PATCH] rcu: include rtmutex_common.h in tree_stall.h
  2026-09-29 21:07 ` Paul E. McKenney
@ 2026-09-30  7:07   ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2026-09-30  7:07 UTC (permalink / raw)
  To: Paul E. McKenney, Arnd Bergmann
  Cc: Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Uladzislau Rezki (Sony),
	Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Zqiang,
	Thomas Gleixner, Tejun Heo, Andrea Righi, Cheng-Yang Chou,
	Gustavo Luiz Duarte, Kunwu Chan, rcu, linux-kernel

On Tue, Sep 29, 2026, at 23:07, Paul E. McKenney wrote:
> On Fri, Sep 25, 2026 at 03:39:04PM +0200, Arnd Bergmann wrote:
>
> Good catch, and thank you!!!
>
> What I am going to do in the name of bisectability is to merge this into
> the commit that added that call to rt_mutex_owner(), which attribution:
>
> 1eccf02fb8d5 ("rcu: Add running and boosted indications to RCU task stall dump")

Sounds good to me. Don't worry too much about attribution, you can always
treat my oneline fixes as bug reports. I just try to make it easy to apply
as-is in case you are not rebasing your patches.

    Arnd

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

end of thread, other threads:[~2026-09-30  7:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 13:39 [PATCH] rcu: include rtmutex_common.h in tree_stall.h Arnd Bergmann
2026-09-27 20:03 ` Bradley Morgan
2026-09-28  2:54 ` KunWu Chan
2026-09-29 21:08   ` Paul E. McKenney
2026-09-29 21:07 ` Paul E. McKenney
2026-09-30  7:07   ` Arnd Bergmann

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®