From patchwork Mon Jun 27 14:39:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 70927 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1106560qgy; Mon, 27 Jun 2016 07:41:04 -0700 (PDT) X-Received: by 10.66.150.10 with SMTP id ue10mr34411333pab.71.1467038464209; Mon, 27 Jun 2016 07:41:04 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id e64si26977806pfe.100.2016.06.27.07.41.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2016 07:41:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bHXhp-0001bY-5j; Mon, 27 Jun 2016 14:40:09 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bHXhl-0000LY-G8; Mon, 27 Jun 2016 14:40:05 +0000 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 4EB802F; Mon, 27 Jun 2016 07:40:35 -0700 (PDT) Received: from e104818-lin.cambridge.arm.com (e104818-lin.cambridge.arm.com [10.1.203.148]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 986143F246; Mon, 27 Jun 2016 07:39:42 -0700 (PDT) Date: Mon, 27 Jun 2016 15:39:39 +0100 From: Catalin Marinas To: James Morse Subject: Re: [PATCH v20 04/14] arm64/kexec: Add core kexec support Message-ID: <20160627143939.GC6847@e104818-lin.cambridge.arm.com> References: <018ac873d87fbfc45185cdab91ebc8731f64f94c.1466702804.git.geoff@infradead.org> <57710B92.2080603@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <57710B92.2080603@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160627_074005_563424_C6C12052 X-CRM114-Status: GOOD ( 16.14 ) X-Spam-Score: -8.3 (--------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-8.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.101.70 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Geoff Levand , kexec@lists.infradead.org, Will Deacon , AKASHI Takahiro , marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org On Mon, Jun 27, 2016 at 12:18:42PM +0100, James Morse wrote: > On 23/06/16 18:54, Geoff Levand wrote: > > "Can't kexec: secondary CPUs are stuck in the kernel.\n" > > > + return -EBUSY; > > + } > > + > > > + if (num_online_cpus() > 1) { > > + if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) { > > + /* any_cpu as we don't mind being preempted */ > > + int any_cpu = raw_smp_processor_id(); > > + > > + if (cpu_ops[any_cpu]->cpu_die) > > + return 0; > > + } > > + > > + pr_err("Can't kexec: no mechanism to offline secondary CPUs.\n"); > > + return -EBUSY; > > + } > > This if() {} hunk isn't necessary with the version of cpus_are_stuck_in_kernel() > you have in patch 2. This logic is the '|| smp_spin_tables' part of that helper > function. (hibernate needed it too) I can make the changes locally but just to be clear I understand what you meant, here's the diff on top of Geoff's patch: ----8<------------------------- _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index 945ce326654c..bc96c8a7fc79 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -68,24 +68,9 @@ int machine_kexec_prepare(struct kimage *kimage) kexec_image_info(kimage); - if (kimage->type != KEXEC_TYPE_CRASH) { - if (cpus_are_stuck_in_kernel()) { - pr_err("Can't kexec: failed CPUs are stuck in the kernel.\n"); - return -EBUSY; - } - - if (num_online_cpus() > 1) { - if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) { - /* any_cpu as we don't mind being preempted */ - int any_cpu = raw_smp_processor_id(); - - if (cpu_ops[any_cpu]->cpu_die) - return 0; - } - - pr_err("Can't kexec: no mechanism to offline secondary CPUs.\n"); - return -EBUSY; - } + if (kimage->type != KEXEC_TYPE_CRASH && cpus_are_stuck_in_kernel()) { + pr_err("Can't kexec: CPUs are stuck in the kernel.\n"); + return -EBUSY; } return 0; @@ -163,7 +148,7 @@ void machine_kexec(struct kimage *kimage) /* * New cpus may have become stuck_in_kernel after we loaded the image. */ - BUG_ON(cpus_are_stuck_in_kernel() && (num_online_cpus() > 1)); + BUG_ON(cpus_are_stuck_in_kernel() || (num_online_cpus() > 1)); reboot_code_buffer_phys = page_to_phys(kimage->control_code_page); reboot_code_buffer = phys_to_virt(reboot_code_buffer_phys);