public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390/pkey: Remove synchronize_rcu from pkey_handler_register
@ 2026-03-13  5:23 lirongqing
  2026-03-13  8:32 ` Harald Freudenberger
  2026-03-16  9:35 ` Harald Freudenberger
  0 siblings, 2 replies; 6+ messages in thread
From: lirongqing @ 2026-03-13  5:23 UTC (permalink / raw)
  To: Harald Freudenberger, Holger Dengler, Heiko Carstens,
	Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
	Sven Schnelle, linux-s390
  Cc: Li RongQing

From: Li RongQing <lirongqing@baidu.com>

The synchronize_rcu() call after adding a handler to the handler_list
is redundant because RCU readers will either see the old list or the
new list. Removing this synchronization point reduces the blocking
time during handler registration.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/s390/crypto/pkey_base.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/s390/crypto/pkey_base.c b/drivers/s390/crypto/pkey_base.c
index d60cd98..c2e29d6 100644
--- a/drivers/s390/crypto/pkey_base.c
+++ b/drivers/s390/crypto/pkey_base.c
@@ -60,7 +60,6 @@ int pkey_handler_register(struct pkey_handler *handler)
 
 	list_add_rcu(&handler->list, &handler_list);
 	spin_unlock(&handler_list_write_lock);
-	synchronize_rcu();
 
 	module_put(handler->module);
 
-- 
2.9.4


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

* Re: [PATCH] s390/pkey: Remove synchronize_rcu from pkey_handler_register
  2026-03-13  5:23 [PATCH] s390/pkey: Remove synchronize_rcu from pkey_handler_register lirongqing
@ 2026-03-13  8:32 ` Harald Freudenberger
  2026-03-13  9:06   ` Heiko Carstens
  2026-03-16  9:35 ` Harald Freudenberger
  1 sibling, 1 reply; 6+ messages in thread
From: Harald Freudenberger @ 2026-03-13  8:32 UTC (permalink / raw)
  To: lirongqing
  Cc: Holger Dengler, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, linux-s390

On 2026-03-13 06:23, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
> 
> The synchronize_rcu() call after adding a handler to the handler_list
> is redundant because RCU readers will either see the old list or the
> new list. Removing this synchronization point reduces the blocking
> time during handler registration.
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>  drivers/s390/crypto/pkey_base.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/s390/crypto/pkey_base.c 
> b/drivers/s390/crypto/pkey_base.c
> index d60cd98..c2e29d6 100644
> --- a/drivers/s390/crypto/pkey_base.c
> +++ b/drivers/s390/crypto/pkey_base.c
> @@ -60,7 +60,6 @@ int pkey_handler_register(struct pkey_handler 
> *handler)
> 
>  	list_add_rcu(&handler->list, &handler_list);
>  	spin_unlock(&handler_list_write_lock);
> -	synchronize_rcu();
> 
>  	module_put(handler->module);

Thanks Li RongQing

Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>

@Heiko/@Vasily/@Alexander will you pick this?

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

* Re: [PATCH] s390/pkey: Remove synchronize_rcu from pkey_handler_register
  2026-03-13  8:32 ` Harald Freudenberger
@ 2026-03-13  9:06   ` Heiko Carstens
  2026-03-13  9:39     ` Harald Freudenberger
  0 siblings, 1 reply; 6+ messages in thread
From: Heiko Carstens @ 2026-03-13  9:06 UTC (permalink / raw)
  To: Harald Freudenberger
  Cc: lirongqing, Holger Dengler, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, linux-s390

On Fri, Mar 13, 2026 at 09:32:39AM +0100, Harald Freudenberger wrote:
> On 2026-03-13 06:23, lirongqing wrote:
> > From: Li RongQing <lirongqing@baidu.com>
> > 
> > The synchronize_rcu() call after adding a handler to the handler_list
> > is redundant because RCU readers will either see the old list or the
> > new list. Removing this synchronization point reduces the blocking
> > time during handler registration.
> > 
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > ---
> >  drivers/s390/crypto/pkey_base.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/s390/crypto/pkey_base.c
> > b/drivers/s390/crypto/pkey_base.c
> > index d60cd98..c2e29d6 100644
> > --- a/drivers/s390/crypto/pkey_base.c
> > +++ b/drivers/s390/crypto/pkey_base.c
> > @@ -60,7 +60,6 @@ int pkey_handler_register(struct pkey_handler
> > *handler)
> > 
> >  	list_add_rcu(&handler->list, &handler_list);
> >  	spin_unlock(&handler_list_write_lock);
> > -	synchronize_rcu();
> > 
> >  	module_put(handler->module);
> 
> Thanks Li RongQing
> 
> Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>

With synchronize_rcu() you do know that other CPUs will see the new
list after this function returned, without not. Is that ok?

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

* Re: [PATCH] s390/pkey: Remove synchronize_rcu from pkey_handler_register
  2026-03-13  9:06   ` Heiko Carstens
@ 2026-03-13  9:39     ` Harald Freudenberger
  0 siblings, 0 replies; 6+ messages in thread
From: Harald Freudenberger @ 2026-03-13  9:39 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: lirongqing, Holger Dengler, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, linux-s390

On 2026-03-13 10:06, Heiko Carstens wrote:
> On Fri, Mar 13, 2026 at 09:32:39AM +0100, Harald Freudenberger wrote:
>> On 2026-03-13 06:23, lirongqing wrote:
>> > From: Li RongQing <lirongqing@baidu.com>
>> >
>> > The synchronize_rcu() call after adding a handler to the handler_list
>> > is redundant because RCU readers will either see the old list or the
>> > new list. Removing this synchronization point reduces the blocking
>> > time during handler registration.
>> >
>> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
>> > ---
>> >  drivers/s390/crypto/pkey_base.c | 1 -
>> >  1 file changed, 1 deletion(-)
>> >
>> > diff --git a/drivers/s390/crypto/pkey_base.c
>> > b/drivers/s390/crypto/pkey_base.c
>> > index d60cd98..c2e29d6 100644
>> > --- a/drivers/s390/crypto/pkey_base.c
>> > +++ b/drivers/s390/crypto/pkey_base.c
>> > @@ -60,7 +60,6 @@ int pkey_handler_register(struct pkey_handler
>> > *handler)
>> >
>> >  	list_add_rcu(&handler->list, &handler_list);
>> >  	spin_unlock(&handler_list_write_lock);
>> > -	synchronize_rcu();
>> >
>> >  	module_put(handler->module);
>> 
>> Thanks Li RongQing
>> 
>> Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
> 
> With synchronize_rcu() you do know that other CPUs will see the new
> list after this function returned, without not. Is that ok?

No - If this has side effects then I'll discuss this with you and
then may also run some tests - so please hold back until I'll give
a green light on this. Thanks for this hint.

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

* Re: [PATCH] s390/pkey: Remove synchronize_rcu from pkey_handler_register
  2026-03-13  5:23 [PATCH] s390/pkey: Remove synchronize_rcu from pkey_handler_register lirongqing
  2026-03-13  8:32 ` Harald Freudenberger
@ 2026-03-16  9:35 ` Harald Freudenberger
  2026-03-16  9:54   ` 答复: [????] " Li,Rongqing(ACG CCN)
  1 sibling, 1 reply; 6+ messages in thread
From: Harald Freudenberger @ 2026-03-16  9:35 UTC (permalink / raw)
  To: lirongqing
  Cc: Holger Dengler, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, linux-s390

On 2026-03-13 06:23, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
> 
> The synchronize_rcu() call after adding a handler to the handler_list
> is redundant because RCU readers will either see the old list or the
> new list. Removing this synchronization point reduces the blocking
> time during handler registration.
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>  drivers/s390/crypto/pkey_base.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/s390/crypto/pkey_base.c 
> b/drivers/s390/crypto/pkey_base.c
> index d60cd98..c2e29d6 100644
> --- a/drivers/s390/crypto/pkey_base.c
> +++ b/drivers/s390/crypto/pkey_base.c
> @@ -60,7 +60,6 @@ int pkey_handler_register(struct pkey_handler 
> *handler)
> 
>  	list_add_rcu(&handler->list, &handler_list);
>  	spin_unlock(&handler_list_write_lock);
> -	synchronize_rcu();
> 
>  	module_put(handler->module);

After some deep dive into RCU, and some code review with Holger we
decided to leave this statement in the code: This is the fast path to
push the info about the updated list to the other cpus. If removed, the
other cpus may get the updated list when the RCU context is synched. As
this code is in general not performance critical and the list update
more or less only occurs at the early time in system startup the focus
is on concurrency versus performance. Maybe I'll add a comment onto
this code line...

Thanks Li RongQing for your patch and suggestions.

Harald Freudenberger

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

* 答复: [????] Re: [PATCH] s390/pkey: Remove synchronize_rcu from pkey_handler_register
  2026-03-16  9:35 ` Harald Freudenberger
@ 2026-03-16  9:54   ` Li,Rongqing(ACG CCN)
  0 siblings, 0 replies; 6+ messages in thread
From: Li,Rongqing(ACG CCN) @ 2026-03-16  9:54 UTC (permalink / raw)
  To: freude@linux.ibm.com
  Cc: Holger Dengler, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, linux-s390@vger.kernel.org

> After some deep dive into RCU, and some code review with Holger we decided to
> leave this statement in the code: This is the fast path to push the info about the
> updated list to the other cpus. If removed, the other cpus may get the updated
> list when the RCU context is synched. As this code is in general not performance
> critical and the list update more or less only occurs at the early time in system
> startup the focus is on concurrency versus performance. Maybe I'll add a
> comment onto this code line...
> 

Thanks for explanation, I think a comment is needed
sorry for noise.

[Li,Rongqing] 



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

end of thread, other threads:[~2026-03-16  9:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-13  5:23 [PATCH] s390/pkey: Remove synchronize_rcu from pkey_handler_register lirongqing
2026-03-13  8:32 ` Harald Freudenberger
2026-03-13  9:06   ` Heiko Carstens
2026-03-13  9:39     ` Harald Freudenberger
2026-03-16  9:35 ` Harald Freudenberger
2026-03-16  9:54   ` 答复: [????] " Li,Rongqing(ACG CCN)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox