All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Redfearn <matt.redfearn@imgtec.com>
To: Huacai Chen <chenhuacai@gmail.com>,
	Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@nokia.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	Linux MIPS Mailing List <linux-mips@linux-mips.org>,
	Marcin Nowakowski <marcin.nowakowski@imgtec.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Paul Burton <paul.burton@imgtec.com>
Subject: Re: [PATCH] MIPS: Revert "MIPS: Fix race on setting and getting cpu_online_mask"
Date: Wed, 30 Aug 2017 14:24:03 +0100	[thread overview]
Message-ID: <7e9037a6-195b-ca0f-75da-5a338c5e938d@imgtec.com> (raw)
In-Reply-To: <CAAhV-H7z82vsvdDc6Hfbp62KM6q72Z_bg6eUFdbK0azU2zmseg@mail.gmail.com>

Hi Huacai,

On 29/08/17 02:43, Huacai Chen wrote:
> I suggest to drop sync_r4k completely, because it is inaccurate. You
> can use IPI to synchronize count/compare instead, as Loongson-3 does.

I am all for a better fix, such as this - but that would be a much more 
invasive change than what I propose. Currently 4.13 is broken by the 
patch that this is attempting to revert. It is easy to deadlock the 
system by hotplugging a CPU while it is busy. That was what my patch 
8f46cca1e6c06 originally fixed. Even though it is, perhaps, not 
stylistically great to have the synchronisation done by callers, the 
fact is that it *is* done (added in 8df3e07e7f21f), so the behavior for 
4.13 would be safe and deadlocks not possible. We can then look at more 
invasive changes that are acceptable to everyone during the 4.14 cycle.

Thanks,
Matt

>
> Huacai
>
> On Mon, Aug 28, 2017 at 6:07 PM, Matija Glavinic Pecotic
> <matija.glavinic-pecotic.ext@nokia.com> wrote:
>> On 08/23/2017 10:21 AM, Matt Redfearn wrote:
>>> 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.
>> I personally do not like the fact that synchronization is implicitly done by the callers, it is the reason why the patch was proposed. As noted before, it is enough someone checks cpu online mask somewhere in between and there is race again.
>>
>> How about moving synchronise_count_slave before setting the cpu online? Is there dependency it has to be done after completion?
>>
>> Regards,
>>
>> Matija
>>

  reply	other threads:[~2017-08-30 13:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23  8:21 [PATCH] MIPS: Revert "MIPS: Fix race on setting and getting cpu_online_mask" Matt Redfearn
2017-08-23  8:21 ` Matt Redfearn
2017-08-28 10:07 ` Matija Glavinic Pecotic
2017-08-29  1:43   ` Huacai Chen
2017-08-30 13:24     ` Matt Redfearn [this message]
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=7e9037a6-195b-ca0f-75da-5a338c5e938d@imgtec.com \
    --to=matt.redfearn@imgtec.com \
    --cc=chenhuacai@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.