From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92CFAC433B4 for ; Wed, 19 May 2021 15:22:02 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5508E61074 for ; Wed, 19 May 2021 15:22:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5508E61074 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oey/l9Hs+g0oCvR1e4d8uKaXtYaRiBAM1xJUbgZnJcI=; b=nI+RhXooRDunLDiRkRe4CuY2t 4STaMdRqhibL4Fe5d88KnS2lY4nHRpBYeZLpeLARBeg/1Iejc2fhTz8ifWo/aAEfMWZO3g5c4xphr ZfeKSUuYUVroCT3A8t1iiMm+lViallW8P5EZNDNqlMTvH+bCARveqRlZ+UJSq7VMaypyQgFhnPrqS iRq7wv6aGAwtp4UvZFcJX6+poZlWkv2gf4LOVHU/5Pe6CnO9JYAkuHIPDF9Qw3wogKXWvGtXGbdF3 IhukyhHYi+oSSlFKcMgB1oTaR2HnrL2A4r0SPuFEloPyOOPNW3i2MTiHq7wi46E/AzatdhPWqvujY mYjLPs93w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljNzK-004McC-Ni; Wed, 19 May 2021 15:19:58 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljNzE-004MaQ-Cn; Wed, 19 May 2021 15:19:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=GGI3Lu/UClhuUdvVpeI/iZFpTkdcpMHAiXyXQ+Qcnw4=; b=ldd18Cu2Ur9Tbncm3+bHRSLS2t rI87AA3/sj90Q/vFOjJHt6rqAkgFtxKVUc5Vh9VyI/MQJTbcs2hoxkjLh6Xqe7UGH5UlBclPMf6Tr bu5RGf96qEWvQiZ/HjJi7hKd0n4+BGP16/X9+86/z9FDWxH/F4hcrzlJZA5BOdisn41Erg4Zz21z+ mWro8ab6pzFvbUoB18tuJ2JO0uDiaRVzjXs2Y1ByC2tDkWSFw6qIpcNA7MWYTJ14Cb7BvJ2ybPeDp 0MEtNw4j/W1IThnYOXUociGfxclYVA1xMq1FuxKEiEnU/rNL7zLGFKxnj57kF1h8WqWeEUm2ERfEy UUNo3biQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljNzB-00FaAU-Hp; Wed, 19 May 2021 15:19:51 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E93796108D; Wed, 19 May 2021 15:19:46 +0000 (UTC) Date: Wed, 19 May 2021 16:19:44 +0100 From: Catalin Marinas To: Marc Zyngier Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Will Deacon , Ard Biesheuvel , Mark Rutland , James Morse , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Eric Biederman , Bhupesh Sharma , AKASHI Takahiro , kernel-team@android.com Subject: Re: [PATCH 0/2] arm64: kexec_file_load vs memory reservations Message-ID: <20210519151942.GB21619@arm.com> References: <20210429133533.1750721-1-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210429133533.1750721-1-maz@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_081949_627281_77B0C6C5 X-CRM114-Status: GOOD ( 17.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 29, 2021 at 02:35:31PM +0100, Marc Zyngier wrote: > It recently became apparent that using kexec with kexec_file_load() on > arm64 is pretty similar to playing Russian roulette. > > Depending on the amount of memory, the HW supported and the firmware > interface used, your secondary kernel may overwrite critical memory > regions without which the secondary kernel cannot boot (the GICv3 LPI > tables being a prime example of such reserved regions). > > It turns out that there is at least two ways for reserved memory > regions to be described to kexec: /proc/iomem for the userspace > implementation, and memblock.reserved for kexec_file. And of course, > our LPI tables are only reserved using the resource tree, leading to > the aforementioned stamping. Similar things could happen with ACPI > tables as well. So which one of these (/proc/iomem and memblock.reserved) would be the correct option? If none of them, is their intersection any better? Looking at the default kexec_locate_mem_hole(), it uses the resources tree if !CONFIG_ARCH_KEEP_MEMBLOCK, otherwise memblock. PowerPC implements its own arch_kexec_locate_mem_hole() to skip specific arch regions. We could do something similar for arm64 if the arch code knows where the LPI reservation is or the ACPI tables. If we conclude that we need some intersection of resource reservations and memblock, maybe we should change the default kexec_locate_mem_hole() implementation to check for both (e.g. start with the resource tree and only consider a range valid if not in memblock.reserved). -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel