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=-9.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham 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 0D863C433ED for ; Thu, 13 May 2021 11:10:16 +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 869DA613AA for ; Thu, 13 May 2021 11:10:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 869DA613AA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:MIME-Version:References:In-Reply-To:Subject:Cc:To: From:Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Cvq0jipnOp81thu9d+p3OBMj1ZOZ2Ra+rzSMyaq+Hek=; b=C75qAVewetilfteR7ROfHTCxt jv/sJRuFCMg10/LaAxbEHTNl/j8kXs4bnLCvd2L1jyAKR+Ol9L1hgCc/CJryz1ZSf4cpsrkj5YFh4 ToBbVYUVh0j5RZQFKCoW73hLEvJRjWE5NOFblhq88+DFpsxG7WK14mwLQfwTDrjIyNT37ARSMEowb MjHjyiQAcjMb5VzcKp/BYqResKjy004Sd66Db31aRnSCoWv9B0M1uTj9g9O7GOfSERwZ1CzjAXVnC EyeHn03GcLbXvgkY2Zy+6dhXamAwlpAt8e8nH5FulyLCCY0BBEg3ae6jITcxyp8F0GftghjymoI7Z bF1w1PqJA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lh9BX-005ODs-SM; Thu, 13 May 2021 11:07:20 +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 1lh9BS-005ODY-4C; Thu, 13 May 2021 11:07:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=dp1ZeWTKcAvZ6D6RB7t8/oXMS4XFrGzd9ZQawZY3o4M=; b=t/K8kv6NzawnWGWdLtmaH/hBPU eZs1HzA2Nj1IH0BfPYGW8khW7Cejdtnmg2PD0JSag5ZmCpDRP0CwxDehMa+6hGqWl4GjwxIKLsZMK 6Adcz59hIhHkz9fchPgTSIkfvsQxkmLyMbTESaqCkU2EhPW1EEV7Pqy2u9z4UnbuOdAbqPvYcVPKG dMO8e8Q6pFHAEPT9K74gqQl9mXyJuHM0AvWdlX+jOYcrlnjYJT0zd4INq+mlzTS60HokAYs7tk+zn PQLdNQutgSPMaisbVlagbYSABr1LmGpeIdndMEZoh2gnBX9nJd0zqjtvFeZ2GD372DC8ya2fN2Xqs SCGksEvA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lh9BP-00BByv-8X; Thu, 13 May 2021 11:07:12 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B9B26109F; Thu, 13 May 2021 11:07:10 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lh9BM-001BwR-6z; Thu, 13 May 2021 12:07:08 +0100 Date: Thu, 13 May 2021 12:07:07 +0100 Message-ID: <87eeeaopt0.wl-maz@kernel.org> From: Marc Zyngier To: Dave Young Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , Moritz Fischer , Will Deacon , Ard Biesheuvel , Mark Rutland , James Morse , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Eric Biederman , Pingfan Liu , AKASHI Takahiro , kernel-team@android.com Subject: Re: [PATCH 0/2] arm64: kexec_file_load vs memory reservations In-Reply-To: <20210513031503.GC45898@dhcp-128-65.nay.redhat.com> References: <20210429133533.1750721-1-maz@kernel.org> <87fsyroml3.wl-maz@kernel.org> <20210513031503.GC45898@dhcp-128-65.nay.redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: dyoung@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, mdf@kernel.org, will@kernel.org, ardb@kernel.org, mark.rutland@arm.com, james.morse@arm.com, lorenzo.pieralisi@arm.com, guohanjun@huawei.com, sudeep.holla@arm.com, ebiederm@xmission.com, piliu@redhat.com, takahiro.akashi@linaro.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210513_040711_408662_2F3DC6BA X-CRM114-Status: GOOD ( 44.83 ) 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 [- Bhupesh, as his RH address now bounces] On Thu, 13 May 2021 04:17:38 +0100, Dave Young wrote: > > Hi Marc, > On 05/12/21 at 07:04pm, Marc Zyngier wrote: > > + Dave Young, which I accidentally missed in my initial post > > > > On Thu, 29 Apr 2021 14:35:31 +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. > > > > > > On my 24xA53 system artificially limited to 256MB of RAM (yes, it > > > boots with that little memory), trying to kexec a secondary kernel > > > failed every times. I can only presume that this was mostly tested > > > using kdump, which preserves the entire kernel memory range. > > > > > > This small series aims at triggering a discussion on what are the > > > expectations for kexec_file, and whether we should unify the two > > > reservation mechanisms. > > > > > > And in the meantime, it gets things going... > > > > > > Marc Zyngier (2): > > > firmware/efi: Tell memblock about EFI reservations > > > ACPI: arm64: Reserve the ACPI tables in memblock > > > > > > arch/arm64/kernel/acpi.c | 1 + > > > drivers/firmware/efi/efi.c | 23 ++++++++++++++++++++++- > > > 2 files changed, 23 insertions(+), 1 deletion(-) > > > > Any comment on this? > > > > I've separately started working on using the resource tree to slice > > and dice the memblocks that are candidate for kexec_file_load(), but > > I'd like some consensus on whether this is the right way to address > > the issue. > > > > Without something like this, kexec_file_load() is not usable on arm64, > > so I'm pretty eager to see the back of this bug. > > The arm64 memory reservation is tricky, I do not think I understand it > correctly. Previously there were a lot discussion, Ard and AKASHI > should know more about it, see if they can provide comments. I'll let them chime in. It looks like most of the discussions were around kdump, which doesn't suffer from this issue (the memory is reserved upfront). > About the problem you see, another way is to just add an arch weak > function like powerpc: arch_kexec_locate_mem_hole, and walking resource > tree for kexec_file_load as well. But I might be wrong since I did not > follow up the arm64 specific history. Right, this would avoid messing with the core code. However, the problem remains in the sense that there is no clear definition of what "reserved memory" is in general, and where it is described. For example, x86 places the ACPI tables in reserved memblocks, while arm64 doesn't (unless we use my second patch). To reliably use the resource tree, we need to ensure that it contains all the reservations that appeared in memblock too. And if we can't have a single reference, then we have to consider the union of the two trees. Thoughts? M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel