On Fri, Sep 25, 2026 at 03:39:04PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <[email protected]>
> 
> 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 <[email protected]>
> ---
> 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
> 

Reply via email to