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 21A15606A683 for ; Wed, 2 Dec 2026 06:32:16 +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=fkniwqLg; dkim=pass (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=XkgseYvK 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=duF63pS7s/KLnhNDbUh1h8fcQMn4QPw2BwBiIP1lzo4=; b=fkniwqLgGlvEBS4IUPD3gTlCpS HJwU1M9mGQfWo9GN9DzJAnICT7fQ/puif4UuJT+3nOdLm1Zx3CRKAqu7ZqU4uqSPvWGlkLuw4jMWg aiUOolnrB2LI8mlHJWYb+/KIE55EvFH3nVvZE3Bvg/pIg/zF1SmjFeTDURjcavPDvEVXrYGDB15Qu C7Ymfj0C6o2+ebw6pMERZSNGxbI2c8wy49b1a9/OvyethyaaSibm9uVBxLxyMtbG75O5Vvu2IkoFt VQckNErCzBEp0PuOTUS1//CjQ4VvH1R6ENQ6Lyiruv20f33uVOAfFQLq3QpGe2dqOna9/4SQClt1q 0IyxUvlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYdt1-0000000AP3Q-30eI; Wed, 02 Dec 2026 06:32:15 +0000 Received: from mail-yw1-x1132.google.com ([2607:f8b0:4864:20::1132]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYdsx-0000000AP1n-2yyP for kexec@lists.infradead.org; Wed, 02 Dec 2026 06:32:14 +0000 Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-8b4dbdc9592so35005967b3.3 for ; Tue, 01 Dec 2026 22:32:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; t=1796193130; x=1796797930; 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=duF63pS7s/KLnhNDbUh1h8fcQMn4QPw2BwBiIP1lzo4=; b=XkgseYvK4yltvMIOxUkEB6rFIWR8my19Cf5IQr4ao+Bh8mSH2w/+g97uFN54f2yEOT j9PmUsB/V3GRcPcYARqrO+iEQvFyYut16UfrkB8pvJj9ynqpDI52bGVW2ygSNDB+Ii+m pGdVAsBo9ClpwSs99fgQPWRNyYKeiI7nGoS24= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796193130; x=1796797930; 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=duF63pS7s/KLnhNDbUh1h8fcQMn4QPw2BwBiIP1lzo4=; b=AmU3qdw28aABP5xVjvtoBiedximymbVkiz0apJQnSeLeqsNSvyIVrC2Bpd5tcu9vaQ bjjjQWKZogTAGfVDcrbAF33qjS41lJt3QWT8mvjbNKNxNwMHjBesE8M7a45CrdmHbg4b SbofVUJRNKPXNoGBQ/bSeaienXqEgRJBS5GhzhnqTpGpYav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sOybN7qRruXMMtVZaz9Y8ix2Dj4LTtcggzbSuK3feN mkzTWuYt3pGF6752+BJ6VUj5uBPn1caAtFza8sbVXCI3nhxddis9fftPXftrPLkFFG7f30Lo8bW i4GvYo/98wmTOrcYx6lqP8YhhtxyR3rtfrec0mVtt78/P199//Ij9Dr4jXx9xDNapzALFB5aa9e Gm51zIgzGYSUFad+Mb2M3tS X-Received: by 2002:a05:690c:6d8b:b0:8b0:7c07:559e with SMTP id 00721157ae682-8b5204b53a4mr199687667b3.36.1796193130074; Tue, 01 Dec 2026 22:32:10 -0800 (PST) Received: from [172.20.0.3] (c-73-207-185-9.hsd1.ga.comcast.net. [73.207.185.9]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b5201bb6c7sm153848927b3.6.2026.12.01.22.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 22:32:08 -0800 (PST) Date: Tue, 01 Dec 2026 22:32:07 -0800 Message-ID: From: Chris Down Subject: [PATCH v2 0/2] kho: handle failures to reserve preserved memory To: rppt@kernel.org, pasha.tatashin@soleen.com, pratyush@kernel.org Cc: graf@amazon.com, kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com 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-20261201_223211_777312_A903E93C X-CRM114-Status: GOOD ( 13.26 ) 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.4 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 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