Received: by 10.223.185.116 with SMTP id b49csp1609331wrg; Sat, 24 Feb 2018 00:05:09 -0800 (PST) X-Google-Smtp-Source: AH8x227RxTjebYZVAlsk8Ea+J/esvsrDP1mDMquFCS2BrE6/ulXhxhisbOmo9U+WPK3zBFUB/B4t X-Received: by 10.98.63.147 with SMTP id z19mr4199938pfj.221.1519459508971; Sat, 24 Feb 2018 00:05:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519459508; cv=none; d=google.com; s=arc-20160816; b=Ahn3pWANEBJbCOLKzxi1O/diWbHg+qZHwBBLcSS8Yj27rruusgPFdWLFroCpkt9YMc gCw35jrw06UF0nqVZeZzX0gcbBTEXOh+taQlIm+Xe6Eb+RcQ1AGIaZOiaJoZSHlqVVw/ d0P0Ed1sj3ijR1Az6Mk2tI0Q72VGBcEIpna+BS/AMZJbPMbhm7N9PcSp5FF+tRp50e6q 6SMZBUZTYn/rl9HMIORWy10kb36jmZP0bielNEVac3wwALr2FrJGdTSnPeQra1v8d+/6 J0Q5GU4TdXEe61tWy5yS0rZTSFLBY5nRdk4UQrqmfySJw5Om+zksrxEdjJMhrj/cJMhH 92gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=cI6epYlAVc8GpaBBu4Fl4RxCSDbNgcAGobxrkwhXxY0=; b=JrMxXarwt/YG1VvkrPVI1GMkXasY2rPPrjuZY3qyRZYcXijqTKi7qij4ps+CGEIZ6L sUs0uwHjKx4G3dmPTuFWUOcWDi/FXV/I9QPjBTMCvl95fU7hexVX6O3qSO+VH7Y+WlXr AmkzdXwZtdJqlrqX+gamaoM6RWzcMt4OfFv98uTIXJbF/VqcufjjXDrJ7Wp6NSm+y/Ar ycmczbZ+TagbDzkJpg6jRAuTLeEy2GDWbtBiOxt//p5yqy140gXSLY90KXHcbizj+cVk e1Jf54a3iQjY9ZnVeVmxtO9lgiKtlXRovaQwgKSOHe5VyAOZScqgfUIad34I+54AjDcl ZDzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gzxbV7Ve; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f62-v6si3119905plb.313.2018.02.24.00.04.54; Sat, 24 Feb 2018 00:05:08 -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=@linaro.org header.s=google header.b=gzxbV7Ve; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751505AbeBXIEB (ORCPT + 99 others); Sat, 24 Feb 2018 03:04:01 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:38401 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751417AbeBXIEA (ORCPT ); Sat, 24 Feb 2018 03:04:00 -0500 Received: by mail-it0-f67.google.com with SMTP id j7so4432728ita.3 for ; Sat, 24 Feb 2018 00:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cI6epYlAVc8GpaBBu4Fl4RxCSDbNgcAGobxrkwhXxY0=; b=gzxbV7Vex44wbqLq8mZY5gMn7ELxgCtfCRgE/GtqFngCneZBBxZa23btNh34sIwmgY +d8ObziUOZxlX9hHdF0NAaur3BnxErxt0lZpmrxYQz6hUcmhA8SOM3PhUQ1LYfW6yMFv N7Mf0F4j8Qpao+Cu/fL3Ff2wNNgq3Gjigjs3E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=cI6epYlAVc8GpaBBu4Fl4RxCSDbNgcAGobxrkwhXxY0=; b=bxncCBzyVGSrShJ/Ci/KGrEFM5bGWPHklOIvpK9WuKxux42Ds+eL8b/KdZT9JpPYlV 4fNZ8H5lNYNCTx0G/q8heQMz8l+H15NOB+dfRJF50zZE99zsKzldmZ5W/IKM3LwWtiPa I9Pf0IMMDQU45bsy0HHQRs6FtDPUpVCORfcfVXqm3BAQlnifM88+9CuKQiR6QXFEShPG 1lDLhXHSh1ukWI0UZUpcylwC2jEV0S6yhmR7RDp/bAUpkRc/0P1xB/02J5e1LEXEIwQ+ YW18zDYjMMG3RuGGdnDBk7+pc+dZ+Np7/xqA8JdkI5/Q9CQUTEIy99849EhY7LdhQv9B U8eg== X-Gm-Message-State: APf1xPDAOyGJnXm+/wYP0VI60Os7MEvb3f4c7yeKZ+/uOXm9ohur5zsZ i8KIvD1WhQfqZqKBC5Qk5ykruOMEXqL10ET2WKeccw== X-Received: by 10.36.217.22 with SMTP id p22mr5349165itg.106.1519459439550; Sat, 24 Feb 2018 00:03:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.138.209 with HTTP; Sat, 24 Feb 2018 00:03:58 -0800 (PST) In-Reply-To: <1519414953-5478-3-git-send-email-tbaicar@codeaurora.org> References: <1519414953-5478-1-git-send-email-tbaicar@codeaurora.org> <1519414953-5478-3-git-send-email-tbaicar@codeaurora.org> From: Ard Biesheuvel Date: Sat, 24 Feb 2018 08:03:58 +0000 Message-ID: Subject: Re: [PATCH 2/2] efi/esrt: mark ESRT memory region as nomap To: Tyler Baicar , James Morse , AKASHI Takahiro Cc: linux-efi@vger.kernel.org, Linux Kernel Mailing List , Jeff Hugo , Sameer Goel , Timur Tabi Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tyler, On 23 February 2018 at 19:42, Tyler Baicar wrote: > The ESRT memory region is being exposed as System RAM in /proc/iomem > which is wrong because it cannot be overwritten. This memory is needed > for kexec kernels in order to properly initialize ESRT, so if it is > overwritten it will cause ESRT failures in the kexec kernel. Mark this > region as nomap so that it is not overwritten. > This is not the right fix. We should only mark regions NOMAP if it is uncertain whether the firmware may have a mapping of the same region with mismatched attributes. NOMAP regions punch holes in the linear region, increasing its TLB footprint significantly, so we should avoid them if we can. This same issue has come up in relation to mapping ACPI tables after kexec. This should simply be a matter of ensuring that all memblock_reserve()d region appear as such in /proc/iomem rather than as 'System RAM' > Signed-off-by: Tyler Baicar > Tested-by: Jeffrey Hugo > --- > drivers/firmware/efi/esrt.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c > index 504f3c3..f5f79c7 100644 > --- a/drivers/firmware/efi/esrt.c > +++ b/drivers/firmware/efi/esrt.c > @@ -335,6 +335,14 @@ void __init efi_esrt_init(void) > pr_info("Reserving ESRT space from %pa to %pa.\n", &esrt_data, &end); > efi_mem_reserve(esrt_data, esrt_data_size); > > + /* > + * Mark the ESRT memory region as nomap to avoid it being exposed as > + * System RAM in /proc/iomem. Otherwise this block can be overwritten > + * which will then cause failures in kexec'd kernels since the ESRT > + * information is no longer there. > + */ > + memblock_mark_nomap(esrt_data, esrt_data_size); > + > pr_debug("esrt-init: loaded.\n"); > err_memunmap: > early_memunmap(va, size); > -- > 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. >