[PATCH] rcu: do not include rtmutex_common.h unconditionally

From: Sebastian Andrzej Siewior
Date: Wed Oct 18 2017 - 04:34:59 EST


Since commit bcda31a26594 ("rcu: Suppress lockdep false-positive
->boost_mtx complaints") the rtmutex_common.h is included
unconditionally. This break CONFIG_FUTEX=n configs which do not have
CONFIG_RT_MUTEX enabled which leads to the lack of certain members in
task_struct which are accessed in rtmutex_common.h as reported by the kbuild
test robot:
| In file included from include/uapi/linux/stddef.h:1:0,
| from include/linux/stddef.h:4,
| from include/uapi/linux/posix_types.h:4,
| from include/uapi/linux/types.h:13,
| from include/linux/types.h:5,
| from kernel/rcu/tree.c:30:
| kernel/rcu/../locking/rtmutex_common.h: In function 'task_has_pi_waiters':
|>> kernel/rcu/../locking/rtmutex_common.h:62:26: error: 'struct task_struct' has no member named 'pi_waiters'; did you mean 'cpu_timers'?

among other things.
I move the include back to the RCU_BOOST ifdef and add there the
rt_mutex_futex_unlock define like we already have it for rt_mutex_owner
for the same reason.
While at it, I remove the second rtmutex_common.h include within the
RCU_BOOST block because one of those is enough.

Fixes: bcda31a26594 ("rcu: Suppress lockdep false-positive ->boost_mtx complaints")
Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---
On 2017-10-18 09:32:09 [+0200], To Paul E. McKenney wrote:
> I will
> look at this once I made some slidesâ

slides, who needs those anywayâ

kernel/rcu/tree_plugin.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 72d82eebf70d..d97bb9bd2f3b 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -31,9 +31,9 @@
#include <linux/smpboot.h>
#include <uapi/linux/sched/types.h>
#include "../time/tick-internal.h"
-#include "../locking/rtmutex_common.h"

#ifdef CONFIG_RCU_BOOST
+#include "../locking/rtmutex_common.h"

/*
* Control variables for per-CPU and per-rcu_node kthreads. These
@@ -53,6 +53,7 @@ DEFINE_PER_CPU(char, rcu_cpu_has_work);
* This probably needs to be excluded from -rt builds.
*/
#define rt_mutex_owner(a) ({ WARN_ON_ONCE(1); NULL; })
+#define rt_mutex_futex_unlock(x) WARN_ON_ONCE(1)

#endif /* #else #ifdef CONFIG_RCU_BOOST */

@@ -896,8 +897,6 @@ void exit_rcu(void)

#ifdef CONFIG_RCU_BOOST

-#include "../locking/rtmutex_common.h"
-
static void rcu_wake_cond(struct task_struct *t, int status)
{
/*
--
2.15.0.rc0