linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
@ 2021-07-13  0:56 zhouzhouyi
  2021-07-13  4:16 ` Paul E. McKenney
  0 siblings, 1 reply; 14+ messages in thread
From: zhouzhouyi @ 2021-07-13  0:56 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel,
	rcu, linux-kernel
  Cc: Zhouyi Zhou

From: Zhouyi Zhou <zhouzhouyi@gmail.com>

Hi Paul,

During my studying of RCU, I did a grep in the kernel source tree.
I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
should be CONFIG_TASKS_TRACE_RCU instead.

Without memory fencing, the idle/userspace task inspection may not
be so accurate.

Thanks for your constant encouragement for my studying.

Best Wishes
Zhouyi

Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
---
 include/linux/rcupdate.h | 2 +-
 kernel/rcu/tree_plugin.h | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index d9680b798b21..955c82b4737c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -167,7 +167,7 @@ void synchronize_rcu_tasks(void);
 # define synchronize_rcu_tasks synchronize_rcu
 # endif
 
-# ifdef CONFIG_TASKS_RCU_TRACE
+# ifdef CONFIG_TASKS_TRACE_RCU
 # define rcu_tasks_trace_qs(t)						\
 	do {								\
 		if (!likely(READ_ONCE((t)->trc_reader_checked)) &&	\
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index de1dc3bb7f70..6ce104242b23 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2982,17 +2982,17 @@ static void noinstr rcu_dynticks_task_exit(void)
 /* Turn on heavyweight RCU tasks trace readers on idle/user entry. */
 static void rcu_dynticks_task_trace_enter(void)
 {
-#ifdef CONFIG_TASKS_RCU_TRACE
+#ifdef CONFIG_TASKS_TRACE_RCU
 	if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
 		current->trc_reader_special.b.need_mb = true;
-#endif /* #ifdef CONFIG_TASKS_RCU_TRACE */
+#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
 }
 
 /* Turn off heavyweight RCU tasks trace readers on idle/user exit. */
 static void rcu_dynticks_task_trace_exit(void)
 {
-#ifdef CONFIG_TASKS_RCU_TRACE
+#ifdef CONFIG_TASKS_TRACE_RCU
 	if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
 		current->trc_reader_special.b.need_mb = false;
-#endif /* #ifdef CONFIG_TASKS_RCU_TRACE */
+#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-13  0:56 [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE zhouzhouyi
@ 2021-07-13  4:16 ` Paul E. McKenney
  2021-07-13  6:16   ` Zhouyi Zhou
  2021-07-13 13:09   ` Mathieu Desnoyers
  0 siblings, 2 replies; 14+ messages in thread
From: Paul E. McKenney @ 2021-07-13  4:16 UTC (permalink / raw)
  To: zhouzhouyi
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu, linux-kernel

On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> 
> Hi Paul,
> 
> During my studying of RCU, I did a grep in the kernel source tree.
> I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
> should be CONFIG_TASKS_TRACE_RCU instead.
> 
> Without memory fencing, the idle/userspace task inspection may not
> be so accurate.
> 
> Thanks for your constant encouragement for my studying.
> 
> Best Wishes
> Zhouyi
> 
> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>

Good eyes, and those could cause real bugs, so thank you!

Could you please check the wordsmithed version below?

							Thanx, Paul

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

commit fdcf5524b64f2cc8e6201447644079d9f8d4c821
Author: Zhouyi Zhou <zhouzhouyi@gmail.com>
Date:   Tue Jul 13 08:56:45 2021 +0800

    RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
    
    This commit fixes several typos where CONFIG_TASKS_RCU_TRACE should
    instead be CONFIG_TASKS_TRACE_RCU.  Among other things, these typos
    could cause CONFIG_TASKS_TRACE_RCU_READ_MB=y kernels to suffer from
    memory-ordering bugs that could result in false-positive quiescent
    states and too-short grace periods.
    
    Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index cfeb43bfc719..434d12fe2d4f 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -167,7 +167,7 @@ void synchronize_rcu_tasks(void);
 # define synchronize_rcu_tasks synchronize_rcu
 # endif
 
-# ifdef CONFIG_TASKS_RCU_TRACE
+# ifdef CONFIG_TASKS_TRACE_RCU
 # define rcu_tasks_trace_qs(t)						\
 	do {								\
 		if (!likely(READ_ONCE((t)->trc_reader_checked)) &&	\
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 27b74352cccf..a8e3acead6f6 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -1498,17 +1498,17 @@ static void noinstr rcu_dynticks_task_exit(void)
 /* Turn on heavyweight RCU tasks trace readers on idle/user entry. */
 static void rcu_dynticks_task_trace_enter(void)
 {
-#ifdef CONFIG_TASKS_RCU_TRACE
+#ifdef CONFIG_TASKS_TRACE_RCU
 	if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
 		current->trc_reader_special.b.need_mb = true;
-#endif /* #ifdef CONFIG_TASKS_RCU_TRACE */
+#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
 }
 
 /* Turn off heavyweight RCU tasks trace readers on idle/user exit. */
 static void rcu_dynticks_task_trace_exit(void)
 {
-#ifdef CONFIG_TASKS_RCU_TRACE
+#ifdef CONFIG_TASKS_TRACE_RCU
 	if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
 		current->trc_reader_special.b.need_mb = false;
-#endif /* #ifdef CONFIG_TASKS_RCU_TRACE */
+#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
 }

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-13  4:16 ` Paul E. McKenney
@ 2021-07-13  6:16   ` Zhouyi Zhou
  2021-07-13 13:09   ` Mathieu Desnoyers
  1 sibling, 0 replies; 14+ messages in thread
From: Zhouyi Zhou @ 2021-07-13  6:16 UTC (permalink / raw)
  To: paulmck
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu, linux-kernel

Thank you very much,
I went through the wordsmithed version, it looks exquisite!

Thank you for your encouragement.
Cheers
Zhouyi

On Tue, Jul 13, 2021 at 12:16 PM Paul E. McKenney <paulmck@kernel.org> wrote:
>
> On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
> > From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> >
> > Hi Paul,
> >
> > During my studying of RCU, I did a grep in the kernel source tree.
> > I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
> > should be CONFIG_TASKS_TRACE_RCU instead.
> >
> > Without memory fencing, the idle/userspace task inspection may not
> > be so accurate.
> >
> > Thanks for your constant encouragement for my studying.
> >
> > Best Wishes
> > Zhouyi
> >
> > Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
>
> Good eyes, and those could cause real bugs, so thank you!
>
> Could you please check the wordsmithed version below?
>
>                                                         Thanx, Paul
>
> ------------------------------------------------------------------------
>
> commit fdcf5524b64f2cc8e6201447644079d9f8d4c821
> Author: Zhouyi Zhou <zhouzhouyi@gmail.com>
> Date:   Tue Jul 13 08:56:45 2021 +0800
>
>     RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
>
>     This commit fixes several typos where CONFIG_TASKS_RCU_TRACE should
>     instead be CONFIG_TASKS_TRACE_RCU.  Among other things, these typos
>     could cause CONFIG_TASKS_TRACE_RCU_READ_MB=y kernels to suffer from
>     memory-ordering bugs that could result in false-positive quiescent
>     states and too-short grace periods.
>
>     Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
>     Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index cfeb43bfc719..434d12fe2d4f 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -167,7 +167,7 @@ void synchronize_rcu_tasks(void);
>  # define synchronize_rcu_tasks synchronize_rcu
>  # endif
>
> -# ifdef CONFIG_TASKS_RCU_TRACE
> +# ifdef CONFIG_TASKS_TRACE_RCU
>  # define rcu_tasks_trace_qs(t)                                         \
>         do {                                                            \
>                 if (!likely(READ_ONCE((t)->trc_reader_checked)) &&      \
> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index 27b74352cccf..a8e3acead6f6 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -1498,17 +1498,17 @@ static void noinstr rcu_dynticks_task_exit(void)
>  /* Turn on heavyweight RCU tasks trace readers on idle/user entry. */
>  static void rcu_dynticks_task_trace_enter(void)
>  {
> -#ifdef CONFIG_TASKS_RCU_TRACE
> +#ifdef CONFIG_TASKS_TRACE_RCU
>         if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
>                 current->trc_reader_special.b.need_mb = true;
> -#endif /* #ifdef CONFIG_TASKS_RCU_TRACE */
> +#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
>  }
>
>  /* Turn off heavyweight RCU tasks trace readers on idle/user exit. */
>  static void rcu_dynticks_task_trace_exit(void)
>  {
> -#ifdef CONFIG_TASKS_RCU_TRACE
> +#ifdef CONFIG_TASKS_TRACE_RCU
>         if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
>                 current->trc_reader_special.b.need_mb = false;
> -#endif /* #ifdef CONFIG_TASKS_RCU_TRACE */
> +#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
>  }

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-13  4:16 ` Paul E. McKenney
  2021-07-13  6:16   ` Zhouyi Zhou
@ 2021-07-13 13:09   ` Mathieu Desnoyers
  2021-07-13 13:18     ` Paul E. McKenney
  1 sibling, 1 reply; 14+ messages in thread
From: Mathieu Desnoyers @ 2021-07-13 13:09 UTC (permalink / raw)
  To: paulmck
  Cc: zhouzhouyi, Josh Triplett, rostedt, Lai Jiangshan,
	Joel Fernandes, Google, rcu, linux-kernel

----- On Jul 13, 2021, at 12:16 AM, paulmck paulmck@kernel.org wrote:

> On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
>> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
>> 
>> Hi Paul,
>> 
>> During my studying of RCU, I did a grep in the kernel source tree.
>> I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
>> should be CONFIG_TASKS_TRACE_RCU instead.
>> 
>> Without memory fencing, the idle/userspace task inspection may not
>> be so accurate.
>> 
>> Thanks for your constant encouragement for my studying.
>> 
>> Best Wishes
>> Zhouyi
>> 
>> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> 
> Good eyes, and those could cause real bugs, so thank you!

Hi Paul,

This makes me wonder: what is missing testing-wise in rcutorture to
catch those issues with testing before they reach mainline ?

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-13 13:09   ` Mathieu Desnoyers
@ 2021-07-13 13:18     ` Paul E. McKenney
  2021-07-13 15:19       ` Paul E. McKenney
  0 siblings, 1 reply; 14+ messages in thread
From: Paul E. McKenney @ 2021-07-13 13:18 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: zhouzhouyi, Josh Triplett, rostedt, Lai Jiangshan,
	Joel Fernandes, Google, rcu, linux-kernel

On Tue, Jul 13, 2021 at 09:09:04AM -0400, Mathieu Desnoyers wrote:
> ----- On Jul 13, 2021, at 12:16 AM, paulmck paulmck@kernel.org wrote:
> 
> > On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
> >> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> >> 
> >> Hi Paul,
> >> 
> >> During my studying of RCU, I did a grep in the kernel source tree.
> >> I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
> >> should be CONFIG_TASKS_TRACE_RCU instead.
> >> 
> >> Without memory fencing, the idle/userspace task inspection may not
> >> be so accurate.
> >> 
> >> Thanks for your constant encouragement for my studying.
> >> 
> >> Best Wishes
> >> Zhouyi
> >> 
> >> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > 
> > Good eyes, and those could cause real bugs, so thank you!
> 
> Hi Paul,
> 
> This makes me wonder: what is missing testing-wise in rcutorture to
> catch those issues with testing before they reach mainline ?

My guess:  Running on weakly ordered architectures.  ;-)

							Thanx, Paul

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-13 13:18     ` Paul E. McKenney
@ 2021-07-13 15:19       ` Paul E. McKenney
  2021-07-14  4:44         ` Zhouyi Zhou
  0 siblings, 1 reply; 14+ messages in thread
From: Paul E. McKenney @ 2021-07-13 15:19 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: zhouzhouyi, Josh Triplett, rostedt, Lai Jiangshan,
	Joel Fernandes, Google, rcu, linux-kernel

On Tue, Jul 13, 2021 at 06:18:12AM -0700, Paul E. McKenney wrote:
> On Tue, Jul 13, 2021 at 09:09:04AM -0400, Mathieu Desnoyers wrote:
> > ----- On Jul 13, 2021, at 12:16 AM, paulmck paulmck@kernel.org wrote:
> > 
> > > On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
> > >> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > >> 
> > >> Hi Paul,
> > >> 
> > >> During my studying of RCU, I did a grep in the kernel source tree.
> > >> I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
> > >> should be CONFIG_TASKS_TRACE_RCU instead.
> > >> 
> > >> Without memory fencing, the idle/userspace task inspection may not
> > >> be so accurate.
> > >> 
> > >> Thanks for your constant encouragement for my studying.
> > >> 
> > >> Best Wishes
> > >> Zhouyi
> > >> 
> > >> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > 
> > > Good eyes, and those could cause real bugs, so thank you!
> > 
> > Hi Paul,
> > 
> > This makes me wonder: what is missing testing-wise in rcutorture to
> > catch those issues with testing before they reach mainline ?
> 
> My guess:  Running on weakly ordered architectures.  ;-)

And another guess:  A tool that identifies use of Kconfig options
that are not defined in any Kconfig* file.

							Thanx, Paul

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-13 15:19       ` Paul E. McKenney
@ 2021-07-14  4:44         ` Zhouyi Zhou
  2021-07-15  3:51           ` Paul E. McKenney
  0 siblings, 1 reply; 14+ messages in thread
From: Zhouyi Zhou @ 2021-07-14  4:44 UTC (permalink / raw)
  To: paulmck
  Cc: Mathieu Desnoyers, Josh Triplett, rostedt, Lai Jiangshan,
	Joel Fernandes, Google, rcu, linux-kernel

On Tue, Jul 13, 2021 at 11:19 PM Paul E. McKenney <paulmck@kernel.org> wrote:
>
> On Tue, Jul 13, 2021 at 06:18:12AM -0700, Paul E. McKenney wrote:
> > On Tue, Jul 13, 2021 at 09:09:04AM -0400, Mathieu Desnoyers wrote:
> > > ----- On Jul 13, 2021, at 12:16 AM, paulmck paulmck@kernel.org wrote:
> > >
> > > > On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
> > > >> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > >>
> > > >> Hi Paul,
> > > >>
> > > >> During my studying of RCU, I did a grep in the kernel source tree.
> > > >> I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
> > > >> should be CONFIG_TASKS_TRACE_RCU instead.
> > > >>
> > > >> Without memory fencing, the idle/userspace task inspection may not
> > > >> be so accurate.
> > > >>
> > > >> Thanks for your constant encouragement for my studying.
> > > >>
> > > >> Best Wishes
> > > >> Zhouyi
> > > >>
> > > >> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > >
> > > > Good eyes, and those could cause real bugs, so thank you!
> > >
> > > Hi Paul,
> > >
> > > This makes me wonder: what is missing testing-wise in rcutorture to
> > > catch those issues with testing before they reach mainline ?
> >
> > My guess:  Running on weakly ordered architectures.  ;-)
>
> And another guess:  A tool that identifies use of Kconfig options
> that are not defined in any Kconfig* file.
Based on Paul's second guess ;-),  I did a small research, and I think
the best answer is to modify scripts/checkpatch.pl. We modify checkpatch.pl
to identify use of Kconfig options that are not defined in any Kconfig* file.

As I am a C/C++ programmer, I would be glad to take some time to learn
perl (checkpatch is implented in perl) first if no other volunteer is
about to do it ;-)

>
>                                                         Thanx, Paul
Thanx
Zhouyi

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-14  4:44         ` Zhouyi Zhou
@ 2021-07-15  3:51           ` Paul E. McKenney
  2021-07-15  8:45             ` Zhouyi Zhou
  0 siblings, 1 reply; 14+ messages in thread
From: Paul E. McKenney @ 2021-07-15  3:51 UTC (permalink / raw)
  To: Zhouyi Zhou
  Cc: Mathieu Desnoyers, Josh Triplett, rostedt, Lai Jiangshan,
	Joel Fernandes, Google, rcu, linux-kernel

On Wed, Jul 14, 2021 at 12:44:36PM +0800, Zhouyi Zhou wrote:
> On Tue, Jul 13, 2021 at 11:19 PM Paul E. McKenney <paulmck@kernel.org> wrote:
> >
> > On Tue, Jul 13, 2021 at 06:18:12AM -0700, Paul E. McKenney wrote:
> > > On Tue, Jul 13, 2021 at 09:09:04AM -0400, Mathieu Desnoyers wrote:
> > > > ----- On Jul 13, 2021, at 12:16 AM, paulmck paulmck@kernel.org wrote:
> > > >
> > > > > On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
> > > > >> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > > >>
> > > > >> Hi Paul,
> > > > >>
> > > > >> During my studying of RCU, I did a grep in the kernel source tree.
> > > > >> I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
> > > > >> should be CONFIG_TASKS_TRACE_RCU instead.
> > > > >>
> > > > >> Without memory fencing, the idle/userspace task inspection may not
> > > > >> be so accurate.
> > > > >>
> > > > >> Thanks for your constant encouragement for my studying.
> > > > >>
> > > > >> Best Wishes
> > > > >> Zhouyi
> > > > >>
> > > > >> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > > >
> > > > > Good eyes, and those could cause real bugs, so thank you!
> > > >
> > > > Hi Paul,
> > > >
> > > > This makes me wonder: what is missing testing-wise in rcutorture to
> > > > catch those issues with testing before they reach mainline ?
> > >
> > > My guess:  Running on weakly ordered architectures.  ;-)
> >
> > And another guess:  A tool that identifies use of Kconfig options
> > that are not defined in any Kconfig* file.
> Based on Paul's second guess ;-),  I did a small research, and I think
> the best answer is to modify scripts/checkpatch.pl. We modify checkpatch.pl
> to identify use of Kconfig options that are not defined in any Kconfig* file.
> 
> As I am a C/C++ programmer, I would be glad to take some time to learn
> perl (checkpatch is implented in perl) first if no other volunteer is
> about to do it ;-)

I haven't heard anyone else volunteer.  ;-)

Others might have opinions on where best to implement these checks,
but I must confess that I have not given it much thought.

							Thanx, Paul

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-15  3:51           ` Paul E. McKenney
@ 2021-07-15  8:45             ` Zhouyi Zhou
  2021-07-15 18:09               ` Paul E. McKenney
  0 siblings, 1 reply; 14+ messages in thread
From: Zhouyi Zhou @ 2021-07-15  8:45 UTC (permalink / raw)
  To: paulmck
  Cc: Mathieu Desnoyers, Josh Triplett, rostedt, Lai Jiangshan,
	Joel Fernandes, Google, rcu, linux-kernel, apw, joe, ast, daniel,
	andrii, kafai, songliubraving, yhs, john.fastabend, kpsingh, bpf

On Thu, Jul 15, 2021 at 11:51 AM Paul E. McKenney <paulmck@kernel.org> wrote:
>
> On Wed, Jul 14, 2021 at 12:44:36PM +0800, Zhouyi Zhou wrote:
> > On Tue, Jul 13, 2021 at 11:19 PM Paul E. McKenney <paulmck@kernel.org> wrote:
> > >
> > > On Tue, Jul 13, 2021 at 06:18:12AM -0700, Paul E. McKenney wrote:
> > > > On Tue, Jul 13, 2021 at 09:09:04AM -0400, Mathieu Desnoyers wrote:
> > > > > ----- On Jul 13, 2021, at 12:16 AM, paulmck paulmck@kernel.org wrote:
> > > > >
> > > > > > On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
> > > > > >> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > > > >>
> > > > > >> Hi Paul,
> > > > > >>
> > > > > >> During my studying of RCU, I did a grep in the kernel source tree.
> > > > > >> I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
> > > > > >> should be CONFIG_TASKS_TRACE_RCU instead.
> > > > > >>
> > > > > >> Without memory fencing, the idle/userspace task inspection may not
> > > > > >> be so accurate.
> > > > > >>
> > > > > >> Thanks for your constant encouragement for my studying.
> > > > > >>
> > > > > >> Best Wishes
> > > > > >> Zhouyi
> > > > > >>
> > > > > >> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > > > >
> > > > > > Good eyes, and those could cause real bugs, so thank you!
> > > > >
> > > > > Hi Paul,
> > > > >
> > > > > This makes me wonder: what is missing testing-wise in rcutorture to
> > > > > catch those issues with testing before they reach mainline ?
> > > >
> > > > My guess:  Running on weakly ordered architectures.  ;-)
> > >
> > > And another guess:  A tool that identifies use of Kconfig options
> > > that are not defined in any Kconfig* file.
> > Based on Paul's second guess ;-),  I did a small research, and I think
> > the best answer is to modify scripts/checkpatch.pl. We modify checkpatch.pl
> > to identify use of Kconfig options that are not defined in any Kconfig* file.
> >
> > As I am a C/C++ programmer, I would be glad to take some time to learn
> > perl (checkpatch is implented in perl) first if no other volunteer is
> > about to do it ;-)
>
> I haven't heard anyone else volunteer.  ;-)
>
> Others might have opinions on where best to implement these checks,
> but I must confess that I have not given it much thought.
I recklessly cc the maintainers of checkpatch.pl without your
permission to see others' opion,
and I begin to study perl at the same time, after all, learning
something is always good ;-)
>
>                                                         Thanx, Paul
Best Wishes
Zhouyi

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-15  8:45             ` Zhouyi Zhou
@ 2021-07-15 18:09               ` Paul E. McKenney
  2021-07-17 22:03                 ` Zhouyi Zhou
  0 siblings, 1 reply; 14+ messages in thread
From: Paul E. McKenney @ 2021-07-15 18:09 UTC (permalink / raw)
  To: Zhouyi Zhou
  Cc: Mathieu Desnoyers, Josh Triplett, rostedt, Lai Jiangshan,
	Joel Fernandes, Google, rcu, linux-kernel, apw, joe, ast, daniel,
	andrii, kafai, songliubraving, yhs, john.fastabend, kpsingh, bpf

On Thu, Jul 15, 2021 at 04:45:04PM +0800, Zhouyi Zhou wrote:
> On Thu, Jul 15, 2021 at 11:51 AM Paul E. McKenney <paulmck@kernel.org> wrote:
> >
> > On Wed, Jul 14, 2021 at 12:44:36PM +0800, Zhouyi Zhou wrote:
> > > On Tue, Jul 13, 2021 at 11:19 PM Paul E. McKenney <paulmck@kernel.org> wrote:
> > > >
> > > > On Tue, Jul 13, 2021 at 06:18:12AM -0700, Paul E. McKenney wrote:
> > > > > On Tue, Jul 13, 2021 at 09:09:04AM -0400, Mathieu Desnoyers wrote:
> > > > > > ----- On Jul 13, 2021, at 12:16 AM, paulmck paulmck@kernel.org wrote:
> > > > > >
> > > > > > > On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
> > > > > > >> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > > > > >>
> > > > > > >> Hi Paul,
> > > > > > >>
> > > > > > >> During my studying of RCU, I did a grep in the kernel source tree.
> > > > > > >> I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
> > > > > > >> should be CONFIG_TASKS_TRACE_RCU instead.
> > > > > > >>
> > > > > > >> Without memory fencing, the idle/userspace task inspection may not
> > > > > > >> be so accurate.
> > > > > > >>
> > > > > > >> Thanks for your constant encouragement for my studying.
> > > > > > >>
> > > > > > >> Best Wishes
> > > > > > >> Zhouyi
> > > > > > >>
> > > > > > >> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > > > > >
> > > > > > > Good eyes, and those could cause real bugs, so thank you!
> > > > > >
> > > > > > Hi Paul,
> > > > > >
> > > > > > This makes me wonder: what is missing testing-wise in rcutorture to
> > > > > > catch those issues with testing before they reach mainline ?
> > > > >
> > > > > My guess:  Running on weakly ordered architectures.  ;-)
> > > >
> > > > And another guess:  A tool that identifies use of Kconfig options
> > > > that are not defined in any Kconfig* file.
> > > Based on Paul's second guess ;-),  I did a small research, and I think
> > > the best answer is to modify scripts/checkpatch.pl. We modify checkpatch.pl
> > > to identify use of Kconfig options that are not defined in any Kconfig* file.
> > >
> > > As I am a C/C++ programmer, I would be glad to take some time to learn
> > > perl (checkpatch is implented in perl) first if no other volunteer is
> > > about to do it ;-)
> >
> > I haven't heard anyone else volunteer.  ;-)
> >
> > Others might have opinions on where best to implement these checks,
> > but I must confess that I have not given it much thought.
> I recklessly cc the maintainers of checkpatch.pl without your
> permission to see others' opion,
> and I begin to study perl at the same time, after all, learning
> something is always good ;-)

Works for me!

							Thanx, Paul

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-15 18:09               ` Paul E. McKenney
@ 2021-07-17 22:03                 ` Zhouyi Zhou
  2021-07-18 21:08                   ` Paul E. McKenney
  0 siblings, 1 reply; 14+ messages in thread
From: Zhouyi Zhou @ 2021-07-17 22:03 UTC (permalink / raw)
  To: paulmck
  Cc: Mathieu Desnoyers, Josh Triplett, rostedt, Lai Jiangshan,
	Joel Fernandes, Google, rcu, linux-kernel, apw, joe, ast, daniel,
	andrii, kafai, songliubraving, yhs, john.fastabend, kpsingh, bpf,
	mingo

Hi Paul
During the research, I found a already existing tool to detect
undefined Kconfig macro:
scripts/checkkconfigsymbols.py. It is marvellous!

By invoking ./scripts/checkkconfigsymbols.py > /tmp/log, I found
following possibly undefined Kconfig macros
which may need our attention:

PREEMPT_LOCK
Referencing files: include/linux/lockdep_types.h

PREEMT_DYNAMIC
Referencing files: kernel/entry/common.c

TREE_PREEMPT_RCU
Referencing files: arch/sh/configs/sdk7786_defconfig

RCU_CPU_STALL_INFO
Referencing files: arch/xtensa/configs/nommu_kc705_defconfig

RCU_NOCB_CPU_ALL
Referencing files:
Documentation/RCU/Design/Memory-Ordering/Tree-RCU-Memory-Ordering.rst

RCU_TORTURE_TESTS
Referencing files: kernel/rcu/rcutorture.c

and finally the macro which drive me to do this research

TASKS_RCU_TRACE
Referencing files: include/linux/rcupdate.h, kernel/rcu/tree_plugin.h

On Fri, Jul 16, 2021 at 2:09 AM Paul E. McKenney <paulmck@kernel.org> wrote:
>
> On Thu, Jul 15, 2021 at 04:45:04PM +0800, Zhouyi Zhou wrote:
> > On Thu, Jul 15, 2021 at 11:51 AM Paul E. McKenney <paulmck@kernel.org> wrote:
> > >
> > > On Wed, Jul 14, 2021 at 12:44:36PM +0800, Zhouyi Zhou wrote:
> > > > On Tue, Jul 13, 2021 at 11:19 PM Paul E. McKenney <paulmck@kernel.org> wrote:
> > > > >
> > > > > On Tue, Jul 13, 2021 at 06:18:12AM -0700, Paul E. McKenney wrote:
> > > > > > On Tue, Jul 13, 2021 at 09:09:04AM -0400, Mathieu Desnoyers wrote:
> > > > > > > ----- On Jul 13, 2021, at 12:16 AM, paulmck paulmck@kernel.org wrote:
> > > > > > >
> > > > > > > > On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
> > > > > > > >> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > > > > > >>
> > > > > > > >> Hi Paul,
> > > > > > > >>
> > > > > > > >> During my studying of RCU, I did a grep in the kernel source tree.
> > > > > > > >> I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
> > > > > > > >> should be CONFIG_TASKS_TRACE_RCU instead.
> > > > > > > >>
> > > > > > > >> Without memory fencing, the idle/userspace task inspection may not
> > > > > > > >> be so accurate.
> > > > > > > >>
> > > > > > > >> Thanks for your constant encouragement for my studying.
> > > > > > > >>
> > > > > > > >> Best Wishes
> > > > > > > >> Zhouyi
> > > > > > > >>
> > > > > > > >> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > > > > > >
> > > > > > > > Good eyes, and those could cause real bugs, so thank you!
> > > > > > >
> > > > > > > Hi Paul,
> > > > > > >
> > > > > > > This makes me wonder: what is missing testing-wise in rcutorture to
> > > > > > > catch those issues with testing before they reach mainline ?
> > > > > >
> > > > > > My guess:  Running on weakly ordered architectures.  ;-)
> > > > >
> > > > > And another guess:  A tool that identifies use of Kconfig options
> > > > > that are not defined in any Kconfig* file.
> > > > Based on Paul's second guess ;-),  I did a small research, and I think
> > > > the best answer is to modify scripts/checkpatch.pl. We modify checkpatch.pl
> > > > to identify use of Kconfig options that are not defined in any Kconfig* file.
> > > >
> > > > As I am a C/C++ programmer, I would be glad to take some time to learn
> > > > perl (checkpatch is implented in perl) first if no other volunteer is
> > > > about to do it ;-)
> > >
> > > I haven't heard anyone else volunteer.  ;-)
> > >
> > > Others might have opinions on where best to implement these checks,
> > > but I must confess that I have not given it much thought.
> > I recklessly cc the maintainers of checkpatch.pl without your
> > permission to see others' opion,
> > and I begin to study perl at the same time, after all, learning
> > something is always good ;-)
>
> Works for me!
>
>                                                         Thanx, Paul
Best Wishes
Zhouyi

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-17 22:03                 ` Zhouyi Zhou
@ 2021-07-18 21:08                   ` Paul E. McKenney
  2021-07-20  1:39                     ` Randy Dunlap
  0 siblings, 1 reply; 14+ messages in thread
From: Paul E. McKenney @ 2021-07-18 21:08 UTC (permalink / raw)
  To: Zhouyi Zhou
  Cc: Mathieu Desnoyers, Josh Triplett, rostedt, Lai Jiangshan,
	Joel Fernandes, Google, rcu, linux-kernel, apw, joe, ast, daniel,
	andrii, kafai, songliubraving, yhs, john.fastabend, kpsingh, bpf,
	mingo

On Sun, Jul 18, 2021 at 06:03:34AM +0800, Zhouyi Zhou wrote:
> Hi Paul
> During the research, I found a already existing tool to detect
> undefined Kconfig macro:
> scripts/checkkconfigsymbols.py. It is marvellous!

Nice!  Maybe I should add this to torture.sh.

> By invoking ./scripts/checkkconfigsymbols.py > /tmp/log, I found
> following possibly undefined Kconfig macros
> which may need our attention:
> 
> PREEMPT_LOCK
> Referencing files: include/linux/lockdep_types.h

Not sure about this one.  It might be in anticipation of -rt functionality.
Or another typo.

> PREEMT_DYNAMIC
> Referencing files: kernel/entry/common.c

This needs to be PREEMPT_DYNAMIC.  Please CC Frederic Weisbecker and
myself if you send a patch.

> TREE_PREEMPT_RCU
> Referencing files: arch/sh/configs/sdk7786_defconfig

This would have been correct back in the day.  It should now be
CONFIG_PREEMPT_RCU.  Except that the CONFIG_PREEMPT=y in that same
file implies CONFIG_PREEMPT_RCU=y, so best to simply delete the
CONFIG_TREE_PREEMPT_RCU=y line.

> RCU_CPU_STALL_INFO
> Referencing files: arch/xtensa/configs/nommu_kc705_defconfig

You now get RCU_CPU_STALL_INFO whether you want it or not, so this
line should be deleted.

> RCU_NOCB_CPU_ALL
> Referencing files:
> Documentation/RCU/Design/Memory-Ordering/Tree-RCU-Memory-Ordering.rst

This is an old snapshot of the code.  One approach would be to
update this from the real rcu_prepare_for_idle() function in
kernel/rcu/tree_plugin.h.  The line numbers in the following paragraph
would need to be updated, but the figure is unaffected.

> RCU_TORTURE_TESTS
> Referencing files: kernel/rcu/rcutorture.c

The final "S" needs to be dropped.

> and finally the macro which drive me to do this research
> 
> TASKS_RCU_TRACE
> Referencing files: include/linux/rcupdate.h, kernel/rcu/tree_plugin.h

The fix for this one is of course already queued.

Please CC me if you decide to create patches.  Otherwise, let me know,
and I can produce fixes.

							Thanx, Paul

> On Fri, Jul 16, 2021 at 2:09 AM Paul E. McKenney <paulmck@kernel.org> wrote:
> >
> > On Thu, Jul 15, 2021 at 04:45:04PM +0800, Zhouyi Zhou wrote:
> > > On Thu, Jul 15, 2021 at 11:51 AM Paul E. McKenney <paulmck@kernel.org> wrote:
> > > >
> > > > On Wed, Jul 14, 2021 at 12:44:36PM +0800, Zhouyi Zhou wrote:
> > > > > On Tue, Jul 13, 2021 at 11:19 PM Paul E. McKenney <paulmck@kernel.org> wrote:
> > > > > >
> > > > > > On Tue, Jul 13, 2021 at 06:18:12AM -0700, Paul E. McKenney wrote:
> > > > > > > On Tue, Jul 13, 2021 at 09:09:04AM -0400, Mathieu Desnoyers wrote:
> > > > > > > > ----- On Jul 13, 2021, at 12:16 AM, paulmck paulmck@kernel.org wrote:
> > > > > > > >
> > > > > > > > > On Tue, Jul 13, 2021 at 08:56:45AM +0800, zhouzhouyi@gmail.com wrote:
> > > > > > > > >> From: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > > > > > > >>
> > > > > > > > >> Hi Paul,
> > > > > > > > >>
> > > > > > > > >> During my studying of RCU, I did a grep in the kernel source tree.
> > > > > > > > >> I found there are 3 places where the macro name CONFIG_TASKS_RCU_TRACE
> > > > > > > > >> should be CONFIG_TASKS_TRACE_RCU instead.
> > > > > > > > >>
> > > > > > > > >> Without memory fencing, the idle/userspace task inspection may not
> > > > > > > > >> be so accurate.
> > > > > > > > >>
> > > > > > > > >> Thanks for your constant encouragement for my studying.
> > > > > > > > >>
> > > > > > > > >> Best Wishes
> > > > > > > > >> Zhouyi
> > > > > > > > >>
> > > > > > > > >> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> > > > > > > > >
> > > > > > > > > Good eyes, and those could cause real bugs, so thank you!
> > > > > > > >
> > > > > > > > Hi Paul,
> > > > > > > >
> > > > > > > > This makes me wonder: what is missing testing-wise in rcutorture to
> > > > > > > > catch those issues with testing before they reach mainline ?
> > > > > > >
> > > > > > > My guess:  Running on weakly ordered architectures.  ;-)
> > > > > >
> > > > > > And another guess:  A tool that identifies use of Kconfig options
> > > > > > that are not defined in any Kconfig* file.
> > > > > Based on Paul's second guess ;-),  I did a small research, and I think
> > > > > the best answer is to modify scripts/checkpatch.pl. We modify checkpatch.pl
> > > > > to identify use of Kconfig options that are not defined in any Kconfig* file.
> > > > >
> > > > > As I am a C/C++ programmer, I would be glad to take some time to learn
> > > > > perl (checkpatch is implented in perl) first if no other volunteer is
> > > > > about to do it ;-)
> > > >
> > > > I haven't heard anyone else volunteer.  ;-)
> > > >
> > > > Others might have opinions on where best to implement these checks,
> > > > but I must confess that I have not given it much thought.
> > > I recklessly cc the maintainers of checkpatch.pl without your
> > > permission to see others' opion,
> > > and I begin to study perl at the same time, after all, learning
> > > something is always good ;-)
> >
> > Works for me!
> >
> >                                                         Thanx, Paul
> Best Wishes
> Zhouyi

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-18 21:08                   ` Paul E. McKenney
@ 2021-07-20  1:39                     ` Randy Dunlap
  2021-07-20  2:07                       ` Paul E. McKenney
  0 siblings, 1 reply; 14+ messages in thread
From: Randy Dunlap @ 2021-07-20  1:39 UTC (permalink / raw)
  To: paulmck, Zhouyi Zhou
  Cc: Mathieu Desnoyers, Josh Triplett, rostedt, Lai Jiangshan,
	Joel Fernandes, Google, rcu, linux-kernel, apw, joe, ast, daniel,
	andrii, kafai, songliubraving, yhs, john.fastabend, kpsingh, bpf,
	mingo

On 7/18/21 2:08 PM, Paul E. McKenney wrote:
> On Sun, Jul 18, 2021 at 06:03:34AM +0800, Zhouyi Zhou wrote:
>> Hi Paul
>> During the research, I found a already existing tool to detect
>> undefined Kconfig macro:
>> scripts/checkkconfigsymbols.py. It is marvellous!
> 
> Nice!  Maybe I should add this to torture.sh.
> 

Paul, I believe that subsystems should take care of themselves,
so you can do that for RCU, e.g., but at the same time, I think that
some CI should be running that script (and other relevant scripts)
on the entire kernel tree and reporting problems that are found.

-- 
~Randy


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE
  2021-07-20  1:39                     ` Randy Dunlap
@ 2021-07-20  2:07                       ` Paul E. McKenney
  0 siblings, 0 replies; 14+ messages in thread
From: Paul E. McKenney @ 2021-07-20  2:07 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Zhouyi Zhou, Mathieu Desnoyers, Josh Triplett, rostedt,
	Lai Jiangshan, Joel Fernandes, Google, rcu, linux-kernel, apw,
	joe, ast, daniel, andrii, kafai, songliubraving, yhs,
	john.fastabend, kpsingh, bpf, mingo

On Mon, Jul 19, 2021 at 06:39:17PM -0700, Randy Dunlap wrote:
> On 7/18/21 2:08 PM, Paul E. McKenney wrote:
> > On Sun, Jul 18, 2021 at 06:03:34AM +0800, Zhouyi Zhou wrote:
> >> Hi Paul
> >> During the research, I found a already existing tool to detect
> >> undefined Kconfig macro:
> >> scripts/checkkconfigsymbols.py. It is marvellous!
> > 
> > Nice!  Maybe I should add this to torture.sh.
> 
> Paul, I believe that subsystems should take care of themselves,
> so you can do that for RCU, e.g., but at the same time, I think that
> some CI should be running that script (and other relevant scripts)
> on the entire kernel tree and reporting problems that are found.

Even better!  ;-)

							Thanx, Paul

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-07-20  2:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13  0:56 [PATCH] RCU: Fix macro name CONFIG_TASKS_RCU_TRACE zhouzhouyi
2021-07-13  4:16 ` Paul E. McKenney
2021-07-13  6:16   ` Zhouyi Zhou
2021-07-13 13:09   ` Mathieu Desnoyers
2021-07-13 13:18     ` Paul E. McKenney
2021-07-13 15:19       ` Paul E. McKenney
2021-07-14  4:44         ` Zhouyi Zhou
2021-07-15  3:51           ` Paul E. McKenney
2021-07-15  8:45             ` Zhouyi Zhou
2021-07-15 18:09               ` Paul E. McKenney
2021-07-17 22:03                 ` Zhouyi Zhou
2021-07-18 21:08                   ` Paul E. McKenney
2021-07-20  1:39                     ` Randy Dunlap
2021-07-20  2:07                       ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).