Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1625494 > unrolled thread

[PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback invocation

Started by"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
First post2017-04-18 19:40 +0200
Last post2017-04-18 20:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback invocation "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-18 19:40 +0200
    Re: [PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback  invocation Marc Zyngier <marc.zyngier@arm.com> - 2017-04-18 19:50 +0200
      Re: [PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback  invocation "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-18 20:00 +0200

#1625494 — [PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback invocation

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2017-04-18 19:40 +0200
Subject[PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback invocation
Message-ID<txFgC-un-21@gated-at.bofh.it>
Although Tree SRCU does reduce delays when there is at least one
synchronize_srcu_expedited() invocation pending, srcu_schedule_cbs_snp()
still waits for SRCU_INTERVAL before invoking callbacks.  Since
synchronize_srcu_expedited() now posts a callback and waits for
that callback to do a wakeup, this destroys the expedited nature of
synchronize_srcu_expedited().

This commit therefore invokes callbacks immediately at the end of the
grace period when there is at least one synchronize_srcu_expedited()
invocation pending.

Reported-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index 1e54f91c2ff7..744ffdb79d23 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -447,7 +447,8 @@ static void srcu_schedule_cbs_snp(struct srcu_struct *sp, struct srcu_node *snp)
 	int cpu;
 
 	for (cpu = snp->grplo; cpu <= snp->grphi; cpu++)
-		srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu), SRCU_INTERVAL);
+		srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu),
+				      atomic_read(&sp->srcu_exp_cnt) ? 0 : SRCU_INTERVAL);
 }
 
 /*

[toc] | [next] | [standalone]


#1625499 — Re: [PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback invocation

FromMarc Zyngier <marc.zyngier@arm.com>
Date2017-04-18 19:50 +0200
SubjectRe: [PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback invocation
Message-ID<txFqh-xI-3@gated-at.bofh.it>
In reply to#1625494
On 18/04/17 18:33, Paul E. McKenney wrote:
> Although Tree SRCU does reduce delays when there is at least one
> synchronize_srcu_expedited() invocation pending, srcu_schedule_cbs_snp()
> still waits for SRCU_INTERVAL before invoking callbacks.  Since
> synchronize_srcu_expedited() now posts a callback and waits for
> that callback to do a wakeup, this destroys the expedited nature of
> synchronize_srcu_expedited().
> 
> This commit therefore invokes callbacks immediately at the end of the
> grace period when there is at least one synchronize_srcu_expedited()
> invocation pending.
> 
> Reported-by: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 
> diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> index 1e54f91c2ff7..744ffdb79d23 100644
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -447,7 +447,8 @@ static void srcu_schedule_cbs_snp(struct srcu_struct *sp, struct srcu_node *snp)
>  	int cpu;
>  
>  	for (cpu = snp->grplo; cpu <= snp->grphi; cpu++)
> -		srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu), SRCU_INTERVAL);
> +		srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu),
> +				      atomic_read(&sp->srcu_exp_cnt) ? 0 : SRCU_INTERVAL);
>  }
>  
>  /*

This fixes the issue I was observing, where UEFI in a KVM guest would
take a x8 slowdown while it messes with some NOR flash emulation on
arm64 (don't ask, this is horrible...). Anyway:

Tested-by: Marc Zyngier <marc.zyngier@arm.com>

Thanks again Paul!

	M.
-- 
Jazz is not dead. It just smells funny...

[toc] | [prev] | [next] | [standalone]


#1625503 — Re: [PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback invocation

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2017-04-18 20:00 +0200
SubjectRe: [PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback invocation
Message-ID<txFzY-AR-3@gated-at.bofh.it>
In reply to#1625499
On Tue, Apr 18, 2017 at 06:43:05PM +0100, Marc Zyngier wrote:
> On 18/04/17 18:33, Paul E. McKenney wrote:
> > Although Tree SRCU does reduce delays when there is at least one
> > synchronize_srcu_expedited() invocation pending, srcu_schedule_cbs_snp()
> > still waits for SRCU_INTERVAL before invoking callbacks.  Since
> > synchronize_srcu_expedited() now posts a callback and waits for
> > that callback to do a wakeup, this destroys the expedited nature of
> > synchronize_srcu_expedited().
> > 
> > This commit therefore invokes callbacks immediately at the end of the
> > grace period when there is at least one synchronize_srcu_expedited()
> > invocation pending.
> > 
> > Reported-by: Marc Zyngier <marc.zyngier@arm.com>
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > 
> > diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> > index 1e54f91c2ff7..744ffdb79d23 100644
> > --- a/kernel/rcu/srcutree.c
> > +++ b/kernel/rcu/srcutree.c
> > @@ -447,7 +447,8 @@ static void srcu_schedule_cbs_snp(struct srcu_struct *sp, struct srcu_node *snp)
> >  	int cpu;
> >  
> >  	for (cpu = snp->grplo; cpu <= snp->grphi; cpu++)
> > -		srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu), SRCU_INTERVAL);
> > +		srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu),
> > +				      atomic_read(&sp->srcu_exp_cnt) ? 0 : SRCU_INTERVAL);
> >  }
> >  
> >  /*
> 
> This fixes the issue I was observing, where UEFI in a KVM guest would
> take a x8 slowdown while it messes with some NOR flash emulation on
> arm64 (don't ask, this is horrible...). Anyway:
> 
> Tested-by: Marc Zyngier <marc.zyngier@arm.com>
> 
> Thanks again Paul!

Thank you for your bug-finding and testing efforts!  I will be pushing
this into the upcoming merge window.

							Thanx, Paul

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

commit 6eec94fe40e294b04d32c8ef552e28fa6159bdad
Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Date:   Tue Apr 18 10:28:31 2017 -0700

    srcu: Expedite srcu_schedule_cbs_snp() callback invocation
    
    Although Tree SRCU does reduce delays when there is at least one
    synchronize_srcu_expedited() invocation pending, srcu_schedule_cbs_snp()
    still waits for SRCU_INTERVAL before invoking callbacks.  Since
    synchronize_srcu_expedited() now posts a callback and waits for
    that callback to do a wakeup, this destroys the expedited nature of
    synchronize_srcu_expedited().  This destruction became apparent to
    Marc Zyngier in the guise of a guest-OS bootup slowdown from five
    seconds to no fewer than forty seconds.
    
    This commit therefore invokes callbacks immediately at the end of the
    grace period when there is at least one synchronize_srcu_expedited()
    invocation pending.  This brought Marc's guest-OS bootup times back
    into the realm of reason.
    
    Reported-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Tested-by: Marc Zyngier <marc.zyngier@arm.com>

diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index 1e54f91c2ff7..744ffdb79d23 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -447,7 +447,8 @@ static void srcu_schedule_cbs_snp(struct srcu_struct *sp, struct srcu_node *snp)
 	int cpu;
 
 	for (cpu = snp->grplo; cpu <= snp->grphi; cpu++)
-		srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu), SRCU_INTERVAL);
+		srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu),
+				      atomic_read(&sp->srcu_exp_cnt) ? 0 : SRCU_INTERVAL);
 }
 
 /*

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web