From patchwork Thu Jul 19 22:12:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkata Narendra Kumar Gutta X-Patchwork-Id: 10535405 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 1D01A601D2 for ; Thu, 19 Jul 2018 22:13:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F26DB29C3D for ; Thu, 19 Jul 2018 22:13:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E544329C40; Thu, 19 Jul 2018 22:13:27 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 83D2829C3D for ; Thu, 19 Jul 2018 22:13:27 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=RDMdosyck4vFRJInBqG/34u9gcxqRWaYsgkPH5yrDg0=; b=Fm1 2j00dbNRR/SYyiDY/LYe6/hShllHbrNvS4Vx3Swapx6bai0yUj77xudmpNm/cOCBZ3tj+w5Uw5es/ KlKo7xeZwzX8CsbQGIv9a5Yk5BZq+1C8F9BJAQgTE+6bCRHz/+t4HPoM8rWxOc9moqIo+IW4eQ7L4 4ET1LBAH+uRskJGzdfiWpHmRjZxIjyaVB1mv1DICpHaSP4WpSpvW9vRqGWVIxliPP6pd+rjT4hTEo mFnyWiP40T6mStUvN4dtJBqaHnh4Ohiy0ufXd/Ueq6REw6IF8Ce0MrSFB5VkVoFsYqFdut2Nm6UAG k35TDrrHw/d7nx9chuZpNwEpvU+L6Ug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fgHAo-0006zk-K2; Thu, 19 Jul 2018 22:13:22 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fgHAl-0006yi-K8 for linux-arm-kernel@lists.infradead.org; Thu, 19 Jul 2018 22:13:21 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 213A3602BD; Thu, 19 Jul 2018 22:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532038388; bh=xkhdWlUcYsTbd+W6hSXsr26BRBnuwyZt+7P+wsYPeAk=; h=From:To:Cc:Subject:Date:From; b=BumlRXgIY2knSfeAZjEihpPVEDlHHm0KbAX5GELWsvWhG4GFRtEVB1k81yG8TPFHK VIwlmJQw7ZrKi0RnC/8g4H0Gir16qjYCBG78T1LoQ0TfztbD4gNChgOC/5kvR540FR oilfjm13YMsY3Whboh6scF0ZCoTBydhfUN273akk= Received: from vgutta-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vnkgutta@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id D2A79602BD; Thu, 19 Jul 2018 22:13:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532038387; bh=xkhdWlUcYsTbd+W6hSXsr26BRBnuwyZt+7P+wsYPeAk=; h=From:To:Cc:Subject:Date:From; b=EgEyC/UEItFI3JsCmIER0BsD1wznD86Tn7cFg7fITQrBb65o7mXdH6rx7SBOsiIzp BcdToD4OpAkWvdJHBY4ebl8mKtU8vLIoXMYU58aRNAAvN40FkRqbslvSRgbL/Kwwd/ y6MHlubShrHxWjO2gepkrKUgMhtv845FRV5UDbgA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D2A79602BD Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vnkgutta@codeaurora.org From: Venkata Narendra Kumar Gutta To: linux-arm-kernel@lists.infradead.org, tsoni@codeaurora.org, ckadabi@codeaurora.org, rishabhb@codeaurora.org, linux-kernel@vger.kernel.org, robh@kernel.org, hoeun.ryu@gmail.com, adobriyan@gmail.com, zhizhouzhang@asrmicro.com, suzuki.poulose@arm.com, mark.rutland@arm.com, james.morse@arm.com, will.deacon@arm.com, catalin.marinas@arm.com Subject: [PATCH] ARM64: smp: BUG() if smp_send_reschedule() is called for an offline cpu Date: Thu, 19 Jul 2018 15:12:49 -0700 Message-Id: <1532038369-5159-1-git-send-email-vnkgutta@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180719_151319_697625_D1D605AD X-CRM114-Status: GOOD ( 13.32 ) 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: , Cc: Venkata Narendra Kumar Gutta , Matt Wagantall MIME-Version: 1.0 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 Based on the 'commit <8b775be35e41b9f> ("ARM: smp: BUG() if smp_send_reschedule() is called for an offline cpu")' Sending an IPI_RESCHEDULE to an offline CPU is incorrect and potentially bad for both power and stability. On some sub-architectures such as MSM, if a power-collapsed CPU is unexpectedly woken up by an IPI, it will be begin executing without the preparations that would normally happen as part of CPU_UP_PREPARE. If clocks, voltage regulators, or other hardware configuration are not performed, the booting CPU may cause general instability or (at best) poor power performance since the CPU would be powered up but not utilized. One common cause for such issues is misuse of add_timer_on() or APIs such as queue_work_on() which call it. If proper precautions are not taken to block hotplug while these APIs are called then a race may result in IPIs being sent to CPUs that are already offline. This same argument could be applied to other IPIs (with the exception of IPI_WAKEUP), but the others are already restricted to only online CPUs by existing mechanisms, so an explicit assertion is not useful. Signed-off-by: Matt Wagantall Signed-off-by: Trilok Soni Signed-off-by: Venkata Narendra Kumar Gutta --- arch/arm64/kernel/smp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 2faa986..5e39030 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -898,6 +898,7 @@ void handle_IPI(int ipinr, struct pt_regs *regs) void smp_send_reschedule(int cpu) { + BUG_ON(cpu_is_offline(cpu)); smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); }