linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org>
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 <mattw@codeaurora.org>,
	Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org>
Subject: [PATCH] ARM64: smp: BUG() if smp_send_reschedule() is called for an offline cpu
Date: Thu, 19 Jul 2018 15:12:49 -0700	[thread overview]
Message-ID: <1532038369-5159-1-git-send-email-vnkgutta@codeaurora.org> (raw)

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 <mattw@codeaurora.org>
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
Signed-off-by: Venkata Narendra Kumar Gutta <vnkgutta@codeaurora.org>
---
 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


             reply	other threads:[~2018-07-19 22:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 22:12 Venkata Narendra Kumar Gutta [this message]
2018-07-20  6:31 ` [PATCH] ARM64: smp: BUG() if smp_send_reschedule() is called for an offline cpu Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1532038369-5159-1-git-send-email-vnkgutta@codeaurora.org \
    --to=vnkgutta@codeaurora.org \
    --cc=adobriyan@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=ckadabi@codeaurora.org \
    --cc=hoeun.ryu@gmail.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mattw@codeaurora.org \
    --cc=rishabhb@codeaurora.org \
    --cc=robh@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tsoni@codeaurora.org \
    --cc=will.deacon@arm.com \
    --cc=zhizhouzhang@asrmicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).