Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2523574imm; Thu, 19 Jul 2018 23:33:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfOlvbu4EkHwDqh8eBoYdgF4ZW3ZQFysMPzCFr6BZDIAIxmmGFIaU54nGSoJn5IWq9osLWm X-Received: by 2002:a17:902:70cc:: with SMTP id l12-v6mr873552plt.132.1532068382018; Thu, 19 Jul 2018 23:33:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532068381; cv=none; d=google.com; s=arc-20160816; b=iXzqk3EDXfLE+2N0nURgm1mBX5VVWOWMwQDuw/bvkZJoS9ZIM+ZnubSHdykil+ze2J M4BEEfOaspqB3IMo1n+CTdJqa82Q/Lsb7zTjBrU2AulVam1+lKEXPof9/drttDoHHTIM UpEnazzdkkZefCmQlj6Y1EOQiZ7HaIgGwLKW9ecvU2V/9fHnkaTnUR1c60ClzIARSUTz KOHigIIhRt6jYRn52na2iDLz2whUACU3sFRkqFkhdMfga/Q4z0hIgxPIcoNp+C3fvR3f oirtAcRtJzMwQvlLi6jVDUDW8OcWWtkBe9eC5BejhyEU45WQSdhk3MAoucHSvqYfK8EP 2wjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=hx8pbNKNa+sqSmHxFKM7ZcCickU5ki2ho6FISiwag80=; b=psaM9BXqrpLe8bL5kWJhF7aUKoTvKBEWczJMrtGrXGvemLtv1wlmcLaaJMn5oxdOIM tWp+GHELEsfcWVTzbwMDUgGBVf7r11zJvQHZDmSS+1uZbznwrF1Yh7VhoPc/Sd4UyZeZ Re07P5jxZ49i1XTqTTllDdGeYva1oX2tvdDZfJAMm8y405q1rzyZt8eEaU3OkEeaVfFF 5TSSY+lPzws9XVW111I8U4wCh+3TO2Wq+huyUSiVDzbHUjzsr/GY3tu/HFpms/ObmAus kbje3gon8LwnjLMTZAKmbrjxnYRFsQqzvfTCsxVTJqfi4yI8HRJkYMXFRJaq22adl73f LYZw== ARC-Authentication-Results: i=1; mx.google.com; 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 q1-v6si1024922plb.331.2018.07.19.23.32.47; Thu, 19 Jul 2018 23:33:01 -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; 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 S1727972AbeGTHSm (ORCPT + 99 others); Fri, 20 Jul 2018 03:18:42 -0400 Received: from foss.arm.com ([217.140.101.70]:58428 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727156AbeGTHSm (ORCPT ); Fri, 20 Jul 2018 03:18:42 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6848118A; Thu, 19 Jul 2018 23:32:02 -0700 (PDT) Received: from salmiak (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 641683F246; Thu, 19 Jul 2018 23:31:59 -0700 (PDT) Date: Fri, 20 Jul 2018 07:31:56 +0100 From: Mark Rutland To: Venkata Narendra Kumar Gutta Cc: 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, james.morse@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, Matt Wagantall Subject: Re: [PATCH] ARM64: smp: BUG() if smp_send_reschedule() is called for an offline cpu Message-ID: <20180720063156.ico2wsqc3lr2pesa@salmiak> References: <1532038369-5159-1-git-send-email-vnkgutta@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1532038369-5159-1-git-send-email-vnkgutta@codeaurora.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 19, 2018 at 03:12:49PM -0700, Venkata Narendra Kumar Gutta wrote: > Based on the 'commit <8b775be35e41b9f> ("ARM: smp: > BUG() if smp_send_reschedule() is called for an offline cpu")' This commit does not appear to exist in mainline. Which tree is it in? > 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); > } Is BUG_ON() appropriate? Why not WARN_ON() and return? AFAICT, arm doesn't have this logic today either. Thanks, Mark.