Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2198745imm; Thu, 19 Jul 2018 15:13:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeJmjnx483qOvy+htAMyjNB7YYTVC7NnggsUGPQY3N+778pJ02s+8K8XfnttpuvMWU0Z3sl X-Received: by 2002:a63:e60c:: with SMTP id g12-v6mr11750294pgh.308.1532038437837; Thu, 19 Jul 2018 15:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532038437; cv=none; d=google.com; s=arc-20160816; b=Dfu5GVkljMByVkdIdMWcPqXSfR20Wb/So363FyBEfJGF98GXZeiPHpeSXDDEXh7bwJ zw8B972oA37RN9FmlgbBdz/cbKRCUKXKmlNRXCziS/ufT2WvBH+CD36v6+En78jtCpga cY/xM+yV9pyJjlJ/1TD70QGE9/VfzytupTe8VIPdqb/G8f4V3lhY3aoyAPLb5E47xiUS 3pGTaywLZYkzGxjHiq5qC3qxkdsoVMaHDybrHxko2SQK+ctZSX8z+dso8wXBwVolTKZf 7+Dqo1WWwpraprsnTocI2so1qrfytddsFzzbKw7/oOyX/m3235QBK3yRhgIX6huzLUkc PQXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=JGQMtfC8lCtn3SenZnegTzdC+9uAPkVN9Mh8rOrTZuw=; b=T6dySskho+Mb7yp8ZQWJi+6FUjbIUJhDr88HZ8xoy8NrYd4UOeAML791mEOPZWvh5O ZTKrw8f8tk1VOwqqc7a4+4+rMBKajkgoLBCz3VYvAreQtjlWeBZ70JueV1a13WmdS2Mw 92O+y4BIKK62aVAqxZk3C61DBqrNY9PItN3eaCk4CqwG2xC/TMcx0bD23yyzZ/qpZ8OV ySDtQiMi4RWqRk+FkqoIcaxF5O9RgKNTxlUE3XFSljyTc1uAdQU2SZG8n5XrjOnsYPRE bLk9HnZYdLXUSTFyggNkSzKOYP1ISnVJkvtvzS0NCom9mI+lvFtvZ3KpkHnrLUtA8FEc d13A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=BumlRXgI; dkim=pass header.i=@codeaurora.org header.s=default header.b="EgEyC/UE"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v84-v6si288314pfa.103.2018.07.19.15.13.42; Thu, 19 Jul 2018 15:13:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=BumlRXgI; dkim=pass header.i=@codeaurora.org header.s=default header.b="EgEyC/UE"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730926AbeGSW6N (ORCPT + 99 others); Thu, 19 Jul 2018 18:58:13 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45932 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727523AbeGSW6N (ORCPT ); Thu, 19 Jul 2018 18:58:13 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 30A1E606DB; 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= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 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 Cc: Matt Wagantall , Venkata Narendra Kumar Gutta 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project