[PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing

Boqun Feng posted 11 patches 10 months ago
[PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Posted by Boqun Feng 10 months ago
From: "Paul E. McKenney" <paulmck@kernel.org>

The srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions
map to __srcu_read_lock() and __srcu_read_unlock() on systems like x86
that have NMI-safe this_cpu_inc() operations.  This makes the underlying
__srcu_read_lock_nmisafe() and __srcu_read_unlock_nmisafe() functions
difficult to test on (for example) x86 systems, allowing bugs to creep in.

This commit therefore creates a FORCE_NEED_SRCU_NMI_SAFE Kconfig that
forces those underlying functions to be used even on systems where they
are not needed, thus providing better testing coverage.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
 kernel/rcu/Kconfig | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
index b9b6bc55185d..c8e540af3a35 100644
--- a/kernel/rcu/Kconfig
+++ b/kernel/rcu/Kconfig
@@ -65,6 +65,17 @@ config TREE_SRCU
 	help
 	  This option selects the full-fledged version of SRCU.
 
+config FORCE_NEED_SRCU_NMI_SAFE
+	bool "Force selection of NEED_SRCU_NMI_SAFE"
+	depends on !TINY_SRCU
+	select NEED_SRCU_NMI_SAFE
+	default n
+	help
+	  This option forces selection of the NEED_SRCU_NMI_SAFE
+	  Kconfig option, allowing testing of srcu_read_lock_nmisafe()
+	  and srcu_read_unlock_nmisafe() on architectures (like x86)
+	  that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.
+
 config NEED_SRCU_NMI_SAFE
 	def_bool HAVE_NMI && !ARCH_HAS_NMI_SAFE_THIS_CPU_OPS && !TINY_SRCU
 
-- 
2.39.5 (Apple Git-154)
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Posted by Geert Uytterhoeven 8 months, 4 weeks ago
Hi Boqun, Paul,

On Wed, 19 Feb 2025 at 16:44, Boqun Feng <boqun.feng@gmail.com> wrote:
> From: "Paul E. McKenney" <paulmck@kernel.org>
>
> The srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions
> map to __srcu_read_lock() and __srcu_read_unlock() on systems like x86
> that have NMI-safe this_cpu_inc() operations.  This makes the underlying
> __srcu_read_lock_nmisafe() and __srcu_read_unlock_nmisafe() functions
> difficult to test on (for example) x86 systems, allowing bugs to creep in.
>
> This commit therefore creates a FORCE_NEED_SRCU_NMI_SAFE Kconfig that
> forces those underlying functions to be used even on systems where they
> are not needed, thus providing better testing coverage.
>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>

Thanks for your patch, which is now commit 536e8b9b80bc7a0a ("srcu:
Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing") in linus/master

> --- a/kernel/rcu/Kconfig
> +++ b/kernel/rcu/Kconfig
> @@ -65,6 +65,17 @@ config TREE_SRCU
>         help
>           This option selects the full-fledged version of SRCU.
>
> +config FORCE_NEED_SRCU_NMI_SAFE
> +       bool "Force selection of NEED_SRCU_NMI_SAFE"

What am I supposed to answer here? "n" I guess.
What about distro and allmodconfig kernels?

> +       depends on !TINY_SRCU
> +       select NEED_SRCU_NMI_SAFE
> +       default n
> +       help
> +         This option forces selection of the NEED_SRCU_NMI_SAFE
> +         Kconfig option, allowing testing of srcu_read_lock_nmisafe()
> +         and srcu_read_unlock_nmisafe() on architectures (like x86)
> +         that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.

Perhaps this should depend on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS?

> +
>  config NEED_SRCU_NMI_SAFE
>         def_bool HAVE_NMI && !ARCH_HAS_NMI_SAFE_THIS_CPU_OPS && !TINY_SRCU

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Posted by Paul E. McKenney 8 months, 4 weeks ago
On Tue, Mar 25, 2025 at 09:04:31AM +0100, Geert Uytterhoeven wrote:
> Hi Boqun, Paul,
> 
> On Wed, 19 Feb 2025 at 16:44, Boqun Feng <boqun.feng@gmail.com> wrote:
> > From: "Paul E. McKenney" <paulmck@kernel.org>
> >
> > The srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions
> > map to __srcu_read_lock() and __srcu_read_unlock() on systems like x86
> > that have NMI-safe this_cpu_inc() operations.  This makes the underlying
> > __srcu_read_lock_nmisafe() and __srcu_read_unlock_nmisafe() functions
> > difficult to test on (for example) x86 systems, allowing bugs to creep in.
> >
> > This commit therefore creates a FORCE_NEED_SRCU_NMI_SAFE Kconfig that
> > forces those underlying functions to be used even on systems where they
> > are not needed, thus providing better testing coverage.
> >
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> 
> Thanks for your patch, which is now commit 536e8b9b80bc7a0a ("srcu:
> Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing") in linus/master
> 
> > --- a/kernel/rcu/Kconfig
> > +++ b/kernel/rcu/Kconfig
> > @@ -65,6 +65,17 @@ config TREE_SRCU
> >         help
> >           This option selects the full-fledged version of SRCU.
> >
> > +config FORCE_NEED_SRCU_NMI_SAFE
> > +       bool "Force selection of NEED_SRCU_NMI_SAFE"
> 
> What am I supposed to answer here? "n" I guess.
> What about distro and allmodconfig kernels?

Yes, you should select "n" unless ...

> > +       depends on !TINY_SRCU
> > +       select NEED_SRCU_NMI_SAFE
> > +       default n
> > +       help
> > +         This option forces selection of the NEED_SRCU_NMI_SAFE
> > +         Kconfig option, allowing testing of srcu_read_lock_nmisafe()
> > +         and srcu_read_unlock_nmisafe() on architectures (like x86)
> > +         that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.
> 
> Perhaps this should depend on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS?

... you are on a system selecting ARCH_HAS_NMI_SAFE_THIS_CPU_OPS and
you would like to test the SRCU setup that needed only by systems that
do not select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS.

Ah.  I forgot to add "depends on RCU_EXPERT".

Apologies, I will fix this.  Does the patch show below do the trick?

							Thanx, Paul

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

commit b5c8c6f89c6d7ac778e961ad4b883eada0c1f42a
Author: Paul E. McKenney <paulmck@kernel.org>
Date:   Tue Mar 25 07:31:45 2025 -0700

    srcu: Make FORCE_NEED_SRCU_NMI_SAFE depend on RCU_EXPERT
    
    The FORCE_NEED_SRCU_NMI_SAFE is useful only for those wishing to test
    the SRCU code paths that accommodate architectures that do not have
    NMI-safe per-CPU operations, that is, those architectures that do not
    select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.  As such, this
    is a specialized Kconfig option that is not intended for casual users.
    
    This commit therefore hides it behind the RCU_EXPERT Kconfig option.
    
    Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Closes: https://lore.kernel.org/all/CAMuHMdX6dy9_tmpLkpcnGzxyRbe6qSWYukcPp=H1GzZdyd3qBQ@mail.gmail.com/
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
index b3f985d41717a..cc4ce79f58aa6 100644
--- a/kernel/rcu/Kconfig
+++ b/kernel/rcu/Kconfig
@@ -68,6 +68,7 @@ config TREE_SRCU
 config FORCE_NEED_SRCU_NMI_SAFE
 	bool "Force selection of NEED_SRCU_NMI_SAFE"
 	depends on !TINY_SRCU
+	depends on RCU_EXPERT
 	select NEED_SRCU_NMI_SAFE
 	default n
 	help
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Posted by Geert Uytterhoeven 8 months, 4 weeks ago
Hi Paul,

On Tue, 25 Mar 2025 at 15:36, Paul E. McKenney <paulmck@kernel.org> wrote:
> On Tue, Mar 25, 2025 at 09:04:31AM +0100, Geert Uytterhoeven wrote:
> > On Wed, 19 Feb 2025 at 16:44, Boqun Feng <boqun.feng@gmail.com> wrote:
> > > From: "Paul E. McKenney" <paulmck@kernel.org>
> > >
> > > The srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions
> > > map to __srcu_read_lock() and __srcu_read_unlock() on systems like x86
> > > that have NMI-safe this_cpu_inc() operations.  This makes the underlying
> > > __srcu_read_lock_nmisafe() and __srcu_read_unlock_nmisafe() functions
> > > difficult to test on (for example) x86 systems, allowing bugs to creep in.
> > >
> > > This commit therefore creates a FORCE_NEED_SRCU_NMI_SAFE Kconfig that
> > > forces those underlying functions to be used even on systems where they
> > > are not needed, thus providing better testing coverage.
> > >
> > > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > > Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> >
> > Thanks for your patch, which is now commit 536e8b9b80bc7a0a ("srcu:
> > Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing") in linus/master
> >
> > > --- a/kernel/rcu/Kconfig
> > > +++ b/kernel/rcu/Kconfig
> > > @@ -65,6 +65,17 @@ config TREE_SRCU
> > >         help
> > >           This option selects the full-fledged version of SRCU.
> > >
> > > +config FORCE_NEED_SRCU_NMI_SAFE
> > > +       bool "Force selection of NEED_SRCU_NMI_SAFE"
> >
> > What am I supposed to answer here? "n" I guess.
> > What about distro and allmodconfig kernels?
>
> Yes, you should select "n" unless ...
>
> > > +       depends on !TINY_SRCU
> > > +       select NEED_SRCU_NMI_SAFE
> > > +       default n
> > > +       help
> > > +         This option forces selection of the NEED_SRCU_NMI_SAFE
> > > +         Kconfig option, allowing testing of srcu_read_lock_nmisafe()
> > > +         and srcu_read_unlock_nmisafe() on architectures (like x86)
> > > +         that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.
> >
> > Perhaps this should depend on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS?
>
> ... you are on a system selecting ARCH_HAS_NMI_SAFE_THIS_CPU_OPS and

So a dependency on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS does make sense,
doesn't it?

> you would like to test the SRCU setup that needed only by systems that
> do not select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS.
>
> Ah.  I forgot to add "depends on RCU_EXPERT".

Yes, that makes sense.

> Apologies, I will fix this.  Does the patch show below do the trick?
>
>                                                         Thanx, Paul
>
> ------------------------------------------------------------------------
>
> commit b5c8c6f89c6d7ac778e961ad4b883eada0c1f42a
> Author: Paul E. McKenney <paulmck@kernel.org>
> Date:   Tue Mar 25 07:31:45 2025 -0700
>
>     srcu: Make FORCE_NEED_SRCU_NMI_SAFE depend on RCU_EXPERT
>
>     The FORCE_NEED_SRCU_NMI_SAFE is useful only for those wishing to test
>     the SRCU code paths that accommodate architectures that do not have
>     NMI-safe per-CPU operations, that is, those architectures that do not
>     select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.  As such, this
>     is a specialized Kconfig option that is not intended for casual users.
>
>     This commit therefore hides it behind the RCU_EXPERT Kconfig option.
>
>     Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
>     Closes: https://lore.kernel.org/all/CAMuHMdX6dy9_tmpLkpcnGzxyRbe6qSWYukcPp=H1GzZdyd3qBQ@mail.gmail.com/
>     Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>
> diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
> index b3f985d41717a..cc4ce79f58aa6 100644
> --- a/kernel/rcu/Kconfig
> +++ b/kernel/rcu/Kconfig
> @@ -68,6 +68,7 @@ config TREE_SRCU
>  config FORCE_NEED_SRCU_NMI_SAFE
>         bool "Force selection of NEED_SRCU_NMI_SAFE"
>         depends on !TINY_SRCU
> +       depends on RCU_EXPERT
>         select NEED_SRCU_NMI_SAFE
>         default n
>         help

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Posted by Paul E. McKenney 8 months, 4 weeks ago
On Tue, Mar 25, 2025 at 03:57:43PM +0100, Geert Uytterhoeven wrote:
> Hi Paul,
> 
> On Tue, 25 Mar 2025 at 15:36, Paul E. McKenney <paulmck@kernel.org> wrote:
> > On Tue, Mar 25, 2025 at 09:04:31AM +0100, Geert Uytterhoeven wrote:
> > > On Wed, 19 Feb 2025 at 16:44, Boqun Feng <boqun.feng@gmail.com> wrote:
> > > > From: "Paul E. McKenney" <paulmck@kernel.org>
> > > >
> > > > The srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions
> > > > map to __srcu_read_lock() and __srcu_read_unlock() on systems like x86
> > > > that have NMI-safe this_cpu_inc() operations.  This makes the underlying
> > > > __srcu_read_lock_nmisafe() and __srcu_read_unlock_nmisafe() functions
> > > > difficult to test on (for example) x86 systems, allowing bugs to creep in.
> > > >
> > > > This commit therefore creates a FORCE_NEED_SRCU_NMI_SAFE Kconfig that
> > > > forces those underlying functions to be used even on systems where they
> > > > are not needed, thus providing better testing coverage.
> > > >
> > > > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > > > Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> > >
> > > Thanks for your patch, which is now commit 536e8b9b80bc7a0a ("srcu:
> > > Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing") in linus/master
> > >
> > > > --- a/kernel/rcu/Kconfig
> > > > +++ b/kernel/rcu/Kconfig
> > > > @@ -65,6 +65,17 @@ config TREE_SRCU
> > > >         help
> > > >           This option selects the full-fledged version of SRCU.
> > > >
> > > > +config FORCE_NEED_SRCU_NMI_SAFE
> > > > +       bool "Force selection of NEED_SRCU_NMI_SAFE"
> > >
> > > What am I supposed to answer here? "n" I guess.
> > > What about distro and allmodconfig kernels?
> >
> > Yes, you should select "n" unless ...
> >
> > > > +       depends on !TINY_SRCU
> > > > +       select NEED_SRCU_NMI_SAFE
> > > > +       default n
> > > > +       help
> > > > +         This option forces selection of the NEED_SRCU_NMI_SAFE
> > > > +         Kconfig option, allowing testing of srcu_read_lock_nmisafe()
> > > > +         and srcu_read_unlock_nmisafe() on architectures (like x86)
> > > > +         that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.
> > >
> > > Perhaps this should depend on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS?
> >
> > ... you are on a system selecting ARCH_HAS_NMI_SAFE_THIS_CPU_OPS and
> 
> So a dependency on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS does make sense,
> doesn't it?

The FORCE_NEED_SRCU_NMI_SAFE has no effect otherwise, so it cannot
hurt.  Again, please see below.

							Thanx, Paul

> > you would like to test the SRCU setup that needed only by systems that
> > do not select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS.
> >
> > Ah.  I forgot to add "depends on RCU_EXPERT".
> 
> Yes, that makes sense.
> 
> > Apologies, I will fix this.  Does the patch show below do the trick?
> >
> >                                                         Thanx, Paul

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

commit 2245ef8605a80726548253d885b4cadd97f69f3b
Author: Paul E. McKenney <paulmck@kernel.org>
Date:   Tue Mar 25 07:31:45 2025 -0700

    srcu: Make FORCE_NEED_SRCU_NMI_SAFE depend on RCU_EXPERT
    
    The FORCE_NEED_SRCU_NMI_SAFE is useful only for those wishing to test
    the SRCU code paths that accommodate architectures that do not have
    NMI-safe per-CPU operations, that is, those architectures that do not
    select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.  As such, this
    is a specialized Kconfig option that is not intended for casual users.
    
    This commit therefore hides it behind the RCU_EXPERT Kconfig option.
    Given that this new FORCE_NEED_SRCU_NMI_SAFE Kconfig option has no effect
    unless the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option is also selected,
    it also depends on this Kconfig option.
    
    [ paulmck: Apply Geert Uytterhoeven feedback. ]
    
    Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Closes: https://lore.kernel.org/all/CAMuHMdX6dy9_tmpLkpcnGzxyRbe6qSWYukcPp=H1GzZdyd3qBQ@mail.gmail.com/
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
index b3f985d41717a..ceaf6594f634c 100644
--- a/kernel/rcu/Kconfig
+++ b/kernel/rcu/Kconfig
@@ -68,6 +68,8 @@ config TREE_SRCU
 config FORCE_NEED_SRCU_NMI_SAFE
 	bool "Force selection of NEED_SRCU_NMI_SAFE"
 	depends on !TINY_SRCU
+	depends on RCU_EXPERT
+	depends on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
 	select NEED_SRCU_NMI_SAFE
 	default n
 	help
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Posted by Geert Uytterhoeven 8 months, 4 weeks ago
Hi Paul,

On Tue, 25 Mar 2025 at 16:08, Paul E. McKenney <paulmck@kernel.org> wrote:
> commit 2245ef8605a80726548253d885b4cadd97f69f3b
> Author: Paul E. McKenney <paulmck@kernel.org>
> Date:   Tue Mar 25 07:31:45 2025 -0700
>
>     srcu: Make FORCE_NEED_SRCU_NMI_SAFE depend on RCU_EXPERT
>
>     The FORCE_NEED_SRCU_NMI_SAFE is useful only for those wishing to test
>     the SRCU code paths that accommodate architectures that do not have
>     NMI-safe per-CPU operations, that is, those architectures that do not
>     select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.  As such, this
>     is a specialized Kconfig option that is not intended for casual users.
>
>     This commit therefore hides it behind the RCU_EXPERT Kconfig option.
>     Given that this new FORCE_NEED_SRCU_NMI_SAFE Kconfig option has no effect
>     unless the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option is also selected,
>     it also depends on this Kconfig option.
>
>     [ paulmck: Apply Geert Uytterhoeven feedback. ]
>
>     Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
>     Closes: https://lore.kernel.org/all/CAMuHMdX6dy9_tmpLkpcnGzxyRbe6qSWYukcPp=H1GzZdyd3qBQ@mail.gmail.com/
>     Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>
> diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
> index b3f985d41717a..ceaf6594f634c 100644
> --- a/kernel/rcu/Kconfig
> +++ b/kernel/rcu/Kconfig
> @@ -68,6 +68,8 @@ config TREE_SRCU
>  config FORCE_NEED_SRCU_NMI_SAFE
>         bool "Force selection of NEED_SRCU_NMI_SAFE"
>         depends on !TINY_SRCU
> +       depends on RCU_EXPERT
> +       depends on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
>         select NEED_SRCU_NMI_SAFE
>         default n
>         help

LGTM, so
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Posted by Paul E. McKenney 8 months, 4 weeks ago
On Tue, Mar 25, 2025 at 04:36:23PM +0100, Geert Uytterhoeven wrote:
> Hi Paul,
> 
> On Tue, 25 Mar 2025 at 16:08, Paul E. McKenney <paulmck@kernel.org> wrote:
> > commit 2245ef8605a80726548253d885b4cadd97f69f3b
> > Author: Paul E. McKenney <paulmck@kernel.org>
> > Date:   Tue Mar 25 07:31:45 2025 -0700
> >
> >     srcu: Make FORCE_NEED_SRCU_NMI_SAFE depend on RCU_EXPERT
> >
> >     The FORCE_NEED_SRCU_NMI_SAFE is useful only for those wishing to test
> >     the SRCU code paths that accommodate architectures that do not have
> >     NMI-safe per-CPU operations, that is, those architectures that do not
> >     select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.  As such, this
> >     is a specialized Kconfig option that is not intended for casual users.
> >
> >     This commit therefore hides it behind the RCU_EXPERT Kconfig option.
> >     Given that this new FORCE_NEED_SRCU_NMI_SAFE Kconfig option has no effect
> >     unless the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option is also selected,
> >     it also depends on this Kconfig option.
> >
> >     [ paulmck: Apply Geert Uytterhoeven feedback. ]
> >
> >     Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> >     Closes: https://lore.kernel.org/all/CAMuHMdX6dy9_tmpLkpcnGzxyRbe6qSWYukcPp=H1GzZdyd3qBQ@mail.gmail.com/
> >     Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> >
> > diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
> > index b3f985d41717a..ceaf6594f634c 100644
> > --- a/kernel/rcu/Kconfig
> > +++ b/kernel/rcu/Kconfig
> > @@ -68,6 +68,8 @@ config TREE_SRCU
> >  config FORCE_NEED_SRCU_NMI_SAFE
> >         bool "Force selection of NEED_SRCU_NMI_SAFE"
> >         depends on !TINY_SRCU
> > +       depends on RCU_EXPERT
> > +       depends on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
> >         select NEED_SRCU_NMI_SAFE
> >         default n
> >         help
> 
> LGTM, so
> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Applied, and thank you very much for both the review and the report!

							Thanx, Paul
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Posted by Boqun Feng 8 months, 3 weeks ago
On Tue, Mar 25, 2025 at 08:51:05AM -0700, Paul E. McKenney wrote:
> On Tue, Mar 25, 2025 at 04:36:23PM +0100, Geert Uytterhoeven wrote:
> > Hi Paul,
> > 
> > On Tue, 25 Mar 2025 at 16:08, Paul E. McKenney <paulmck@kernel.org> wrote:
> > > commit 2245ef8605a80726548253d885b4cadd97f69f3b
> > > Author: Paul E. McKenney <paulmck@kernel.org>
> > > Date:   Tue Mar 25 07:31:45 2025 -0700
> > >
> > >     srcu: Make FORCE_NEED_SRCU_NMI_SAFE depend on RCU_EXPERT
> > >
> > >     The FORCE_NEED_SRCU_NMI_SAFE is useful only for those wishing to test
> > >     the SRCU code paths that accommodate architectures that do not have
> > >     NMI-safe per-CPU operations, that is, those architectures that do not
> > >     select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.  As such, this
> > >     is a specialized Kconfig option that is not intended for casual users.
> > >
> > >     This commit therefore hides it behind the RCU_EXPERT Kconfig option.
> > >     Given that this new FORCE_NEED_SRCU_NMI_SAFE Kconfig option has no effect
> > >     unless the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option is also selected,
> > >     it also depends on this Kconfig option.
> > >
> > >     [ paulmck: Apply Geert Uytterhoeven feedback. ]
> > >
> > >     Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > >     Closes: https://lore.kernel.org/all/CAMuHMdX6dy9_tmpLkpcnGzxyRbe6qSWYukcPp=H1GzZdyd3qBQ@mail.gmail.com/
> > >     Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > >
> > > diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
> > > index b3f985d41717a..ceaf6594f634c 100644
> > > --- a/kernel/rcu/Kconfig
> > > +++ b/kernel/rcu/Kconfig
> > > @@ -68,6 +68,8 @@ config TREE_SRCU
> > >  config FORCE_NEED_SRCU_NMI_SAFE
> > >         bool "Force selection of NEED_SRCU_NMI_SAFE"
> > >         depends on !TINY_SRCU
> > > +       depends on RCU_EXPERT
> > > +       depends on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
> > >         select NEED_SRCU_NMI_SAFE
> > >         default n
> > >         help
> > 
> > LGTM, so
> > Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Applied, and thank you very much for both the review and the report!
> 

Queued for further testing, thank you both!

Regards,
Boqun

> 							Thanx, Paul