From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751402AbdH3NYI (ORCPT ); Wed, 30 Aug 2017 09:24:08 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:41883 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751326AbdH3NYH (ORCPT ); Wed, 30 Aug 2017 09:24:07 -0400 Subject: Re: [PATCH] MIPS: Revert "MIPS: Fix race on setting and getting cpu_online_mask" To: Huacai Chen , Matija Glavinic Pecotic CC: Ralf Baechle , Linux MIPS Mailing List , Marcin Nowakowski , Paul Gortmaker , "linux-kernel@vger.kernel.org" , Ingo Molnar , Paul Burton References: <1503476475-21069-1-git-send-email-matt.redfearn@imgtec.com> <71ea8331-78da-c22b-d46d-99ab6c187bbf@nokia.com> From: Matt Redfearn Message-ID: <7e9037a6-195b-ca0f-75da-5a338c5e938d@imgtec.com> Date: Wed, 30 Aug 2017 14:24:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.150.130.83] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > 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 >>