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


Groups > linux.kernel > #1349194

Re: [tip:smp/hotplug] cpu/hotplug: Plug death reporting race

From "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [tip:smp/hotplug] cpu/hotplug: Plug death reporting race
Date 2016-03-03 15:20 +0100
Message-ID <r8CgG-8cy-5@gated-at.bofh.it> (permalink)
References <r8lpx-4I9-15@gated-at.bofh.it> <r8ymJ-5pr-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Mar 03, 2016 at 02:03:35AM -0800, tip-bot for Thomas Gleixner wrote:
> Commit-ID:  71f87b2fc64c2e9b6d53cb817f28711b959d3dfe
> Gitweb:     http://git.kernel.org/tip/71f87b2fc64c2e9b6d53cb817f28711b959d3dfe
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Thu, 3 Mar 2016 10:52:10 +0100
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Thu, 3 Mar 2016 10:52:10 +0100
> 
> cpu/hotplug: Plug death reporting race
> 
> Paul noticed that the conversion of the death reporting introduced a race
> where the outgoing cpu might be delayed after waking the controll processor,
> so it might not be able to call rcu_report_dead() before being physically
> removed, leading to RCU stalls.
> 
> We cant call complete after rcu_report_dead(), so instead of going back to
> busy polling, simply issue a function call to do the completion.
> 
> Fixes: 27d50c7eeb0f "rcu: Make CPU_DYING_IDLE an explicit call"
> Reported-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Link: http://lkml.kernel.org/r/20160302201127.GA23440@linux.vnet.ibm.com
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Acked-by: Peter Zijlstra <peterz@infradead.org>

There are some possible issues with printk()s from WARN_ON() calls
using RCU from within smp_call_function_single(), but in normal
execution this should be OK.  Besides, the WARN_ON() contains a
cpu_online(this_cpu), so it simply won't fire in this case.

So nice fix!!!

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> ---
>  kernel/cpu.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index ff8059b..93e9d89 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -755,14 +755,26 @@ static int notify_dead(unsigned int cpu)
>  	return 0;
>  }
> 
> +static void cpuhp_complete_idle_dead(void *arg)
> +{
> +	struct cpuhp_cpu_state *st = arg;
> +
> +	complete(&st->done);
> +}
> +
>  void cpuhp_report_idle_dead(void)
>  {
>  	struct cpuhp_cpu_state *st = this_cpu_ptr(&cpuhp_state);
> 
>  	BUG_ON(st->state != CPUHP_AP_OFFLINE);
> -	st->state = CPUHP_AP_IDLE_DEAD;
> -	complete(&st->done);
>  	rcu_report_dead(smp_processor_id());
> +	st->state = CPUHP_AP_IDLE_DEAD;
> +	/*
> +	 * We cannot call complete after rcu_report_dead() so we delegate it
> +	 * to an online cpu.
> +	 */
> +	smp_call_function_single(cpumask_first(cpu_online_mask),
> +				 cpuhp_complete_idle_dead, st, 0);
>  }
> 
>  #else
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[patch 00/20] cpu/hotplug: Core infrastructure for cpu hotplug rework Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
  [patch 14/20] cpu/hotplug: Split out the state walk into functions Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Split out the state walk into  functions tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
  [patch 17/20] arch/hotplug: Call into idle with a proper state Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] arch/hotplug: Call into idle with a proper state tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
  [patch 04/20] cpu/hotplug: Split out cpu down functions Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Split out cpu down functions tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
      Re: [tip:smp/hotplug] cpu/hotplug: Split out cpu down functions "Srivatsa S. Bhat" <srivatsa@csail.mit.edu> - 2016-03-03 00:10 +0100
  [patch 03/20] cpu/hotplug: Restructure cpu_up code Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Restructure cpu_up code tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
      Re: [tip:smp/hotplug] cpu/hotplug: Restructure cpu_up code "Srivatsa S. Bhat" <srivatsa@csail.mit.edu> - 2016-03-03 00:00 +0100
  [patch 16/20] cpu/hotplug: Move online calls to hotplugged cpu Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Move online calls to hotplugged cpu tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
  [patch 02/20] cpu/hotplug: Restructure FROZEN state handling Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Restructure FROZEN state handling tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
      Re: [tip:smp/hotplug] cpu/hotplug: Restructure FROZEN state handling "Srivatsa S. Bhat" <srivatsa@csail.mit.edu> - 2016-03-03 00:10 +0100
      Re: [tip:smp/hotplug] cpu/hotplug: Restructure FROZEN state handling "Srivatsa S. Bhat" <srivatsa@csail.mit.edu> - 2016-03-03 00:50 +0100
  [patch 11/20] cpu/hotplug: Implement setup/removal interface Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Implement setup/removal interface tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
  [patch 12/20] cpu/hotplug: Move scheduler cpu_online notifier to  hotplug core Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Move scheduler cpu_online notifier  to hotplug core tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
  [patch 18/20] cpu/hotplug: Let upcoming cpu bring itself fully up Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Let upcoming cpu bring itself fully  up tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
    Re: [patch 18/20] cpu/hotplug: Let upcoming cpu bring itself fully up Richard Cochran <richardcochran@gmail.com> - 2016-03-02 18:30 +0100
  [patch 15/20] cpu/hotplug: Create hotplug threads Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Create hotplug threads tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
  [patch 09/20] cpu/hotplug: Add sysfs state interface Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Add sysfs state interface tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
      Re: [tip:smp/hotplug] cpu/hotplug: Add sysfs state interface Peter Zijlstra <peterz@infradead.org> - 2016-03-02 13:50 +0100
  [patch 06/20] cpu/hotplug: Convert to a state machine for the control  processor Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Convert to a state machine for the  control processor tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
      Re: [tip:smp/hotplug] cpu/hotplug: Convert to a state machine for  the control processor Peter Zijlstra <peterz@infradead.org> - 2016-03-02 12:30 +0100
  [patch 20/20] rcu: Make CPU_DYING_IDLE an explicit call Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    Re: [patch 20/20] rcu: Make CPU_DYING_IDLE an explicit call "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-02-27 03:20 +0100
      Re: [patch 20/20] rcu: Make CPU_DYING_IDLE an explicit call "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-02-27 03:30 +0100
        Re: [patch 20/20] rcu: Make CPU_DYING_IDLE an explicit call Thomas Gleixner <tglx@linutronix.de> - 2016-02-27 08:50 +0100
          Re: [patch 20/20] rcu: Make CPU_DYING_IDLE an explicit call "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-02-27 12:10 +0100
            Re: [patch 20/20] rcu: Make CPU_DYING_IDLE an explicit call Thomas Gleixner <tglx@linutronix.de> - 2016-02-27 12:40 +0100
              Re: [patch 20/20] rcu: Make CPU_DYING_IDLE an explicit call "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-02-27 17:40 +0100
    [tip:smp/hotplug] rcu: Make CPU_DYING_IDLE an explicit call tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
      Re: [tip:smp/hotplug] rcu: Make CPU_DYING_IDLE an explicit call "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-03-02 21:20 +0100
        Re: [tip:smp/hotplug] rcu: Make CPU_DYING_IDLE an explicit call Thomas Gleixner <tglx@linutronix.de> - 2016-03-03 08:40 +0100
        [tip:smp/hotplug] cpu/hotplug: Plug death reporting race tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-03 11:10 +0100
          Re: [tip:smp/hotplug] cpu/hotplug: Plug death reporting race "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-03-03 15:20 +0100
  [patch 08/20] cpu/hotplug: Hand in target state to _cpu_up/down Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Hand in target state to _cpu_up/down tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
  [patch 19/20] cpu/hotplug: Make wait for dead cpu completion based Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 19:50 +0100
    [tip:smp/hotplug] cpu/hotplug: Make wait for dead cpu completion  based tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
  [patch 07/20] cpu/hotplug: Convert the hotplugged cpu work to a state  machine Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 20:00 +0100
    [tip:smp/hotplug] cpu/hotplug: Convert the hotplugged cpu work to a  state machine tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-03-01 21:00 +0100
  [patch 01/20] idle: Move x86ism out of generic code Thomas Gleixner <tglx@linutronix.de> - 2016-02-26 20:00 +0100
    Re: [patch 01/20] idle: Move x86ism out of generic code Brian Gerst <brgerst@gmail.com> - 2016-02-27 21:30 +0100
      Re: [patch 01/20] idle: Move x86ism out of generic code Thomas Gleixner <tglx@linutronix.de> - 2016-02-29 20:40 +0100
        Re: [patch 01/20] idle: Move x86ism out of generic code Will Deacon <will.deacon@arm.com> - 2016-02-29 20:50 +0100
          Re: [patch 01/20] idle: Move x86ism out of generic code Thomas Gleixner <tglx@linutronix.de> - 2016-02-29 21:10 +0100

csiph-web