2023-07-29 16:14:20

by Joel Fernandes

[permalink] [raw]
Subject: [PATCH v2 0/5] misc RCU fixes and cleanups

Here are some RCU fixes and cleanups. The main one is the TREE07 stuttering fix
which makes the test pass now. Thanks.

Joel Fernandes (Google) (5):
rcutorture: Fix stuttering races and other issues
srcu: Fix error handling in init_srcu_struct_fields()
tree/nocb: Adjust RCU_NOCB_WAKE_* macros from weaker to stronger
tree/nocb: Improve readability of nocb_gp_wait()
rcu/tree: Remove superfluous return from void call_rcu* functions

kernel/rcu/srcutree.c | 32 ++++++------
kernel/rcu/tree.c | 4 +-
kernel/rcu/tree.h | 4 +-
kernel/rcu/tree_nocb.h | 113 ++++++++++++++++++++++++-----------------
kernel/torture.c | 45 +++++-----------
5 files changed, 99 insertions(+), 99 deletions(-)

--
2.41.0.487.g6d72f3e995-goog



2023-07-29 17:05:00

by Joel Fernandes

[permalink] [raw]
Subject: [PATCH v2 5/5] rcu/tree: Remove superfluous return from void call_rcu* functions

The return keyword is not needed here.

Signed-off-by: Joel Fernandes (Google) <[email protected]>
---
kernel/rcu/tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index cb1caefa8bd0..7c79480bfaa0 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2713,7 +2713,7 @@ __call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy_in)
*/
void call_rcu_hurry(struct rcu_head *head, rcu_callback_t func)
{
- return __call_rcu_common(head, func, false);
+ __call_rcu_common(head, func, false);
}
EXPORT_SYMBOL_GPL(call_rcu_hurry);
#endif
@@ -2764,7 +2764,7 @@ EXPORT_SYMBOL_GPL(call_rcu_hurry);
*/
void call_rcu(struct rcu_head *head, rcu_callback_t func)
{
- return __call_rcu_common(head, func, IS_ENABLED(CONFIG_RCU_LAZY));
+ __call_rcu_common(head, func, IS_ENABLED(CONFIG_RCU_LAZY));
}
EXPORT_SYMBOL_GPL(call_rcu);

--
2.41.0.487.g6d72f3e995-goog


2023-07-29 18:47:40

by Joel Fernandes

[permalink] [raw]
Subject: [PATCH v2 3/5] tree/nocb: Adjust RCU_NOCB_WAKE_* macros from weaker to stronger

This is needed to make the next patch work correctly as we rely on the
strength of the wakeup when comparing deferred-wakeup types across
different CPUs.

Signed-off-by: Joel Fernandes (Google) <[email protected]>
---
kernel/rcu/tree.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 192536916f9a..0f40a9c2b78d 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -288,8 +288,8 @@ struct rcu_data {

/* Values for nocb_defer_wakeup field in struct rcu_data. */
#define RCU_NOCB_WAKE_NOT 0
-#define RCU_NOCB_WAKE_BYPASS 1
-#define RCU_NOCB_WAKE_LAZY 2
+#define RCU_NOCB_WAKE_LAZY 1
+#define RCU_NOCB_WAKE_BYPASS 2
#define RCU_NOCB_WAKE 3
#define RCU_NOCB_WAKE_FORCE 4

--
2.41.0.487.g6d72f3e995-goog


2023-07-29 22:32:16

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] rcu/tree: Remove superfluous return from void call_rcu* functions

On Sat, Jul 29, 2023 at 02:27:36PM +0000, Joel Fernandes (Google) wrote:
> The return keyword is not needed here.
>
> Signed-off-by: Joel Fernandes (Google) <[email protected]>

Odd that this is allowed. ;-)

I took 1, 2, and 5, thank you! It would still be good to get Frederic's
eyes on 3 and 4.

Thanx, Paul

> ---
> kernel/rcu/tree.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index cb1caefa8bd0..7c79480bfaa0 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2713,7 +2713,7 @@ __call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy_in)
> */
> void call_rcu_hurry(struct rcu_head *head, rcu_callback_t func)
> {
> - return __call_rcu_common(head, func, false);
> + __call_rcu_common(head, func, false);
> }
> EXPORT_SYMBOL_GPL(call_rcu_hurry);
> #endif
> @@ -2764,7 +2764,7 @@ EXPORT_SYMBOL_GPL(call_rcu_hurry);
> */
> void call_rcu(struct rcu_head *head, rcu_callback_t func)
> {
> - return __call_rcu_common(head, func, IS_ENABLED(CONFIG_RCU_LAZY));
> + __call_rcu_common(head, func, IS_ENABLED(CONFIG_RCU_LAZY));
> }
> EXPORT_SYMBOL_GPL(call_rcu);
>
> --
> 2.41.0.487.g6d72f3e995-goog
>

2023-08-29 11:43:45

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: [PATCH v2 3/5] tree/nocb: Adjust RCU_NOCB_WAKE_* macros from weaker to stronger

On Sat, Jul 29, 2023 at 02:27:33PM +0000, Joel Fernandes (Google) wrote:
> This is needed to make the next patch work correctly as we rely on the
> strength of the wakeup when comparing deferred-wakeup types across
> different CPUs.
>
> Signed-off-by: Joel Fernandes (Google) <[email protected]>
> ---
> kernel/rcu/tree.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
> index 192536916f9a..0f40a9c2b78d 100644
> --- a/kernel/rcu/tree.h
> +++ b/kernel/rcu/tree.h
> @@ -288,8 +288,8 @@ struct rcu_data {
>
> /* Values for nocb_defer_wakeup field in struct rcu_data. */
> #define RCU_NOCB_WAKE_NOT 0
> -#define RCU_NOCB_WAKE_BYPASS 1
> -#define RCU_NOCB_WAKE_LAZY 2
> +#define RCU_NOCB_WAKE_LAZY 1
> +#define RCU_NOCB_WAKE_BYPASS 2
> #define RCU_NOCB_WAKE 3
> #define RCU_NOCB_WAKE_FORCE 4

Good change but make sure to audit all the occurences of
RCU_NOCB_WAKE_LAZY and RCU_NOCB_WAKE_BYPASS. For example this breaks
do_nocb_deferred_wakeup_timer() that will now ignore RCU_NOCB_WAKE_LAZY
timers.

Thanks.