From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751476AbdISNlH (ORCPT ); Tue, 19 Sep 2017 09:41:07 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56292 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751340AbdISNlD (ORCPT ); Tue, 19 Sep 2017 09:41:03 -0400 Date: Tue, 19 Sep 2017 06:40:55 -0700 From: "Paul E. McKenney" To: Mike Galbraith Cc: Boqun Feng , Byungchul Park , Steven Rostedt , Neeraj Upadhyay , josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, linux-kernel@vger.kernel.org, sramana@codeaurora.org, prsood@codeaurora.org, pkondeti@codeaurora.org, markivx@codeaurora.org, peterz@infradead.org, kernel-team@lge.com Subject: Re: Query regarding synchronize_sched_expedited and resched_cpu Reply-To: paulmck@linux.vnet.ibm.com References: <20170918122931.0e3341f3@gandalf.local.home> <20170918165527.GN3521@linux.vnet.ibm.com> <20170918235311.GA20177@linux.vnet.ibm.com> <20170919015027.GD5994@X58A-UD3R> <20170919020610.GF5994@X58A-UD3R> <20170919023329.GA3521@linux.vnet.ibm.com> <20170919024822.GG5994@X58A-UD3R> <20170919040456.GC3521@linux.vnet.ibm.com> <20170919053749.GA12412@tardis> <1505801513.29698.10.camel@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1505801513.29698.10.camel@gmx.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17091913-0056-0000-0000-000003CB9C75 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007762; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000230; SDB=6.00919288; UDB=6.00461855; IPR=6.00699514; BA=6.00005598; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017209; XFM=3.00000015; UTC=2017-09-19 13:41:00 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17091913-0057-0000-0000-000008029FC8 Message-Id: <20170919134055.GG3521@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-19_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709190194 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 19, 2017 at 08:11:53AM +0200, Mike Galbraith wrote: > On Tue, 2017-09-19 at 13:37 +0800, Boqun Feng wrote: > > On Mon, Sep 18, 2017 at 09:04:56PM -0700, Paul E. McKenney wrote: > > > On Tue, Sep 19, 2017 at 11:48:22AM +0900, Byungchul Park wrote: > > > > On Mon, Sep 18, 2017 at 07:33:29PM -0700, Paul E. McKenney wrote: > > > > > > > Hello Paul and Steven, > > > > > > > > > > > So I think this is another false positive, and the reason is we use > > st->done for multiple purposes. > > > > > > > > > This is saying: > > > > > > > > > > > > > > Thread A > > > > > > > -------- > > > > > > > takedown_cpu() > > > > > > > irq_lock_sparse() > > > > > > > wait_for_completion(&st->done) // Wait for completion of B > > > > Thread A wait for the idle task on the outgoing to set the st->state to > > CPUHP_AP_IDLE_DEAD(i.e. the corresponding complete() is the one in > > cpuhp_complete_idle_dead()), and it happens when we try to _offline_ a > > cpu. > > > > > > > > > irq_unlock_sparse() > > > > > > > > > > > > > > Thread B > > > > > > > -------- > > > > > > > cpuhp_invoke_callback() > > > > > > > irq_lock_sparse() // Wait for A to irq_unlock_sparse() > > > > irq_affinity_online_cpu() is called here, so it happens when we try to > > _online_ a cpu. > > > > > > > > > (on the way going to complete(&st->done)) > > > > and we are going to complete(&st->done) in a hotplug thread context to > > indicate the hotplug thread has finished its job(i.e. this complete() is > > the one in cpuhp_thread_fun()). > > > > > > So even though the &st->done are the same instance, the deadlock could > > not happen, I think, as we could not up/down a same cpu at the same > > time? > > > > If I'm not missing something subtle. To fix this we can either > > > > 1) have dedicated completion instances for different wait purposes > > in cpuhp_cpu_state. > > > > or > > > > 2) extend crossrelease to have the "subclass" concept, so that > > callsite of complete() and wait_for_completion() for the same > > completion instance but with different purposes could be > > differed by lockdep. > > > > Thoughts? > > https://lkml.org/lkml/2017/9/5/184 > > Peter's patches worked for me, but per tglx, additional (non- > grasshopper level) hotplug-fu is required. Thank you, I will give these a go! Thanx, Paul