Skip to contentSkip to conversation

Fix up mishandling of PREEMPT_RCU dependency

PATCH New Paul Gortmaker 1 participant 4 messages Feb 21, 2013

lore
Share & tools
lore
#1 lore raw

PATCH 1/3 rt: drop duplicated rt-disable-rt-group-sched.patch

In reply to Paul Gortmaker

The rt-disable-rt-group-sched.patch is an accidental duplicate of the earlier sched-disable-rt-group-sched-on-rt.patch

---
 rt-disable-rt-group-sched.patch | 29 -----------------------------
 series                          |  3 ++-
 2 files changed, 2 insertions(+), 30 deletions(-)
 delete mode 100644 rt-disable-rt-group-sched.patch
rt-disable-rt-group-sched.patch deleted +0 -0
deleted file mode 100644
index 418dd9d..0000000
series +2 -1
index d45a993..24902ef 100644
@@ -570,7 +570,8 @@ net-use-cpu-chill.patch
 lockdep-selftest-convert-spinlock-to-raw-spinlock.patch
 lockdep-selftest-only-do-hardirq-context-test-for-raw-spinlock.patch
 
-rt-disable-rt-group-sched.patch
+# dropped; duplicate of sched-disable-rt-group-sched-on-rt.patch above
+#rt-disable-rt-group-sched.patch
 fs-jbd-pull-plug-when-waiting-for-space.patch
 perf-make-swevent-hrtimer-irqsafe.patch
 cpu-rt-rework-cpu-down.patch
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH 3/3 preempt-rcu: untangle kconfig RT_FULL/PREEMPT_RCU relationship

In reply to Paul Gortmaker

The intent of the rcu-force-preempt-rcu-for-rt.patch was to ensure you weren't even asked about PREEMPT_RCU when RT_FULL was =y. However it tried to achieve this with a dependency, and that just masks the option completely. This wasn't noticed since the patch was accidentally reverted, and misplaced (see prev two commits) and hence the misuse of a dependency causing the exact opposite of the desired effect went un-noticed.

By using a select PREEMPT_RCU in the RT_FULL block, we get the desired effect, i.e. Kconfig will not ask the user whether they want PREEMPT_RCU. It will simply set it unconditionally for anyone with RT_FULL=y

Since RT_FULL Kconfig control block doesn't even appear until the kconfig-preempt-rt-full.patch - we insert the select line into that patch.

---
 kconfig-preempt-rt-full.patch      |  3 ++-
 rcu-force-preempt-rcu-for-rt.patch | 30 ------------------------------
 series                             |  1 -
 3 files changed, 2 insertions(+), 32 deletions(-)
 delete mode 100644 rcu-force-preempt-rcu-for-rt.patch
kconfig-preempt-rt-full.patch +2 -1
index ca7261d..92fc433 100644
@@ -23,7 +23,7 @@ Index: linux-stable/kernel/Kconfig.preempt
 ===================================================================
 --- linux-stable.orig/kernel/Kconfig.preempt
 +++ linux-stable/kernel/Kconfig.preempt
-@@ -73,6 +73,13 @@ config PREEMPT_RTB
+@@ -73,6 +73,14 @@ config PREEMPT_RTB
  	  enables changes which are preliminary for the full preemptiple
  	  RT kernel.
  
@@ -31,6 +31,7 @@ Index: linux-stable/kernel/Kconfig.preempt
 +	bool "Fully Preemptible Kernel (RT)"
 +	depends on IRQ_FORCED_THREADING
 +	select PREEMPT_RT_BASE
++	select PREEMPT_RCU
 +	help
 +	  All and everything
 +
rcu-force-preempt-rcu-for-rt.patch deleted +0 -0
deleted file mode 100644
index 38eeb2a..0000000
series +0 -1
index 24902ef..67af1d8 100644
@@ -435,7 +435,6 @@ timer-handle-idle-trylock-in-get-next-timer-irq.patch
 timer.c-fix-build-fail-for-RT_FULL.patch
 
 # RCU
-rcu-force-preempt-rcu-for-rt.patch
 peter_zijlstra-frob-rcu.patch
 rcu-merge-rcu-bh-into-rcu-preempt-for-rt.patch
 rcu-tiny-merge-bh.patch
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 2/3 rt: fix mispatch of Kconfig by rcu-force-preempt-rcu-for-rt.patch

In reply to Paul Gortmaker

The patch was meant to tie things to an RCU Kconfig, but happened to instead land in the RT_GROUP_SCHED Kconfig entry. Put it back to where it belongs (i.e. PREEMPT_RCU, as evident by the commit log).

The link in the long log is also broken so simply remove it.

---
 rcu-force-preempt-rcu-for-rt.patch | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)
rcu-force-preempt-rcu-for-rt.patch +18 -16
index 5de6462..38eeb2a 100644
@@ -1,28 +1,30 @@
-Subject: RCU: Force PREEMPT_RCU for PREEMPT-RT
+From a014d7b0c472bf933ca7e570c2c1cd7c5ccdb92b Mon Sep 17 00:00:00 2001
 From: Ingo Molnar <[email protected]>
 Date: Fri, 3 Jul 2009 08:30:30 -0500
+Subject: [PATCH] RCU: Force PREEMPT_RCU for PREEMPT-RT
 
 PREEMPT_RT relies on PREEMPT_RCU - only allow RCU to be configured
 interactively in the !PREEMPT_RT case.
 
 Signed-off-by: Ingo Molnar <[email protected]>
 Signed-off-by: Thomas Gleixner <[email protected]>
-
 Signed-off-by: Peter Zijlstra <[email protected]>
-Link: http://lkml.kernel.org/n/[email protected]
 ---
- init/Kconfig |    1 -
- 1 file changed, 1 deletion(-)
+ init/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
 
-Index: linux-stable/init/Kconfig
-===================================================================
---- linux-stable.orig/init/Kconfig
-+++ linux-stable/init/Kconfig
-@@ -806,7 +806,6 @@ config RT_GROUP_SCHED
- 	bool "Group scheduling for SCHED_RR/FIFO"
- 	depends on EXPERIMENTAL
- 	depends on CGROUP_SCHED
--	depends on !PREEMPT_RT_FULL
- 	default n
+diff --git a/init/Kconfig b/init/Kconfig
+index badd56f..dc99d20 100644
+--- a/init/Kconfig
++++ b/init/Kconfig
+@@ -437,6 +437,7 @@ endchoice
+ 
+ config PREEMPT_RCU
+ 	def_bool ( TREE_PREEMPT_RCU || TINY_PREEMPT_RCU )
++	depends on !PREEMPT_RT_FULL
  	help
- 	  This feature lets you explicitly allocate real CPU bandwidth
+ 	  This option enables preemptible-RCU code that is common between
+ 	  the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations.
+-- 
+1.8.1.2
+
Signature · 1 line
1.8.1.2
#0 lore raw

cover Fix up mishandling of PREEMPT_RCU dependency

I'd mentioned this when rt29 was announced, but there was yet one more piece of the puzzle I hadn't figured out until rt30 (#4 below).

The executive summary is that we inserted an invalid dependency, but then via another incorrect patch, reverted that dependency, and hence it is still possible to select RT_FULL without PREEMPT_RCU. We can dump two patches from the queue by cleaning this up.

This commit message (from #2 below):

PREEMPT_RT relies on PREEMPT_RCU - only allow RCU to be configured interactively in the !PREEMPT_RT case.

captures what we want(ed) to happen but wasn't what was actually happening (note that PREEMPT_RT implicitly means RT_FULL here; the log was written before RT_FULL existed).

A stacking effect of errors that is typical of large patch queues that get carried forward over time took place. It goes back at least as far as rt-3.2

Here are the gory details:

1) We have "sched-disable-rt-group-sched-on-rt.patch" which adds a "depends !PREEMPT_RT_FULL" to RT_GROUP_SCHED.

2) The patch "rcu-force-preempt-rcu-for-rt.patch" got mangled during a carry forward. It has the commit log quoted above, but instead of doing that, it just reverts the sched patch above in #1.

3) The bug that #1 fixed got "rediscovered" and so "rt-disable-rt-group-sched.patch" got added as an accidental duplicate of the earlier sched patch in #1. (instead of fixing #2)

4) Fixing patch #2, so it adds a "depends !PREEMPT_RT_FULL" to the proper block (i.e. PREEMPT_RCU instead of RT_GROUP_SCHED) doesn't have the desired effect of making PREEMPT_RCU enabled and non interactive, instead it simply makes it go away entirely when RT_FULL is enabled (and then you get compile failures, etc.)

So, to fix all of that, we throw away the duplicate from #3, delete #2 entirely, since it is an accidental revert and can't be salvaged (as per #4). And finally, to achieve the goal of having PREEMPT_RCU be always set non-interactively for RT_FULL=y we simply add a select for it in the RT_FULL Kconfig control block. That is added into the patch which introduces RT_FULL.

Overall, this is primarily a queue maintenance thing and not really that interesting to the end users, since diffing the two trees after running the updated queue results in only this difference:

-------------------------------------

 $ git diff v3.6.11-rt30 v3.6.11-rt30-fixes
 diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
 index 3050029..38cecfe 100644
 --- a/kernel/Kconfig.preempt
 +++ b/kernel/Kconfig.preempt
 @@ -77,6 +77,7 @@ config PREEMPT_RT_FULL
         bool "Fully Preemptible Kernel (RT)"
         depends on IRQ_FORCED_THREADING
         select PREEMPT_RT_BASE
 +       select PREEMPT_RCU
         help
           All and everything

$
-------------------------------------

I'm posting this since even if there isn't a v3.6.11-rt31, ideally we'd like to see this not get carried forward to yet another release.

Thanks,
Paul.
---

The following changes since commit bb102e108f5d60068b3a5564f0f1f314d4c72332:

patches-3.6.11-rt30.tar.xz (2013-02-19 18:33:41 -0500)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/paulg/3.6-rt-patches.git v3.6.11-rt30-fixes

for you to fetch changes up to 55c97947531d88af6cf9f56ccccb41e26c7f8cd5:

preempt-rcu: untangle kconfig RT_FULL/PREEMPT_RCU relationship (2013-02-20 19:05:38 -0500)

----------------------------------------------------------------
Paul Gortmaker (3):
rt: drop duplicated rt-disable-rt-group-sched.patch
rt: fix mispatch of Kconfig by rcu-force-preempt-rcu-for-rt.patch
preempt-rcu: untangle kconfig RT_FULL/PREEMPT_RCU relationship

 kconfig-preempt-rt-full.patch      |  3 ++-
 rcu-force-preempt-rcu-for-rt.patch | 28 ----------------------------
 rt-disable-rt-group-sched.patch    | 29 -----------------------------
 series                             |  4 ++--
 4 files changed, 4 insertions(+), 60 deletions(-)
 delete mode 100644 rcu-force-preempt-rcu-for-rt.patch
 delete mode 100644 rt-disable-rt-group-sched.patch