diff mbox

[3.13.y-ckt,stable] Patch "powerpc: Secondary CPUs must set cpu_callin_map after setting active and online" has been added to staging queue

Message ID 1422483604-13203-1-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa Jan. 28, 2015, 10:20 p.m. UTC
This is a note to let you know that I have just added a patch titled

    powerpc: Secondary CPUs must set cpu_callin_map after setting active and online

to the linux-3.13.y-queue branch of the 3.13.y-ckt extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.13.y-queue

This patch is scheduled to be released in version 3.13.11-ckt15.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

From 9b59325c3e5ea9f9b926e475dd9ae9bf0ffa170f Mon Sep 17 00:00:00 2001
From: Anton Blanchard <anton@samba.org>
Date: Tue, 9 Dec 2014 10:58:19 +1100
Subject: powerpc: Secondary CPUs must set cpu_callin_map after setting active
 and online

commit 7c5c92ed56d932b2c19c3f8aea86369509407d33 upstream.

I have a busy ppc64le KVM box where guests sometimes hit the infamous
"kernel BUG at kernel/smpboot.c:134!" issue during boot:

  BUG_ON(td->cpu != smp_processor_id());

Basically a per CPU hotplug thread scheduled on the wrong CPU. The oops
output confirms it:

  CPU: 0
  Comm: watchdog/130

The problem is that we aren't ensuring the CPU active and online bits are set
before allowing the master to continue on. The master unparks the secondary
CPUs kthreads and the scheduler looks for a CPU to run on. It calls
select_task_rq and realises the suggested CPU is not in the cpus_allowed
mask. It then ends up in select_fallback_rq, and since the active and
online bits aren't set we choose some other CPU to run on.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/powerpc/kernel/smp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--
1.9.1

Comments

Michael Ellerman Jan. 29, 2015, 12:35 a.m. UTC | #1
On Wed, 2015-01-28 at 14:20 -0800, Kamal Mostafa wrote:
> This is a note to let you know that I have just added a patch titled
> 
>     powerpc: Secondary CPUs must set cpu_callin_map after setting active and online
> 
> to the linux-3.13.y-queue branch of the 3.13.y-ckt extended stable tree 
> which can be found at:
> 
>  http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.13.y-queue
> 
> This patch is scheduled to be released in version 3.13.11-ckt15.
> 
> If you, or anyone else, feels it should not be added to this tree, please 
> reply to this email.

Please drop this patch.

It's been reverted upstream, by me.

cheers
Kamal Mostafa Jan. 29, 2015, 6:42 p.m. UTC | #2
On Thu, 2015-01-29 at 11:35 +1100, Michael Ellerman wrote:
> On Wed, 2015-01-28 at 14:20 -0800, Kamal Mostafa wrote:
> > This is a note to let you know that I have just added a patch titled
> > 
> >     powerpc: Secondary CPUs must set cpu_callin_map after setting active and online
> > 
> Please drop this patch.
> 
> It's been reverted upstream, by me.

Okay, dropped from 3.13-stable.  Thanks Michael.

 -Kamal
diff mbox

Patch

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index c1cf4a1..a2802c1 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -712,7 +712,6 @@  void start_secondary(void *unused)
 	smp_store_cpu_info(cpu);
 	set_dec(tb_ticks_per_jiffy);
 	preempt_disable();
-	cpu_callin_map[cpu] = 1;

 	if (smp_ops->setup_cpu)
 		smp_ops->setup_cpu(cpu);
@@ -748,6 +747,14 @@  void start_secondary(void *unused)
 	notify_cpu_starting(cpu);
 	set_cpu_online(cpu, true);

+	/*
+	 * CPU must be marked active and online before we signal back to the
+	 * master, because the scheduler needs to see the cpu_online and
+	 * cpu_active bits set.
+	 */
+	smp_wmb();
+	cpu_callin_map[cpu] = 1;
+
 	local_irq_enable();

 	cpu_startup_entry(CPUHP_ONLINE);