From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03B06606A31F for ; Sun, 6 Dec 2026 04:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=evxrP3pl; dkim=pass (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=oORqiCcC DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version:Cc :To:Subject:From:Message-ID:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=kf9dCXMxddXTU7yDL7LKSKkP0rTMaUQG/G2iCXZhJ2M=; b=evxrP3pl+jEE9Y7pf4+WDQ9tBO U2uUDI+HEQTX3KBe5tRQF1zhNxOfs+DLx/FMGwqo819nrtoPOob8TShM79/1ZQFBiFd5GgRg7hNUP TBRkv7m+II7U2sduEI6FHHYCHQmw0pk/MPWnk/bnZf8KZfbDmbRwCckUB1sfs1I7Pd028DhG1sHhw TjnVolyqEki3cEOheH10hVyxQ41O2sgmAyyH/sZP152x2cVzdheZzGfR2oazGJ6AJpbot6PSe1HGn wryGVe3uTqAX/Mar6E/TL/fP7HTt6ydPw6rkloeDzCZh5duQi0vhweTYPodH0bca7V0hm2EocsC2d hcpRmdMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xa3eb-00000003D99-0wM5; Sun, 06 Dec 2026 04:15:13 +0000 Received: from mail-yx2-x06.google.com ([2607:f8b0:4864:41::6]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xa3eY-00000003D8i-3rUx for kexec@lists.infradead.org; Sun, 06 Dec 2026 04:15:12 +0000 Received: by mail-yx2-x06.google.com with SMTP id 00721157ae682-8b4cc095c0bso5854047b3.1 for ; Sat, 05 Dec 2026 20:15:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; t=1796530509; x=1797135309; darn=lists.infradead.org; h=user-agent:content-disposition:content-type:mime-version:cc:to :subject:from:message-id:date:from:to:cc:subject:date:message-id :reply-to:content-type; bh=kf9dCXMxddXTU7yDL7LKSKkP0rTMaUQG/G2iCXZhJ2M=; b=oORqiCcCAPrj+ItIAJr0x31QkZqtQ6kOEgTHKnBb5Y1CRWwDUyfWy+kp7VeqjgvbUk tvPkaqlf7yB8DwFvylPhgyaKauJqUfKxibtpD1M20dF9IvdpEgApcnO2Ms6XzL5SbJng 1GwxfCx64jO8ufHY76Walj8rgi0q1yox6MelE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796530509; x=1797135309; h=user-agent:content-disposition:content-type:mime-version:cc:to :subject:from:message-id:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=kf9dCXMxddXTU7yDL7LKSKkP0rTMaUQG/G2iCXZhJ2M=; b=1iYs6UxgU4ng8YPQrZsa/9BnbRz52aWEzCYpTpivQNg33XlU0NNTJqx4tPbMgvECFd FwCuOaoPgLB8Fybl9ZiX/vh1DxONSKzRhPwdZiwifLm+YDGs+KYK3viEpU0gVgJrsgM7 VrkAEoMk3/Pw1qVgE6sn32liOXqNRInx0yB7ERZF1bt6yAMDiI18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1Y2OhkJC7J0py6Qo9KtHJxyI 1g9Phujvr6f/QCUNrzEccO7ZL+YexK7/WTP/1r7cmPQfwVD7g4RIbza5aQMAE0p8fDDIllhfyGn K0AjLi0Xmznzzxk0vCpMd7yPKFkWOvm4b3dRltRFDWTxaMeT7XBHjrG349f3CExjYJxeRsTAVU3 ox9pOJ+8mCMcLyEk5ENS9w= X-Received: by 2002:a05:690c:3343:b0:8b4:d882:4a14 with SMTP id 00721157ae682-8b659db2b13mr26859787b3.5.1796530509318; Sat, 05 Dec 2026 20:15:09 -0800 (PST) Received: from [172.18.0.2] (c-73-207-185-9.hsd1.ga.comcast.net. [73.207.185.9]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b6604050d7sm28739717b3.5.2026.12.05.20.15.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2026 20:15:07 -0800 (PST) Date: Sat, 05 Dec 2026 20:15:05 -0800 Message-ID: From: Chris Down Subject: [PATCH v3 0/3] kho: handle failures to reserve preserved memory To: rppt@kernel.org, tatashin@kernel.org, pratyush@kernel.org Cc: pasha.tatashin@soleen.com, graf@amazon.com, kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, sashiko-bot@kernel.org X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/2.4.3 (cc9e3943) (2026-10-09) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261205_201510_993315_6117A6BE X-CRM114-Status: GOOD ( 15.77 ) X-Spam-Score: -2.1 (--) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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. Patch 3 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 patches 1 and 2 make KHO keep treating the bootmem areas as inherited after a failed handover. >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. This is based on the next branch of the liveupdate tree, as it needs the CMA accounting from liveupdate-7.5 as well as 0e88c65680e2 ("kho: don't release incoming bootmem areas when kho_init() fails") from mainline, and only next has both. v3: - Check kho_in.bootmem_phys for the CMA accounting and in kho_init()'s error path as well, in a new patch 1 - Keep kho_in.bootmem_phys and kho_bootmem set when kho_memory_init_early() fails, and don't reserve new bootmem areas in that case (Pratyush) - Retitle what was patch 1 and is now patch 2, as it's no longer only about kho_init() - Reword the comments in kho_init() and reserve_mem_kho_revive() (Pratyush) - Say in patch 3 what it takes for the reservation to fail (Mike) - Show in patch 3 that the kernel still boots after a failed reservation, with a way to trigger one 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) v2: https://lore.kernel.org/r/cover.1796126791.git.chris@chrisdown.name v1: https://lore.kernel.org/r/avQUquBK6cO6tUUI@chrisdown.name Chris Down (3): kho: don't use is_kho_boot() to check for inherited bootmem kho: leave inherited bootmem alone if the handover fails kho: drop the handover if preserved memory can't be reserved kernel/liveupdate/kho_core.c | 61 ++++++++++++++++++++++-------------- mm/memblock.c | 11 +++++++ 2 files changed, 49 insertions(+), 23 deletions(-) base-commit: 13278f869c76f01ab1a6f6c694f718d9f487bd68 -- 2.56.1