[v3,rcu,08/11] arch/s390: Add ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option

Message ID 20221019225846.2501109-8-paulmck@kernel.org
State New
Headers
Series NMI-safe SRCU readers for v6.2 |

Commit Message

Paul E. McKenney Oct. 19, 2022, 10:58 p.m. UTC
  The s390 architecture uses either a cmpxchg loop (old systems)
or the laa add-to-memory instruction (new systems) to implement
this_cpu_add(), both of which are NMI safe.  This means that the old
and more-efficient srcu_read_lock() may be used in NMI context, without
the need for srcu_read_lock_nmisafe().  Therefore, add the new Kconfig
option ARCH_HAS_NMI_SAFE_THIS_CPU_OPS to arch/arm64/Kconfig, which will
cause NEED_SRCU_NMI_SAFE to be deselected, thus preserving the current
srcu_read_lock() behavior.

Link: https://lore.kernel.org/all/20220910221947.171557773@linutronix.de/

Suggested-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Suggested-by: Frederic Weisbecker <frederic@kernel.org>
Suggested-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Petr Mladek <pmladek@suse.com>
Cc: <linux-s390@vger.kernel.org>
---
 arch/s390/Kconfig | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Christian Borntraeger Oct. 20, 2022, 5:16 a.m. UTC | #1
Am 20.10.22 um 00:58 schrieb Paul E. McKenney:
> The s390 architecture uses either a cmpxchg loop (old systems)
> or the laa add-to-memory instruction (new systems) to implement
> this_cpu_add(), both of which are NMI safe.  This means that the old
> and more-efficient srcu_read_lock() may be used in NMI context, without
> the need for srcu_read_lock_nmisafe().  Therefore, add the new Kconfig
> option ARCH_HAS_NMI_SAFE_THIS_CPU_OPS to arch/arm64/Kconfig, which will
						s390 ?
> cause NEED_SRCU_NMI_SAFE to be deselected, thus preserving the current
> srcu_read_lock() behavior.
> 
> Link: https://lore.kernel.org/all/20220910221947.171557773@linutronix.de/
> 
> Suggested-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
> Suggested-by: Frederic Weisbecker <frederic@kernel.org>
> Suggested-by: Boqun Feng <boqun.feng@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Cc: Heiko Carstens <hca@linux.ibm.com>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Alexander Gordeev <agordeev@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
> Cc: Sven Schnelle <svens@linux.ibm.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: John Ogness <john.ogness@linutronix.de>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: <linux-s390@vger.kernel.org>
> ---
>   arch/s390/Kconfig | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index 318fce77601d3..0acdfda332908 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -73,6 +73,7 @@ config S390
>   	select ARCH_HAS_GIGANTIC_PAGE
>   	select ARCH_HAS_KCOV
>   	select ARCH_HAS_MEM_ENCRYPT
> +	select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
>   	select ARCH_HAS_PTE_SPECIAL
>   	select ARCH_HAS_SCALED_CPUTIME
>   	select ARCH_HAS_SET_MEMORY
  
Heiko Carstens Oct. 20, 2022, 7:23 a.m. UTC | #2
On Thu, Oct 20, 2022 at 07:16:44AM +0200, Christian Borntraeger wrote:
> 
> 
> Am 20.10.22 um 00:58 schrieb Paul E. McKenney:
> > The s390 architecture uses either a cmpxchg loop (old systems)
> > or the laa add-to-memory instruction (new systems) to implement
> > this_cpu_add(), both of which are NMI safe.  This means that the old
> > and more-efficient srcu_read_lock() may be used in NMI context, without
> > the need for srcu_read_lock_nmisafe().  Therefore, add the new Kconfig
> > option ARCH_HAS_NMI_SAFE_THIS_CPU_OPS to arch/arm64/Kconfig, which will
> 						s390 ?
> > cause NEED_SRCU_NMI_SAFE to be deselected, thus preserving the current
> > srcu_read_lock() behavior.
> > 
> > Link: https://lore.kernel.org/all/20220910221947.171557773@linutronix.de/
> > 
> > Suggested-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
> > Suggested-by: Frederic Weisbecker <frederic@kernel.org>
> > Suggested-by: Boqun Feng <boqun.feng@gmail.com>
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
...
> > ---
> >   arch/s390/Kconfig | 1 +
> >   1 file changed, 1 insertion(+)

Not sure what Christian was trying to say with his empty reply :)
In any case:
Acked-by: Heiko Carstens <hca@linux.ibm.com>
  
Heiko Carstens Oct. 20, 2022, 7:27 a.m. UTC | #3
On Thu, Oct 20, 2022 at 09:23:49AM +0200, Heiko Carstens wrote:
> On Thu, Oct 20, 2022 at 07:16:44AM +0200, Christian Borntraeger wrote:
> > Am 20.10.22 um 00:58 schrieb Paul E. McKenney:
> > > The s390 architecture uses either a cmpxchg loop (old systems)
> > > or the laa add-to-memory instruction (new systems) to implement
> > > this_cpu_add(), both of which are NMI safe.  This means that the old
> > > and more-efficient srcu_read_lock() may be used in NMI context, without
> > > the need for srcu_read_lock_nmisafe().  Therefore, add the new Kconfig
> > > option ARCH_HAS_NMI_SAFE_THIS_CPU_OPS to arch/arm64/Kconfig, which will
> > 						s390 ?

Ah, this typo is what Christian pointed out; missed that.

> > > cause NEED_SRCU_NMI_SAFE to be deselected, thus preserving the current
> > > srcu_read_lock() behavior.
> > > 
> > > Link: https://lore.kernel.org/all/20220910221947.171557773@linutronix.de/
> > > 
> > > Suggested-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
> > > Suggested-by: Frederic Weisbecker <frederic@kernel.org>
> > > Suggested-by: Boqun Feng <boqun.feng@gmail.com>
> > > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> ...
> > > ---
> > >   arch/s390/Kconfig | 1 +
> > >   1 file changed, 1 insertion(+)
> 
> Not sure what Christian was trying to say with his empty reply :)
> In any case:
> Acked-by: Heiko Carstens <hca@linux.ibm.com>
  
Paul E. McKenney Oct. 20, 2022, 4:35 p.m. UTC | #4
On Thu, Oct 20, 2022 at 09:27:37AM +0200, Heiko Carstens wrote:
> On Thu, Oct 20, 2022 at 09:23:49AM +0200, Heiko Carstens wrote:
> > On Thu, Oct 20, 2022 at 07:16:44AM +0200, Christian Borntraeger wrote:
> > > Am 20.10.22 um 00:58 schrieb Paul E. McKenney:
> > > > The s390 architecture uses either a cmpxchg loop (old systems)
> > > > or the laa add-to-memory instruction (new systems) to implement
> > > > this_cpu_add(), both of which are NMI safe.  This means that the old
> > > > and more-efficient srcu_read_lock() may be used in NMI context, without
> > > > the need for srcu_read_lock_nmisafe().  Therefore, add the new Kconfig
> > > > option ARCH_HAS_NMI_SAFE_THIS_CPU_OPS to arch/arm64/Kconfig, which will
> > > 						s390 ?
> 
> Ah, this typo is what Christian pointed out; missed that.
> 
> > > > cause NEED_SRCU_NMI_SAFE to be deselected, thus preserving the current
> > > > srcu_read_lock() behavior.
> > > > 
> > > > Link: https://lore.kernel.org/all/20220910221947.171557773@linutronix.de/
> > > > 
> > > > Suggested-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
> > > > Suggested-by: Frederic Weisbecker <frederic@kernel.org>
> > > > Suggested-by: Boqun Feng <boqun.feng@gmail.com>
> > > > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > ...
> > > > ---
> > > >   arch/s390/Kconfig | 1 +
> > > >   1 file changed, 1 insertion(+)
> > 
> > Not sure what Christian was trying to say with his empty reply :)
> > In any case:
> > Acked-by: Heiko Carstens <hca@linux.ibm.com>

I will apply the fix and the ack on my next rebase, thank you both!

							Thanx, Paul
  

Patch

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 318fce77601d3..0acdfda332908 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -73,6 +73,7 @@  config S390
 	select ARCH_HAS_GIGANTIC_PAGE
 	select ARCH_HAS_KCOV
 	select ARCH_HAS_MEM_ENCRYPT
+	select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
 	select ARCH_HAS_PTE_SPECIAL
 	select ARCH_HAS_SCALED_CPUTIME
 	select ARCH_HAS_SET_MEMORY