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


Groups > linux.kernel > #1423478 > unrolled thread

[PATCH tip/core/rcu 0/12] Miscellaneous RCU fixes for 4.8

Started by"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
First post2016-06-15 23:50 +0200
Last post2016-06-16 01:00 +0200
Articles 4 on this page of 24 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH tip/core/rcu 0/12] Miscellaneous RCU fixes for 4.8 "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-15 23:50 +0200
    [PATCH tip/core/rcu 10/12] rcu: Fix a typo in a comment "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-15 23:50 +0200
    [PATCH tip/core/rcu 07/12] rcu: No ordering for rcu_assign_pointer() of NULL "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-15 23:50 +0200
      Re: [PATCH tip/core/rcu 07/12] rcu: No ordering for  rcu_assign_pointer() of NULL Peter Zijlstra <peterz@infradead.org> - 2016-06-16 00:10 +0200
        Re: [PATCH tip/core/rcu 07/12] rcu: No ordering for  rcu_assign_pointer() of NULL Peter Zijlstra <peterz@infradead.org> - 2016-06-16 00:20 +0200
          Re: [PATCH tip/core/rcu 07/12] rcu: No ordering for  rcu_assign_pointer() of NULL "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:50 +0200
    [PATCH tip/core/rcu 02/12] rcu: Fix outdated hotplug-exclusion comment in rcu_gp_init() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-15 23:50 +0200
    [PATCH tip/core/rcu 03/12] rcu: Remove some superfluous lines "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-15 23:50 +0200
    [PATCH tip/core/rcu 04/12] rcu: Move expedited code from tree.c to tree_exp.h "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-15 23:50 +0200
      Re: [PATCH tip/core/rcu 04/12] rcu: Move expedited code from tree.c  to tree_exp.h Peter Zijlstra <peterz@infradead.org> - 2016-06-16 00:10 +0200
        Re: [PATCH tip/core/rcu 04/12] rcu: Move expedited code from tree.c  to tree_exp.h "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:20 +0200
      Re: [PATCH tip/core/rcu 04/12] rcu: Move expedited code from tree.c  to tree_exp.h Pranith Kumar <bobby.prani@gmail.com> - 2016-06-17 17:50 +0200
        Re: [PATCH tip/core/rcu 04/12] rcu: Move expedited code from tree.c  to tree_exp.h "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-17 19:50 +0200
    [PATCH tip/core/rcu 12/12] rcu: Correctly handle sparse possible cpus "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-15 23:50 +0200
    [PATCH tip/core/rcu 08/12] rcu: Disable TASKS_RCU for usermode Linux "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-15 23:50 +0200
      Re: [PATCH tip/core/rcu 08/12] rcu: Disable TASKS_RCU for usermode  Linux Richard Weinberger <richard@nod.at> - 2016-06-15 23:50 +0200
    [PATCH tip/core/rcu 06/12] rcu: Document RCU_NONIDLE() restrictions in comment header "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-15 23:50 +0200
    [PATCH tip/core/rcu 11/12] rcu: sysctl: Panic on RCU Stall "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-15 23:50 +0200
    [PATCH tip/core/rcu 05/12] rcu: Move expedited code from tree_plugin.h to tree_exp.h "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:00 +0200
    [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:00 +0200
      Re: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate  first call with irqs disabled Peter Zijlstra <peterz@infradead.org> - 2016-06-16 00:20 +0200
        Re: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate  first call with irqs disabled "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 01:00 +0200
      Re: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate  first call with irqs disabled Peter Zijlstra <peterz@infradead.org> - 2016-06-16 00:20 +0200
        Re: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate  first call with irqs disabled "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 01:00 +0200

Page 2 of 2 — ← Prev page 1 [2]


#1423527 — Re: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled

FromPeter Zijlstra <peterz@infradead.org>
Date2016-06-16 00:20 +0200
SubjectRe: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled
Message-ID<rKrkd-8p8-19@gated-at.bofh.it>
In reply to#1423511
On Wed, Jun 15, 2016 at 02:46:10PM -0700, Paul E. McKenney wrote:
> Currently, if the very first call to call_rcu_tasks() has irqs disabled,
> it will create the rcu_tasks_kthread with irqs disabled, which will
> result in a splat in the memory allocator, which kthread_run() invokes
> with the expectation that irqs are enabled.
> 
> This commit fixes this problem by deferring kthread creation if called
> with irqs disabled.  The first call to call_rcu_tasks() that has irqs
> enabled will create the kthread.
> 
> This bug was detected by rcutorture changes that were motivated by
> Iftekhar Ahmed's mutation-testing efforts.
> 
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 218f8e83db73..4a3b279beb42 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -2175,7 +2175,7 @@ void task_numa_free(struct task_struct *p)
>  
>  		grp->nr_tasks--;
>  		spin_unlock_irqrestore(&grp->lock, flags);
> -		RCU_INIT_POINTER(p->numa_group, NULL);
> +		rcu_assign_pointer(p->numa_group, NULL);
>  		put_numa_group(grp);
>  	}

This seems entirely unrelated; albeit desired given that other patch.

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


#1423566 — Re: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2016-06-16 01:00 +0200
SubjectRe: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled
Message-ID<rKrWW-aR-11@gated-at.bofh.it>
In reply to#1423527
On Thu, Jun 16, 2016 at 12:15:14AM +0200, Peter Zijlstra wrote:
> On Wed, Jun 15, 2016 at 02:46:10PM -0700, Paul E. McKenney wrote:
> > Currently, if the very first call to call_rcu_tasks() has irqs disabled,
> > it will create the rcu_tasks_kthread with irqs disabled, which will
> > result in a splat in the memory allocator, which kthread_run() invokes
> > with the expectation that irqs are enabled.
> > 
> > This commit fixes this problem by deferring kthread creation if called
> > with irqs disabled.  The first call to call_rcu_tasks() that has irqs
> > enabled will create the kthread.
> > 
> > This bug was detected by rcutorture changes that were motivated by
> > Iftekhar Ahmed's mutation-testing efforts.
> > 
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 218f8e83db73..4a3b279beb42 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -2175,7 +2175,7 @@ void task_numa_free(struct task_struct *p)
> >  
> >  		grp->nr_tasks--;
> >  		spin_unlock_irqrestore(&grp->lock, flags);
> > -		RCU_INIT_POINTER(p->numa_group, NULL);
> > +		rcu_assign_pointer(p->numa_group, NULL);
> >  		put_numa_group(grp);
> >  	}
> 
> This seems entirely unrelated; albeit desired given that other patch.

Yikes!

As you probably guessed, this was my test case for rcu_assign_pointer(NULL),
and I clearly failed to clean up after myself.  It turns out that more than
30 few rcu_assign_pointer(NULL) instances have been added in the meantime,
several of which look to be in popular core code.  So some testing will
happen.

But if you would like to have your code to also participate in this testing
effort, here is that patch standalone.

							Thanx, Paul

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

commit 0f11d148dfdb67b55efdc72a1a959c8e44c5d54c
Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Date:   Wed Jun 15 15:52:25 2016 -0700

    sched: Switch from RCU_INIT_POINTER() to rcu_assign_pointer()
    
    Given that rcu_assign_pointer() now avoids providing memory ordering
    when the value assigned is the constant NULL, this commit switches
    task_numa_free() from RCU_INIT_POINTER() to rcu_assign_pointer().
    
    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 218f8e83db73..4a3b279beb42 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2175,7 +2175,7 @@ void task_numa_free(struct task_struct *p)
 
 		grp->nr_tasks--;
 		spin_unlock_irqrestore(&grp->lock, flags);
-		RCU_INIT_POINTER(p->numa_group, NULL);
+		rcu_assign_pointer(p->numa_group, NULL);
 		put_numa_group(grp);
 	}
 

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


#1423536 — Re: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled

FromPeter Zijlstra <peterz@infradead.org>
Date2016-06-16 00:20 +0200
SubjectRe: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled
Message-ID<rKrke-8p8-49@gated-at.bofh.it>
In reply to#1423511
On Wed, Jun 15, 2016 at 02:46:10PM -0700, Paul E. McKenney wrote:
> Currently, if the very first call to call_rcu_tasks() has irqs disabled,
> it will create the rcu_tasks_kthread with irqs disabled, which will
> result in a splat in the memory allocator, which kthread_run() invokes
> with the expectation that irqs are enabled.
> 
> This commit fixes this problem by deferring kthread creation if called
> with irqs disabled.  The first call to call_rcu_tasks() that has irqs
> enabled will create the kthread.
> 
> This bug was detected by rcutorture changes that were motivated by
> Iftekhar Ahmed's mutation-testing efforts.

Seems fragile. What if someone manages to only use call_rcu_tasks() with
IRQs disabled?

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


#1423567 — Re: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2016-06-16 01:00 +0200
SubjectRe: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled
Message-ID<rKrWW-aR-19@gated-at.bofh.it>
In reply to#1423536
On Thu, Jun 16, 2016 at 12:16:04AM +0200, Peter Zijlstra wrote:
> On Wed, Jun 15, 2016 at 02:46:10PM -0700, Paul E. McKenney wrote:
> > Currently, if the very first call to call_rcu_tasks() has irqs disabled,
> > it will create the rcu_tasks_kthread with irqs disabled, which will
> > result in a splat in the memory allocator, which kthread_run() invokes
> > with the expectation that irqs are enabled.
> > 
> > This commit fixes this problem by deferring kthread creation if called
> > with irqs disabled.  The first call to call_rcu_tasks() that has irqs
> > enabled will create the kthread.
> > 
> > This bug was detected by rcutorture changes that were motivated by
> > Iftekhar Ahmed's mutation-testing efforts.
> 
> Seems fragile. What if someone manages to only use call_rcu_tasks() with
> IRQs disabled?

It would have to have users before that could possibly happen.  :-/
And it would not be hard to remove the fragility if needed by setting
up a workqueue, possibly mediated by a timer or whatever.  But it is
hard to motivate myself to do so in advance of users.  For that matter...

Steven, is call_rcu_tasks() needed, or should I just rip it out?

							Thanx, Paul

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web