From patchwork Tue Dec 12 17:20:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 10107913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E9433602B3 for ; Tue, 12 Dec 2017 17:21:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C864B29923 for ; Tue, 12 Dec 2017 17:21:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAA6E29929; Tue, 12 Dec 2017 17:21:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D27529907 for ; Tue, 12 Dec 2017 17:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:MIME-Version: Subject:To:From:Date:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=y1x4/E8PxlUcC3kCzbPrHca79/8K9LcNwdgR1dSfrOY=; b=isSLqk0MMjrMPJ THK2Tir8Az3YelsfUztaXA+95UKf+pOAs7LXU1Ht4/nhSvc4pk2hu9Db5T7GygbFVnOytL58xwLms nGaIzRcaiLSK6+laTZ3COxgjxl5e2YLV/WebFcA7+eoLlXqiEUR2j+IA9yKyOGOEsIy6cuc40wTvu Zcs7vARdVJ4FzTwV7suxhpsMuqZDZM9zLKSrZdFSNTSVL75JaMG4YLQRJpJIopNkRF1d8Zlo9NzR1 y/4YRzzRQKFrSCCLbiTMOeb5o+d2peClv/8ll/b6OMALpbSmt0OslXR4chUoef+nFoF/1Q02U5A71 R5s1+dIKeBagdk/iDY8w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eOoFF-0004Km-5x; Tue, 12 Dec 2017 17:21:29 +0000 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5] helo=mx0a-001b2d01.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eOoFB-0004Jw-CM for linux-arm-kernel@lists.infradead.org; Tue, 12 Dec 2017 17:21:27 +0000 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vBCHIO6v130508 for ; Tue, 12 Dec 2017 12:21:04 -0500 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0b-001b2d01.pphosted.com with ESMTP id 2etjs6a0fe-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 12 Dec 2017 12:21:03 -0500 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Dec 2017 12:21:02 -0500 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 12 Dec 2017 12:20:59 -0500 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vBCHKx3i34996310; Tue, 12 Dec 2017 17:20:59 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 084E4B2046; Tue, 12 Dec 2017 12:18:05 -0500 (EST) Received: from paulmck-ThinkPad-W541 (unknown [9.85.141.99]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id C064FB204E; Tue, 12 Dec 2017 12:18:04 -0500 (EST) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 51C8F16C1CCD; Tue, 12 Dec 2017 09:20:59 -0800 (PST) Date: Tue, 12 Dec 2017 09:20:59 -0800 From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: CPU hotplug: Delegate complete() to surviving CPU MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17121217-2213-0000-0000-0000024951E3 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008194; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000244; SDB=6.00959219; UDB=6.00485093; IPR=6.00739241; BA=6.00005738; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018504; XFM=3.00000015; UTC=2017-12-12 17:21:01 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121217-2214-0000-0000-0000586C33D9 Message-Id: <20171212172059.GA11875@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-12-12_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712120247 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171212_092125_609591_9C4981F8 X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: paulmck@linux.vnet.ibm.com Cc: Michal Hocko , "Peter Zijlstra \(Intel\)" , Russell King - ARM Linux , Fabio Estevam , Peng Fan , Thomas Gleixner , Ingo Molnar Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The ARM implementation of arch_cpu_idle_dead() invokes complete(), but does so after RCU has stopped watching the outgoing CPU, which results in lockdep complaints because complete() invokes functions containing RCU readers. This patch therefore uses Thomas Gleixner's trick of delegating the complete() call to a surviving CPU via smp_call_function_single(). Reported-by: Peng Fan Reported-by: Russell King - ARM Linux Signed-off-by: Paul E. McKenney Tested-by: Tested-by: Fabio Estevam Cc: Russell King Cc: Ingo Molnar Cc: "Peter Zijlstra (Intel)" Cc: Michal Hocko Cc: Thomas Gleixner Cc: diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index b4fbf00ee4ad..75f85e20aafa 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -267,6 +267,14 @@ void __cpu_die(unsigned int cpu) } /* + * Invoke complete() on behalf of the outgoing CPU. + */ +static void arch_cpu_idle_dead_complete(void *arg) +{ + complete(&cpu_died); +} + +/* * Called from the idle thread for the CPU which has been shutdown. * * Note that we disable IRQs here, but do not re-enable them @@ -293,9 +301,11 @@ void arch_cpu_idle_dead(void) /* * Tell __cpu_die() that this CPU is now safe to dispose of. Once * this returns, power and/or clocks can be removed at any point - * from this CPU and its cache by platform_cpu_kill(). + * from this CPU and its cache by platform_cpu_kill(). We cannot + * call complete() this late, so we delegate it to an online CPU. */ - complete(&cpu_died); + smp_call_function_single(cpumask_first(cpu_online_mask), + arch_cpu_idle_dead_complete, NULL, 0); /* * Ensure that the cache lines associated with that completion are