Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796210672; b=brSJZEKHTgc/TrHe65LeiitRtAYAwfZdNsRbQqekCXZwevHXFs03B10RZX4ZoyFUFutQ TOUQODj1btl72UDGgOnlhm63z7FfInNZ53/sk0WQzuC5MheqaJtq5tNIQ5t8CnYRAyUCQ nmGKR1uzvaWOWZj7cUXnN5aF3yZ7RF2C6cLXk3WNDg8Cm68eVHihDJxnpfqh5Yx0rEERx TtPsR7MxibGj5NZeiK71uC9I7AVAa3MsvSASe9IKVHb9vQZWKvIricLCRZ1TvW/ve6w+E jQQmFqBxe/lXTIbSxq3RGxlgSQhlCcp6BiyhkQS56/jFX6e97mX6xHp+273Z0AhFJPA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796210672; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=bXOTpFFusO1Xh2Jk5IEd/YFuWyhGMXSS5ROKTzIpeXA=; b=U32WMylBbR1QIC31Psdg9nBVNYYaROHDpauGNLOc/BRzunsWbk9JXC8S6EKZIvQhyDv/ W//I3sdwysv68g32D9ra3fbhGli3gWsF5CpoGgsl8PLNtw8v67BbQjYaCn19NyIbd9IbV mpTi6gpv+Ehysml/047uYsolsEDMRPTpEx47r+7ywGeqC2eZNKp5YF8i5Af8r0937OsnZ jp2dh3rdJ4/d3iLKkVho1EFlbwvXBwYK93ObRi/jrsg06gazirHKVL/spjOzJOyNBPqSl qXQZnTM+C0SNQRwpc7hwCKizKYeWpboS7ZqVjCNsU+AviMo4DbxmGwXRYC5z6ArMk4w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HZeQZLFR; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69672606A31A for ; Wed, 2 Dec 2026 11:24:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HZeQZLFR Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C3261F00896; Wed, 2 Dec 2026 11:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796210672; bh=bXOTpFFusO1Xh2Jk5IEd/YFuWyhGMXSS5ROKTzIpeXA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=HZeQZLFRMllbBQQBBZ5DpGat6GqIFDF8ATjC2FhqPHORJWt+lytHSLmWZoOaElSRd oHPLftN7cQPfK/KtTurxsWLKq99tQGBtKpD3owsHs1gkA8aQeNx73YPEaBP7TpS3Am /L4VUDDyL+BVgq+NCi70sKLyiV3INTtLSigh8izp485UzqLjOQ7b4ayf/nFStyVlrJ PF9n9a8+1r+scxNnfpZrm996XQFebO+E+FhdmoghK6jpXtJIE8RKcUWUE2RY6PmgKh cPESiJS4npYNM5O0xiBytkVlcFgZuZsz4d75FrqEfQ8jSA19w/lU9KXpyn8fG4XMzB uzLjmSV/VRjOw== Date: Wed, 2 Dec 2026 13:24:25 +0200 From: Mike Rapoport To: Chris Down Cc: pasha.tatashin@soleen.com, pratyush@kernel.org, graf@amazon.com, kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH v2 0/2] kho: handle failures to reserve preserved memory Message-ID: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Dec 01, 2026 at 10:32:07PM -0800, Chris Down wrote: > When a kernel boots with a handover, kho_preserved_memory_reserve() > reserves each range of preserved memory in memblock, but it ignores > failures. If one happens, memory that a KHO user still expects to > restore can be released to the page allocator. This needs memblock to > fail to grow its reserved array, so it's unlikely. But if it does > happen, the result is bad enough to be worth handling. If memblock_reserve() fails we are in a very unhappy place. Do you think we really should worry about KHO state when we won't pass through mm_core_init() anyway? > Patch 2 makes the walk stop on such a failure, so that > kho_mem_retrieve() drops the handover and the boot carries on without > it. For that to be safe, reserve_mem_kho_revive() now reserves its own > region, and patch 1 stops kho_init() from releasing inherited bootmem > areas after a failed retrieval. > > From a quick check I did with one of the reservations forced to fail, > the kernel logs the failure and boots without the handover. The > reserve_mem region stays reserved, and a later KHO kexec out of that > kernel works. > > v2: > > - Drop the handover and carry on instead of panicking, with > reserve_mem_kho_revive() reserving its own region (Mike) > - Stop kho_init() from releasing inherited bootmem areas after a failed > retrieval, as a separate patch (Mike) > > v1: https://lore.kernel.org/r/avQUquBK6cO6tUUI@chrisdown.name > > Chris Down (2): > kho: skip bootmem setup in kho_init() if bootmem was inherited > kho: drop the handover if preserved memory can't be reserved > > kernel/liveupdate/kho_core.c | 28 +++++++++++++++++++++++----- > mm/memblock.c | 8 ++++++++ > 2 files changed, 31 insertions(+), 5 deletions(-) > > > base-commit: ec459d99ed222228b3d601818fd1e24822a450d6 > -- > 2.56.1 > -- Sincerely yours, Mike.