From patchwork Thu Jan 12 04:21:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 9512115 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 8CE37601E7 for ; Thu, 12 Jan 2017 04:21:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 805FF28663 for ; Thu, 12 Jan 2017 04:21:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7519628677; Thu, 12 Jan 2017 04:21:17 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6491928670 for ; Thu, 12 Jan 2017 04:21:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cRWsz-0001eS-Ix; Thu, 12 Jan 2017 04:21:13 +0000 Received: from mail-pf0-x230.google.com ([2607:f8b0:400e:c00::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRWsv-0001No-G1 for linux-arm-kernel@lists.infradead.org; Thu, 12 Jan 2017 04:21:11 +0000 Received: by mail-pf0-x230.google.com with SMTP id 189so5643476pfu.3 for ; Wed, 11 Jan 2017 20:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yWbwkYd1P5a0ispN9w1CFcUIU16hfSr0fdQDZdruf2Q=; b=eaZNHshZTXVHwvGYwf3LwkMjkvyBNEfX9R6jmK5r1yoN9ya36Foj4Kj8W2v6bs7ABr RXTSYWwAAJRclecjsZ4jwfnFt4FTs8vTEQCbn5Fr576EZ9sqF+k9GR/i+dq25ctSOiPz gLvTQfoA6Uq1rdNCn/X5GBPtClbkOQVYUb8/I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=yWbwkYd1P5a0ispN9w1CFcUIU16hfSr0fdQDZdruf2Q=; b=Z6TM5r3b0hfBW5b5+UYhydoKl/pOfoG4ubB7g4J2P7H2xrGzLuqFZoee1PTQkvqdQC mdFiu5DdQJ9Ayh3btWtITSlYuBG1r+xk4GxAc8EvMEatq/afDGPk/Xnxw3fwA2EzHVl8 zO2A6pkKCBFd1tXwp+NQg/VY6qHY+Eip60TGDru4ic6ONvquV8q+qMvoXTtCOq7cHi8n 34vzgBmNC0/oDVlPwqxqN0md06dt0OYx4nKah6+gpvwAkcow2ffUhyD9g1gJ+hGXOluZ 3b5mOFRR72dTKHW4Fvw2MR9pDNv2IkqcKDYm4Iz9hBWeAqqtajFFV6Epgw/OhZl9h/1n wihQ== X-Gm-Message-State: AIkVDXL9E1YkStRcbc145x8K3CbqBOPJBpPyQOeN6E+YKNPE5kmtgPgiHHutrEFBselJMRsO X-Received: by 10.84.164.231 with SMTP id l36mr18564131plg.33.1484194847943; Wed, 11 Jan 2017 20:20:47 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id 18sm17208067pgf.28.2017.01.11.20.20.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 20:20:46 -0800 (PST) Date: Thu, 12 Jan 2017 13:21:44 +0900 From: AKASHI Takahiro To: Will Deacon Subject: Re: [PATCH v29 4/9] arm64: kdump: implement machine_crash_shutdown() Message-ID: <20170112042143.GF20972@linaro.org> Mail-Followup-To: AKASHI Takahiro , Will Deacon , catalin.marinas@arm.com, james.morse@arm.com, geoff@infradead.org, bauerman@linux.vnet.ibm.com, dyoung@redhat.com, mark.rutland@arm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org References: <20161228043347.27358-1-takahiro.akashi@linaro.org> <20161228043605.27470-3-takahiro.akashi@linaro.org> <20170110113248.GC21598@arm.com> <20170111063626.GE20972@linaro.org> <20170111105405.GF12388@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170111105405.GF12388@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170111_202109_574224_5F80182E X-CRM114-Status: GOOD ( 18.25 ) 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: mark.rutland@arm.com, geoff@infradead.org, catalin.marinas@arm.com, kexec@lists.infradead.org, james.morse@arm.com, bauerman@linux.vnet.ibm.com, dyoung@redhat.com, linux-arm-kernel@lists.infradead.org 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 On Wed, Jan 11, 2017 at 10:54:05AM +0000, Will Deacon wrote: > On Wed, Jan 11, 2017 at 03:36:28PM +0900, AKASHI Takahiro wrote: > > On Tue, Jan 10, 2017 at 11:32:48AM +0000, Will Deacon wrote: > > > On Wed, Dec 28, 2016 at 01:36:01PM +0900, AKASHI Takahiro wrote: > > > > @@ -22,6 +25,7 @@ > > > > extern const unsigned char arm64_relocate_new_kernel[]; > > > > extern const unsigned long arm64_relocate_new_kernel_size; > > > > > > > > +static bool in_crash_kexec; > > > > > > Do you actually need this bool? Why not call kexec_crash_loaded() instead? > > > > The two have different meanings: > > "in_crash_kexec" indicates that kdump is taking place, while > > kexec_crash_loaded() tells us only whether crash dump kernel has been > > loaded or not. > > > > It is crucial to distinguish them especially for machine_kexec() > > which can be called on normal kexec even if kdump has been set up. > > Ah, I see. So how about just doing: > > if (kimage == kexec_crash_image) > > in machine_kexec? Yeah, it should work. Do you want to merge the following hunk, or expect that I will re-send the whole patch series (with other changes if any)? -Takahiro AkASHI > Will ===8<== diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index 994fe0bc5cc0..c0fc3d458195 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -26,7 +26,6 @@ extern const unsigned char arm64_relocate_new_kernel[]; extern const unsigned long arm64_relocate_new_kernel_size; -static bool in_crash_kexec; static unsigned long kimage_start; /** @@ -154,7 +153,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)) && - !WARN_ON(in_crash_kexec)); + !WARN_ON(kimage == kexec_crash_image)); reboot_code_buffer_phys = page_to_phys(kimage->control_code_page); reboot_code_buffer = phys_to_virt(reboot_code_buffer_phys); @@ -206,8 +205,8 @@ void machine_kexec(struct kimage *kimage) * relocation is complete. */ - cpu_soft_restart(!in_crash_kexec, reboot_code_buffer_phys, kimage->head, - kimage_start, 0); + cpu_soft_restart(kimage != kexec_crash_image, + reboot_code_buffer_phys, kimage->head, kimage_start, 0); BUG(); /* Should never get here. */ } @@ -250,8 +249,6 @@ void machine_crash_shutdown(struct pt_regs *regs) { local_irq_disable(); - in_crash_kexec = true; - /* shutdown non-crashing cpus */ smp_send_crash_stop();