Received: by 10.223.185.116 with SMTP id b49csp8766249wrg; Fri, 2 Mar 2018 07:36:03 -0800 (PST) X-Google-Smtp-Source: AG47ELtelU0CU9Aly4/r1O1CbfOUjdExH905M0RWFhwE5eH4/LinOrLMSffL7lgDVJyXEKBshDwB X-Received: by 10.99.64.3 with SMTP id n3mr441892pga.316.1520004963495; Fri, 02 Mar 2018 07:36:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520004963; cv=none; d=google.com; s=arc-20160816; b=tzszBJGr73Urvq1MEBp9Pd7rW08j0ToeIBxbKXpYemCsqhOFEgDm+m+G/IwuZZ04Kh ElLZ9IVoUx++wqv1HT3NbgkT2PMXtUkvaZ7QxRPjN+lnP322XC+0fBMus9Vmuf5hlb9L PA0U0Jmr+rEfpPUWYJ1MZg/PMXy30SvFGnZOFMpqCvuaWbqzrRQUzLLhA8R8zHPRKKO9 Yx84RSrUJKk8RIw+yBdy1VuoobppNrhkdGa4uLU4I3HIMEJ8lclfj1MdLVPWPE4fPe7g IhH4S3nicT7h6N1SLmUaEADpslS86BHSmuFWHT6w6QfXCe1vc4POzqYDcf2bO8kU4PxO t9ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dmarc-filter:dkim-signature :dkim-signature:arc-authentication-results; bh=tMp2gduOEp1KzE/JiNzLZaWaAegurgt7FivtQ2tjIOE=; b=KMe9UZvv5KXoywsCwxrGljXTlA9ws7iDCFYMPbvpD8JRpp8ycm72FlXICyYMHe/bkc MUA6hYHBJlbHyLiik1sWNr9I0stCzggeU2ChN1Usa/OR3v8SBlqMc+7dItSB6V98D4AY oVJfBLByWrqZC+5xXHJJP8Ei8Qr8H5vHUHBHJGx7pZmRkd7PLRXlIbTp1S32QXALvhkF r4Zc4RbbMa53NzBLI4cCTyu/n4q7ngtpe9X/wxToHlS0gt1QlAR+dCCCKwXbzS/CDaZA 6kujqjJFpyUtjtjH5QabNrQEhkx8R6rpCV1dT0Hv09X8IwoLpO1dOfrvoapMJBlSc8Ld 24Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=oP7Lu0BN; dkim=pass header.i=@codeaurora.org header.s=default header.b=oP7Lu0BN; 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 h33-v6si4985043plh.673.2018.03.02.07.35.48; Fri, 02 Mar 2018 07:36:03 -0800 (PST) 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=oP7Lu0BN; dkim=pass header.i=@codeaurora.org header.s=default header.b=oP7Lu0BN; 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 S1428182AbeCBN1Q (ORCPT + 99 others); Fri, 2 Mar 2018 08:27:16 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:54542 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425249AbeCBN1O (ORCPT ); Fri, 2 Mar 2018 08:27:14 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C78D5601CF; Fri, 2 Mar 2018 13:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519997233; bh=Ee8532vudn9i/CvDylWG038fHwN0gcAgSZXc5SZMxUI=; h=Subject:To:References:From:Date:In-Reply-To:From; b=oP7Lu0BNnVERlkFLZCx4bzJk7X38vopcvj+BmSjf9Jki88+cG2RdPtPsdma7V03wa ECqb2opvDWz+9q9XyUi/EeNNY8VCBcFs9EMAQF2KRl+B6N/Fzevr/yjx0xfpR3OFBY jrxjWaE5FijqohOR9GdZ2wEhEZuccDNIYRYwNWMU= 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 [192.168.1.198] (pool-71-179-10-19.bltmmd.fios.verizon.net [71.179.10.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tbaicar@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5D05C601CF; Fri, 2 Mar 2018 13:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519997233; bh=Ee8532vudn9i/CvDylWG038fHwN0gcAgSZXc5SZMxUI=; h=Subject:To:References:From:Date:In-Reply-To:From; b=oP7Lu0BNnVERlkFLZCx4bzJk7X38vopcvj+BmSjf9Jki88+cG2RdPtPsdma7V03wa ECqb2opvDWz+9q9XyUi/EeNNY8VCBcFs9EMAQF2KRl+B6N/Fzevr/yjx0xfpR3OFBY jrxjWaE5FijqohOR9GdZ2wEhEZuccDNIYRYwNWMU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5D05C601CF 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=tbaicar@codeaurora.org Subject: Re: [PATCH 0/2] ESRT fixes for relocatable kexec'd kernel To: AKASHI Takahiro , Jeffrey Hugo , ard.biesheuvel@linaro.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, sgoel@codeaurora.org, timur@codeaurora.org References: <1519414953-5478-1-git-send-email-tbaicar@codeaurora.org> <20180228061901.GJ6019@linaro.org> <1f03865f-2d22-8ba1-a276-a6b49d7c14de@codeaurora.org> <20180301025026.GK6019@linaro.org> <7cd3f462-c619-9d82-73a0-2f3bc9de095e@codeaurora.org> <20180302055325.GQ6019@linaro.org> From: Tyler Baicar Message-ID: <4d21342c-a81e-c3ef-8c5f-9d952c7d8fac@codeaurora.org> Date: Fri, 2 Mar 2018 08:27:11 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180302055325.GQ6019@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/2/2018 12:53 AM, AKASHI Takahiro wrote: > Tyler, Jeffrey, > > [Note: This issue takes place in kexec, not kdump. So to be precise, > it is not the same phenomenon as what I addressed in [1],[2]: > [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-February/557254.html > [2] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-January/553098.html > ] > > On Thu, Mar 01, 2018 at 12:56:38PM -0500, Tyler Baicar wrote: >> Hello, >> >> On 2/28/2018 9:50 PM, AKASHI Takahiro wrote: >>> Hi, >>> >>> On Wed, Feb 28, 2018 at 08:39:42AM -0700, Jeffrey Hugo wrote: >>>> On 2/27/2018 11:19 PM, AKASHI Takahiro wrote: >>>>> Tyler, >>>>> >>>>> # I missed catching your patch as its subject doesn't contain arm64. >>>>> >>>>> On Fri, Feb 23, 2018 at 12:42:31PM -0700, Tyler Baicar wrote: >>>>>> Currently on arm64 ESRT memory does not appear to be properly blocked off. >>>>>> Upon successful initialization, ESRT prints out the memory region that it >>>>>> exists in like: >>>>>> >>>>>> esrt: Reserving ESRT space from 0x000000000a4c1c18 to 0x000000000a4c1cf0. >>>>>> >>>>>> But then by dumping /proc/iomem this region appears as part of System RAM >>>>>> rather than being reserved: >>>>>> >>>>>> 08f10000-0deeffff : System RAM >>>>>> >>>>>> This causes issues when trying to kexec if the kernel is relocatable. When >>>>>> kexec tries to execute, this memory can be selected to relocate the kernel to >>>>>> which then overwrites all the ESRT information. Then when the kexec'd kernel >>>>>> tries to initialize ESRT, it doesn't recognize the ESRT version number and >>>>>> just returns from efi_esrt_init(). >>>>> I'm not sure what is the root cause of your problem. >>>>> Do you have good confidence that the kernel (2nd kernel image in this case?) >>>>> really overwrite ESRT region? >>>> According to my debug, yes. >>>> Using JTAG, I was able to determine that the ESRT memory region was getting >>>> overwritten by the secondary kernel in >>>> kernel/arch/arm64/kernel/relocate_kernel.S - specifically the "copy_page" >>>> line of arm64_relocate_new_kernel() >>>> >>>>> To my best knowledge, kexec is carefully designed not to do such a thing >>>>> as it allocates a temporary buffer for kernel image and copies it to the >>>>> final destination at the very end of the 1st kernel. >>>>> >>>>> My guess is that kexec, or rather kexec-tools, tries to load the kernel image >>>>> at 0x8f80000 (or 0x9080000?, not sure) in your case. It may or may not be >>>>> overlapped with ESRT. >>>>> (Try "-d" option when executing kexec command for confirmation.) >>>> With -d, I see >>>> >>>> get_memory_ranges_iomem_cb: 0000000009611000 - 000000000e5fffff : System RAM >>>> >>>> That overlaps the ESRT reservation - >>>> [ 0.000000] esrt: Reserving ESRT space from 0x000000000b708718 to >>>> 0x000000000b7087f0 >>>> >>>>> Are you using initrd with kexec? >>>> Yes >>> To make the things clear, can you show me, if possible, the followings: >> I have attached all of these: > Many thanks. > According to the data, ESRT was overwritten by initrd, not the kernel image. > It doesn't matter to you though :) > > The solution would be, as Ard suggested, that more information be > added to /proc/iomem. > I'm going to fix the issue as quickly as possible. Great, thank you!! Please add us to the fix and we will gladly test it out. Thanks, Tyler -- Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.