diff mbox series

[v2,3/5] tree/nocb: Adjust RCU_NOCB_WAKE_* macros from weaker to stronger

Message ID 20230729142738.222208-4-joel@joelfernandes.org (mailing list archive)
State New, archived
Headers show
Series misc RCU fixes and cleanups | expand

Commit Message

Joel Fernandes July 29, 2023, 2:27 p.m. UTC
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) <joel@joelfernandes.org>
---
 kernel/rcu/tree.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Frederic Weisbecker Aug. 29, 2023, 10:53 a.m. UTC | #1
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) <joel@joelfernandes.org>
> ---
>  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.
Joel Fernandes Aug. 30, 2023, 9:13 p.m. UTC | #2
On Tue, Aug 29, 2023 at 6:53 AM Frederic Weisbecker <frederic@kernel.org> wrote:
>
> 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) <joel@joelfernandes.org>
> > ---
> >  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.
>

Ah I did do an audit, but missed this one. So then I think
do_nocb_deferred_wakeup_timer() should pass the weakest one
(RCU_NOCB_WAKE_LAZY) to do_nocb_deferred_wakeup_common().

Thanks a lot Frederic! I will take a deeper dive into this and author
users of RCU_NOCB_WAKE* and repost soon.

 - Joel
diff mbox series

Patch

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