linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Redfearn <matt.redfearn@imgtec.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: <linux-mips@linux-mips.org>,
	Matt Redfearn <matt.redfearn@imgtec.com>,
	Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@nokia.com>,
	Marcin Nowakowski <marcin.nowakowski@imgtec.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	<linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@kernel.org>,
	Paul Burton <paul.burton@imgtec.com>
Subject: [PATCH] MIPS: Revert "MIPS: Fix race on setting and getting cpu_online_mask"
Date: Wed, 23 Aug 2017 09:21:15 +0100	[thread overview]
Message-ID: <1503476475-21069-1-git-send-email-matt.redfearn@imgtec.com> (raw)

Commit 6f542ebeaee0 ("MIPS: Fix race on setting and getting
cpu_online_mask") effectively reverted commit 8f46cca1e6c06 ("MIPS: SMP:
Fix possibility of deadlock when bringing CPUs online") and thus has
reinstated the possibility of deadlock.

The commit was based on testing of kernel v4.4, where the CPU hotplug
code issued a BUG() if the starting CPU is not marked online when the
boot CPU returns from __cpu_up. The commit fixes this race, but
re-introduces the deadlock situation.

As noted in the commit message, upstream differs in this area. The
hotplug code now waits on a completion event in bringup_wait_for_ap,
which is set by the starting CPU in cpuhp_online_idle once it calls
cpu_startup_entry. Thus there is no possibility of a race in upstream,
and this commit has only re-introduced the deadlock condition, which can
be observed on multiple platforms when running a heavy load test at the
same time as hotplugging CPUs. See commit 8f46cca1e6c06 ("MIPS: SMP: Fix
possibility of deadlock when bringing CPUs online") for details.

This reverts commit 6f542ebeaee0ee552a902ce3892220fc22c7ec8e.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
CC: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@nokia.com>
---

 arch/mips/kernel/smp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 25f6877ce464..603963e1d8e7 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -383,6 +383,9 @@ asmlinkage void start_secondary(void)
 	cpumask_set_cpu(cpu, &cpu_coherent_mask);
 	notify_cpu_starting(cpu);
 
+	complete(&cpu_running);
+	synchronise_count_slave(cpu);
+
 	set_cpu_online(cpu, true);
 
 	set_cpu_sibling_map(cpu);
@@ -390,9 +393,6 @@ asmlinkage void start_secondary(void)
 
 	calculate_cpu_foreign_map();
 
-	complete(&cpu_running);
-	synchronise_count_slave(cpu);
-
 	/*
 	 * irq will be enabled in ->smp_finish(), enabling it too early
 	 * is dangerous.
-- 
2.7.4

             reply	other threads:[~2017-08-23  8:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23  8:21 Matt Redfearn [this message]
2017-08-28 10:07 ` [PATCH] MIPS: Revert "MIPS: Fix race on setting and getting cpu_online_mask" Matija Glavinic Pecotic
2017-08-29  1:43   ` Huacai Chen
2017-08-30 13:24     ` Matt Redfearn
2017-08-31  7:03       ` Huacai Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503476475-21069-1-git-send-email-matt.redfearn@imgtec.com \
    --to=matt.redfearn@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=marcin.nowakowski@imgtec.com \
    --cc=matija.glavinic-pecotic.ext@nokia.com \
    --cc=mingo@kernel.org \
    --cc=paul.burton@imgtec.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).