linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH tip/core/rcu 7/9] arm64: Use common outgoing-CPU-notification code
       [not found] ` <1431467407-1223-1-git-send-email-paulmck@linux.vnet.ibm.com>
@ 2015-05-12 21:50   ` Paul E. McKenney
  2015-05-21  8:58     ` Will Deacon
  2015-05-12 21:50   ` [PATCH tip/core/rcu 8/9] arm: " Paul E. McKenney
  1 sibling, 1 reply; 7+ messages in thread
From: Paul E. McKenney @ 2015-05-12 21:50 UTC (permalink / raw)
  To: linux-arm-kernel

From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>

This commit removes the open-coded CPU-offline notification with new
common code.  In particular, this change avoids calling scheduler code
using RCU from an offline CPU that RCU is ignoring.  This is a minimal
change.  A more intrusive change might invoke the cpu_check_up_prepare()
and cpu_set_state_online() functions at CPU-online time, which would
allow onlining throw an error if the CPU did not go offline properly.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/kernel/smp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 2cb008177252..a899c1beff54 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -253,15 +253,13 @@ static int op_cpu_kill(unsigned int cpu)
 	return cpu_ops[cpu]->cpu_kill(cpu);
 }
 
-static DECLARE_COMPLETION(cpu_died);
-
 /*
  * called on the thread which is asking for a CPU to be shutdown -
  * waits until shutdown has completed, or it is timed out.
  */
 void __cpu_die(unsigned int cpu)
 {
-	if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
+	if (!cpu_wait_death(cpu, 5)) {
 		pr_crit("CPU%u: cpu didn't die\n", cpu);
 		return;
 	}
@@ -294,7 +292,7 @@ void cpu_die(void)
 	local_irq_disable();
 
 	/* Tell __cpu_die() that this CPU is now safe to dispose of */
-	complete(&cpu_died);
+	(void)cpu_report_death();
 
 	/*
 	 * Actually shutdown the CPU. This must never fail. The specific hotplug
-- 
1.8.1.5

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

* [PATCH tip/core/rcu 8/9] arm: Use common outgoing-CPU-notification code
       [not found] ` <1431467407-1223-1-git-send-email-paulmck@linux.vnet.ibm.com>
  2015-05-12 21:50   ` [PATCH tip/core/rcu 7/9] arm64: Use common outgoing-CPU-notification code Paul E. McKenney
@ 2015-05-12 21:50   ` Paul E. McKenney
  2015-12-14 12:18     ` Geert Uytterhoeven
  1 sibling, 1 reply; 7+ messages in thread
From: Paul E. McKenney @ 2015-05-12 21:50 UTC (permalink / raw)
  To: linux-arm-kernel

From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>

This commit removes the open-coded CPU-offline notification with new
common code.  In particular, this change avoids calling scheduler code
using RCU from an offline CPU that RCU is ignoring.  This is a minimal
change.  A more intrusive change might invoke the cpu_check_up_prepare()
and cpu_set_state_online() functions at CPU-online time, which would
allow onlining throw an error if the CPU did not go offline properly.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: Russell King <linux@arm.linux.org.uk>
---
 arch/arm/kernel/smp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index cca5b8758185..8ef0ef0287ee 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -218,15 +218,13 @@ int __cpu_disable(void)
 	return 0;
 }
 
-static DECLARE_COMPLETION(cpu_died);
-
 /*
  * called on the thread which is asking for a CPU to be shutdown -
  * waits until shutdown has completed, or it is timed out.
  */
 void __cpu_die(unsigned int cpu)
 {
-	if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
+	if (!cpu_wait_death(cpu, 5)) {
 		pr_err("CPU%u: cpu didn't die\n", cpu);
 		return;
 	}
@@ -272,7 +270,7 @@ void __ref cpu_die(void)
 	 * this returns, power and/or clocks can be removed at any point
 	 * from this CPU and its cache by platform_cpu_kill().
 	 */
-	complete(&cpu_died);
+	(void)cpu_report_death();
 
 	/*
 	 * Ensure that the cache lines associated with that completion are
-- 
1.8.1.5

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

* [PATCH tip/core/rcu 7/9] arm64: Use common outgoing-CPU-notification code
  2015-05-12 21:50   ` [PATCH tip/core/rcu 7/9] arm64: Use common outgoing-CPU-notification code Paul E. McKenney
@ 2015-05-21  8:58     ` Will Deacon
  2015-05-21 12:48       ` Paul E. McKenney
  0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2015-05-21  8:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Paul,

Sorry for being late on this one.

On Tue, May 12, 2015 at 10:50:05PM +0100, Paul E. McKenney wrote:
> From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> 
> This commit removes the open-coded CPU-offline notification with new
> common code.  In particular, this change avoids calling scheduler code
> using RCU from an offline CPU that RCU is ignoring.  This is a minimal
> change.  A more intrusive change might invoke the cpu_check_up_prepare()
> and cpu_set_state_online() functions at CPU-online time, which would
> allow onlining throw an error if the CPU did not go offline properly.
> 
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm64/kernel/smp.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

I don't have a better idea, so:

  Acked-by: Will Deacon <will.deacon@arm.com>

Is this queued via -tip already, or can we pick it into the arm64 tree
for 4.2?

Cheers,

Will

> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> index 2cb008177252..a899c1beff54 100644
> --- a/arch/arm64/kernel/smp.c
> +++ b/arch/arm64/kernel/smp.c
> @@ -253,15 +253,13 @@ static int op_cpu_kill(unsigned int cpu)
>  	return cpu_ops[cpu]->cpu_kill(cpu);
>  }
>  
> -static DECLARE_COMPLETION(cpu_died);
> -
>  /*
>   * called on the thread which is asking for a CPU to be shutdown -
>   * waits until shutdown has completed, or it is timed out.
>   */
>  void __cpu_die(unsigned int cpu)
>  {
> -	if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
> +	if (!cpu_wait_death(cpu, 5)) {
>  		pr_crit("CPU%u: cpu didn't die\n", cpu);
>  		return;
>  	}
> @@ -294,7 +292,7 @@ void cpu_die(void)
>  	local_irq_disable();
>  
>  	/* Tell __cpu_die() that this CPU is now safe to dispose of */
> -	complete(&cpu_died);
> +	(void)cpu_report_death();
>  
>  	/*
>  	 * Actually shutdown the CPU. This must never fail. The specific hotplug
> -- 
> 1.8.1.5
> 

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

* [PATCH tip/core/rcu 7/9] arm64: Use common outgoing-CPU-notification code
  2015-05-21  8:58     ` Will Deacon
@ 2015-05-21 12:48       ` Paul E. McKenney
  2015-05-21 13:25         ` Catalin Marinas
  0 siblings, 1 reply; 7+ messages in thread
From: Paul E. McKenney @ 2015-05-21 12:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 21, 2015 at 09:58:06AM +0100, Will Deacon wrote:
> Hi Paul,
> 
> Sorry for being late on this one.

No problem!  In fact, just in time -- I was going to bug you about
this later today.  ;-)

> On Tue, May 12, 2015 at 10:50:05PM +0100, Paul E. McKenney wrote:
> > From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > 
> > This commit removes the open-coded CPU-offline notification with new
> > common code.  In particular, this change avoids calling scheduler code
> > using RCU from an offline CPU that RCU is ignoring.  This is a minimal
> > change.  A more intrusive change might invoke the cpu_check_up_prepare()
> > and cpu_set_state_online() functions at CPU-online time, which would
> > allow onlining throw an error if the CPU did not go offline properly.
> > 
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > Cc: linux-arm-kernel at lists.infradead.org
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > ---
> >  arch/arm64/kernel/smp.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> I don't have a better idea, so:
> 
>   Acked-by: Will Deacon <will.deacon@arm.com>
> 
> Is this queued via -tip already, or can we pick it into the arm64 tree
> for 4.2?

Feel free to take it into the arm64 tree.  Just let me know, and I
will drop it from my tree.

Now I only need to bug the arm32 guys.  ;-)

							Thanx, Paul

> Cheers,
> 
> Will
> 
> > diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> > index 2cb008177252..a899c1beff54 100644
> > --- a/arch/arm64/kernel/smp.c
> > +++ b/arch/arm64/kernel/smp.c
> > @@ -253,15 +253,13 @@ static int op_cpu_kill(unsigned int cpu)
> >  	return cpu_ops[cpu]->cpu_kill(cpu);
> >  }
> >  
> > -static DECLARE_COMPLETION(cpu_died);
> > -
> >  /*
> >   * called on the thread which is asking for a CPU to be shutdown -
> >   * waits until shutdown has completed, or it is timed out.
> >   */
> >  void __cpu_die(unsigned int cpu)
> >  {
> > -	if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
> > +	if (!cpu_wait_death(cpu, 5)) {
> >  		pr_crit("CPU%u: cpu didn't die\n", cpu);
> >  		return;
> >  	}
> > @@ -294,7 +292,7 @@ void cpu_die(void)
> >  	local_irq_disable();
> >  
> >  	/* Tell __cpu_die() that this CPU is now safe to dispose of */
> > -	complete(&cpu_died);
> > +	(void)cpu_report_death();
> >  
> >  	/*
> >  	 * Actually shutdown the CPU. This must never fail. The specific hotplug
> > -- 
> > 1.8.1.5
> > 
> 

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

* [PATCH tip/core/rcu 7/9] arm64: Use common outgoing-CPU-notification code
  2015-05-21 12:48       ` Paul E. McKenney
@ 2015-05-21 13:25         ` Catalin Marinas
  2015-05-22  3:26           ` Paul E. McKenney
  0 siblings, 1 reply; 7+ messages in thread
From: Catalin Marinas @ 2015-05-21 13:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 21, 2015 at 05:48:33AM -0700, Paul E. McKenney wrote:
> On Thu, May 21, 2015 at 09:58:06AM +0100, Will Deacon wrote:
> > On Tue, May 12, 2015 at 10:50:05PM +0100, Paul E. McKenney wrote:
> > > From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > > 
> > > This commit removes the open-coded CPU-offline notification with new
> > > common code.  In particular, this change avoids calling scheduler code
> > > using RCU from an offline CPU that RCU is ignoring.  This is a minimal
> > > change.  A more intrusive change might invoke the cpu_check_up_prepare()
> > > and cpu_set_state_online() functions at CPU-online time, which would
> > > allow onlining throw an error if the CPU did not go offline properly.
> > > 
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > Cc: linux-arm-kernel at lists.infradead.org
> > > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > > Cc: Will Deacon <will.deacon@arm.com>
> > > ---
> > >  arch/arm64/kernel/smp.c | 6 ++----
> > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > I don't have a better idea, so:
> > 
> >   Acked-by: Will Deacon <will.deacon@arm.com>
> > 
> > Is this queued via -tip already, or can we pick it into the arm64 tree
> > for 4.2?
> 
> Feel free to take it into the arm64 tree.  Just let me know, and I
> will drop it from my tree.

Queued for 4.2. Thanks.

-- 
Catalin

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

* [PATCH tip/core/rcu 7/9] arm64: Use common outgoing-CPU-notification code
  2015-05-21 13:25         ` Catalin Marinas
@ 2015-05-22  3:26           ` Paul E. McKenney
  0 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2015-05-22  3:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 21, 2015 at 02:25:57PM +0100, Catalin Marinas wrote:
> On Thu, May 21, 2015 at 05:48:33AM -0700, Paul E. McKenney wrote:
> > On Thu, May 21, 2015 at 09:58:06AM +0100, Will Deacon wrote:
> > > On Tue, May 12, 2015 at 10:50:05PM +0100, Paul E. McKenney wrote:
> > > > From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > > > 
> > > > This commit removes the open-coded CPU-offline notification with new
> > > > common code.  In particular, this change avoids calling scheduler code
> > > > using RCU from an offline CPU that RCU is ignoring.  This is a minimal
> > > > change.  A more intrusive change might invoke the cpu_check_up_prepare()
> > > > and cpu_set_state_online() functions at CPU-online time, which would
> > > > allow onlining throw an error if the CPU did not go offline properly.
> > > > 
> > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > Cc: linux-arm-kernel at lists.infradead.org
> > > > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > > > Cc: Will Deacon <will.deacon@arm.com>
> > > > ---
> > > >  arch/arm64/kernel/smp.c | 6 ++----
> > > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > > 
> > > I don't have a better idea, so:
> > > 
> > >   Acked-by: Will Deacon <will.deacon@arm.com>
> > > 
> > > Is this queued via -tip already, or can we pick it into the arm64 tree
> > > for 4.2?
> > 
> > Feel free to take it into the arm64 tree.  Just let me know, and I
> > will drop it from my tree.
> 
> Queued for 4.2. Thanks.

Very good, dropped from my tree.

							Thanx, Paul

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

* [PATCH tip/core/rcu 8/9] arm: Use common outgoing-CPU-notification code
  2015-05-12 21:50   ` [PATCH tip/core/rcu 8/9] arm: " Paul E. McKenney
@ 2015-12-14 12:18     ` Geert Uytterhoeven
  0 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2015-12-14 12:18 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Paul,

On Tue, May 12, 2015 at 11:50 PM, Paul E. McKenney
<paulmck@linux.vnet.ibm.com> wrote:
> From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
>
> This commit removes the open-coded CPU-offline notification with new
> common code.  In particular, this change avoids calling scheduler code
> using RCU from an offline CPU that RCU is ignoring.  This is a minimal
> change.  A more intrusive change might invoke the cpu_check_up_prepare()
> and cpu_set_state_online() functions at CPU-online time, which would
> allow onlining throw an error if the CPU did not go offline properly.
>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: Russell King <linux@arm.linux.org.uk>

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks, this seems to fix the intermittent "suspicious RCU usage" warnings I've
been seeing during suspend to RAM on r8a7791/koelsch, which has a dual-core
Cortex A15:

    Disabling non-boot CPUs ...

    ===============================
    [ INFO: suspicious RCU usage. ]
    4.4.0-rc4-koelsch #2123 Tainted: G        W
    -------------------------------
    kernel/sched/fair.c:4938 suspicious rcu_dereference_check() usage!

    other info that might help us debug this:

    RCU used illegally from offline CPU!
    rcu_scheduler_active = 1, debug_locks = 0
    3 locks held by swapper/1/0:
     #0:  ((cpu_died).wait.lock){......}, at: [<c006077c>] complete+0x14/0x44
     #1:  (&p->pi_lock){-.-.-.}, at: [<c004b8a8>] try_to_wake_up+0x24/0x340
     #2:  (rcu_read_lock){......}, at: [<c0052740>]
select_task_rq_fair+0xb4/0x820

    stack backtrace:
    CPU: 1 PID: 0 Comm: swapper/1 Tainted: G        W
4.4.0-rc4-koelsch #2123
    Hardware name: Generic R8A7791 (Flattened Device Tree)
    [<c0017390>] (unwind_backtrace) from [<c0013094>] (show_stack+0x10/0x14)
    [<c0013094>] (show_stack) from [<c01ee718>] (dump_stack+0x70/0x8c)
    [<c01ee718>] (dump_stack) from [<c0052810>]
(select_task_rq_fair+0x184/0x820)
    [<c0052810>] (select_task_rq_fair) from [<c004ba54>]
(try_to_wake_up+0x1d0/0x340)
    [<c004ba54>] (try_to_wake_up) from [<c0060070>] (__wake_up_common+0x4c/0x78)
    [<c0060070>] (__wake_up_common) from [<c00600ac>]
(__wake_up_locked+0x10/0x18)
    [<c00600ac>] (__wake_up_locked) from [<c006079c>] (complete+0x34/0x44)
    [<c006079c>] (complete) from [<c00159f8>] (arch_cpu_idle_dead+0x2c/0x8c)
    [<c00159f8>] (arch_cpu_idle_dead) from [<c0060a24>]
(cpu_startup_entry+0x84/0x228)
    [<c0060a24>] (cpu_startup_entry) from [<4000a4ac>] (0x4000a4ac)
    CPU1: shutdown

But I understand from the various other threads about this issue that this
patch is not going upstream, as it papers over the real issue?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2015-12-14 12:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20150512214945.GA813@linux.vnet.ibm.com>
     [not found] ` <1431467407-1223-1-git-send-email-paulmck@linux.vnet.ibm.com>
2015-05-12 21:50   ` [PATCH tip/core/rcu 7/9] arm64: Use common outgoing-CPU-notification code Paul E. McKenney
2015-05-21  8:58     ` Will Deacon
2015-05-21 12:48       ` Paul E. McKenney
2015-05-21 13:25         ` Catalin Marinas
2015-05-22  3:26           ` Paul E. McKenney
2015-05-12 21:50   ` [PATCH tip/core/rcu 8/9] arm: " Paul E. McKenney
2015-12-14 12:18     ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).