Skip to contentSkip to conversation

rcu: Make rcu_normal_after_boot writable again

PATCH Applied Juri Lelli 2 participants 4 messages Aug 10, 2021 RCU

lore
Share & tools
lore

Juri Lelli

author
#0 lore raw

v2 cover rcu: Make rcu_normal_after_boot writable again

Hi,

v2 of a proposed RCU change to make rcu_normal_after_boot feature usable on PREEMPT_RT as well, as it turns out it's useful on RT as well on NO_HZ_FULL configurations.

v2 gained an additional patch to revise rcu update module parameters permissions (as suggested during v1 review [1]).

Changes wrt v1:

- Restrict the option to !PREEMPT_RT || NO_HZ_FULL (Paul, Sebastian)
- Change module params permissions (Paul) (02/02)

Thanks,
Juri

v1 - https://lore.kernel.org/lkml/[email protected]/

Juri Lelli (2):
rcu: Make rcu_normal_after_boot writable again
rcu: Make rcu update module parameters world-readable

 kernel/rcu/tree_exp.h | 1 -
 kernel/rcu/update.c   | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH v2 1/2 rcu: Make rcu_normal_after_boot writable again

Certain configurations (e.g., systems that make heavy use of netns) need to use synchronize_rcu_expedited() to service RCU grace periods even after boot.

Even though synchronize_rcu_expedited() has been traditionally considered harmful for RT for the heavy use of IPIs, it is perfectly usable under certain conditions (e.g. nohz_full).

Make rcupdate.rcu_normal_after_boot= again writeable on RT (if NO_HZ_ FULL is defined), but keep its default value to 1 (enabled) to avoid regressions. Users who need synchronize_rcu_expedited() will boot with rcupdate.rcu_normal_after_ boot=0 in the kernel cmdline.

Reflect the change in synchronize_rcu_expedited_wait() by removing the WARN related to CONFIG_PREEMPT_RT.

---
 kernel/rcu/tree_exp.h | 1 -
 kernel/rcu/update.c   | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
kernel/rcu/tree_exp.h +0 -1
index 2796084ef85a..d9e4f8eb9ae2 100644
@@ -512,7 +512,6 @@ static void synchronize_rcu_expedited_wait(void)
 		j = READ_ONCE(jiffies_till_first_fqs);
 		if (synchronize_rcu_expedited_wait_once(j + HZ))
 			return;
-		WARN_ON_ONCE(IS_ENABLED(CONFIG_PREEMPT_RT));
 	}
 
 	for (;;) {
kernel/rcu/update.c +1 -1
index c21b38cc25e9..bd551134e2f4 100644
@@ -57,7 +57,7 @@
 module_param(rcu_expedited, int, 0);
 module_param(rcu_normal, int, 0);
 static int rcu_normal_after_boot = IS_ENABLED(CONFIG_PREEMPT_RT);
-#ifndef CONFIG_PREEMPT_RT
+#if !defined(CONFIG_PREEMPT_RT) || defined(CONFIG_NO_HZ_FULL)
 module_param(rcu_normal_after_boot, int, 0);
 #endif
 #endif /* #ifndef CONFIG_TINY_RCU */
Signature · 1 line
2.31.1
author
#2 lore raw

PATCH v2 2/2 rcu: Make rcu update module parameters world-readable

In reply to Juri Lelli

rcu update module parameters currently don't appear in sysfs and this is a serviceability issue as it might be needed to access their default values at runtime.

Fix this issue by changing rcu update module parameters permissions to world-readable.

---
 kernel/rcu/update.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/update.c +3 -3
index bd551134e2f4..94282dc12bab 100644
@@ -54,11 +54,11 @@
 #define MODULE_PARAM_PREFIX "rcupdate."
 
 #ifndef CONFIG_TINY_RCU
-module_param(rcu_expedited, int, 0);
-module_param(rcu_normal, int, 0);
+module_param(rcu_expedited, int, 0444);
+module_param(rcu_normal, int, 0444);
 static int rcu_normal_after_boot = IS_ENABLED(CONFIG_PREEMPT_RT);
 #if !defined(CONFIG_PREEMPT_RT) || defined(CONFIG_NO_HZ_FULL)
-module_param(rcu_normal_after_boot, int, 0);
+module_param(rcu_normal_after_boot, int, 0444);
 #endif
 #endif /* #ifndef CONFIG_TINY_RCU */
 
Signature · 1 line
2.31.1
maintainer Applied
#3 lore raw
In reply to Juri Lelli
Quoted 8 lines · Juri Lelli

Hi,

v2 of a proposed RCU change to make rcu_normal_after_boot feature usable on PREEMPT_RT as well, as it turns out it's useful on RT as well on NO_HZ_FULL configurations.

v2 gained an additional patch to revise rcu update module parameters permissions (as suggested during v1 review [1]).

Queued and pushed, thank you!

Thanx, Paul

Quoted 21 lines

Changes wrt v1:

- Restrict the option to !PREEMPT_RT || NO_HZ_FULL (Paul, Sebastian)
- Change module params permissions (Paul) (02/02)

Thanks,
Juri

v1 - https://lore.kernel.org/lkml/[email protected]/

Juri Lelli (2):
rcu: Make rcu_normal_after_boot writable again
rcu: Make rcu update module parameters world-readable

 kernel/rcu/tree_exp.h | 1 -
 kernel/rcu/update.c   | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)
Signature · 1 line
2.31.1