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 61E2B606A322 for ; Thu, 3 Dec 2026 02:58:42 +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=NOdxfSKz; dkim=pass (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=LIor93oT 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: Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=WpWoiqM1sQaKmawupr4t61Op49rdqjR2+ecyls6gY7s=; b=NOdxfSKzUJbrHLrEdYdXp4f2X3 3LAbOYFWlN6yO5WQTrtG0iXAEyTDDClgqeWQsuPP7VtZPiphO+/Mogh6lOTGVIk2jMwtvuA807KAz kumwJ/5XA7W03kfKA80bZ7EZXMx9K1jW01hTHU4Zxm4uWra8xd3hc0xYCrLXyfSxOvvMHsZD/Gjeo 4spHQiLeexWeFCD8InpGnz3pnrAoyGeJGne6vJpGI3ytzzKQJoZsxeksbxsUkaSb9fU8B+LWxm1AR u65NmGnEMysieYTD1qlJyF9hJsJ8MtHsRu4HLphDgULWWMw/ZDtuGZcLjLGSOchbyH1f/PTmmsxMr P7dFKndw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYx1u-0000000DIPh-0F5V; Thu, 03 Dec 2026 02:58:42 +0000 Received: from mail-yw1-x112a.google.com ([2607:f8b0:4864:20::112a]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYx1c-0000000DILf-1t1W for kexec@lists.infradead.org; Thu, 03 Dec 2026 02:58:38 +0000 Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-8b4c2da74c0so90904207b3.1 for ; Wed, 02 Dec 2026 18:58:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; t=1796266702; x=1796871502; darn=lists.infradead.org; h=user-agent:content-disposition:content-type:mime-version:message-id :references:in-reply-to:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=WpWoiqM1sQaKmawupr4t61Op49rdqjR2+ecyls6gY7s=; b=LIor93oT5y1SIzPPqk24liC+F5Kyq88i7WjSZw0B76R7mIKkpZNog9sklB5rBKBhts 3Dt0igB1W7bRrgW3nF59gwOQVQ++G5IUcz1Uj1NxKD/Ijlw5q6YUt/RlTFAR9D9F5JGM mdVDgy3fWdcri5OvmFOj15bETO+Ok7oLd8U7c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796266702; x=1796871502; h=user-agent:content-disposition:content-type:mime-version:message-id :references:in-reply-to:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=WpWoiqM1sQaKmawupr4t61Op49rdqjR2+ecyls6gY7s=; b=tXTNXUv03EJ+xGpvoiyGif38YzgxT5t/MeZw5MkIFvb0KVTkW3nxqEGSV5g7uxH1i4 bVF3HES8aydD00aUAU2a8ynxtijHGtOxDw4xl3K6Iln6C/JzWGdzDf41X0w9Fq31LXbr OtIxHLiiIZLmCKtOPo/QN8gj0jJ1arxOnlUXKtCkTrXLNa8nBKq0DUog0nv33uhvOEfL TMBiFxbywHGZdlfLMwbeVq7G65K+CESmDqUTkpayH3E9BnVbP1Gkz6BscjD2iQOAgg5k FjgW5oQI+bU9QcrRcf8+ffD/tSaKpZZOtILoU51/7aDkFODDdBPBlbVSco6pSdg/L30W GIHw== X-Forwarded-Encrypted: i=1; AL+hErGjbk2IEQAbkgwuywbs6O5fLUWr0XSiIFHgOrz7IvPuYzTa6xP3fTfhyq0qrNYujM9BpipU3g==@lists.infradead.org X-Gm-Message-State: APuU4Z/4nCMKCjjF+cIjb+41fU/p4HmsoCD8TMv9+fsjSmzUZWj387yx mwHP0L1c+X4mRYao2gwre1y5IFFKfVt1Hd6JCH4kc0UEqeD55PlEnTOsRNYC/BlTMQ4= X-Gm-Gg: AZFdTZeDRHRAdLNKJDs7f6qcHM3CGut4P4B8cpVZECsqxEdR/LqvRkyD05OS23HA2pf Y4ffARTsDzdsvsyu61/fibQMwESipTLWd2dF1LEvM2D1tIgxLwi4CDkqU6ICmqiG6vi6n65Te4O pwWAlKClKvIrX7N4iKTVmC+do3TtgDMswLcxdvpzox39nAWUJc8twvnMvtjs5TuPHWvArVc84A5 ZMCx0BsqUzZTZHnGZ3VlPtR9ShQLT2oAQI+jloap+FbZoB87BaWj8DZxs2se5YfKx78NY2UEfWT YXXKQgAEJtm/MTLx2dOgY2dpMiCtFq5F+90pWLJgaKSV21CqKugzfnxT1Cdid0N1y2tBfSFkPZ0 1D1+/hw11E2vx6NbCLuHWC+HhEY/8YC8lubjDA1YSOLGHREFK1YhLS+slYg5HlgfOyno1yxwXHa j6PbdwgACB2zgRQMPo3LsILjm8krq9osCYjQbchKWF9uBljbRBGLKDFAGGBEeuuH217De4rOHzR utjTha6IGuAfFH/aEtsEPT0voGfvkRTzjhs5K1N/CxyQmbbt1tlVu8b2X9azgnOIAqaaS8oonlD Er6IFr5CKyOwbQ4KijBZqFMxXmve+1rzXoSm38+G2NRpbwU7+1jHtUYWlPLCqQYAMLRCNA751ME zaKLx33SZglwKXeJVO4PBnwb9BWoVAKWOldewhbXxuAE+qWUKcnnxOXEPuJijWrCxlCr8DEv76C z6dynwinaBR6efFK9zox5Jw1lNS+0pPxPtmIORAbkN367c4GyEI1rFjPFgn2TGKFfJGf4tPq0Jk v1gWQgy4AI2nyppvu2n/7k= X-Received: by 2002:a05:690c:3745:b0:8b3:7f47:8ad4 with SMTP id 00721157ae682-8b5204b50f5mr150462197b3.41.1796266702220; Wed, 02 Dec 2026 18:58:22 -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-8b52036d72csm164535387b3.45.2026.12.02.18.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 18:58:21 -0800 (PST) Date: Wed, 02 Dec 2026 18:58:18 -0800 From: Chris Down To: Mike Rapoport 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 In-Reply-To: References: Message-ID: 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-20261202_185832_501383_A0A80F2C X-CRM114-Status: GOOD ( 13.67 ) 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=-7.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 Hi Mike, Mike Rapoport writes: >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? I am not an expert in memblock for sure, but as far as I can see the following can happen reasonably: 1. The memory map is allocated in mm_core_init_early(), so the walk has its memory already. 2. kho_memory_init() is the last thing before memblock_free_all(), so nothing between the walk and memblock_free_all() allocates from memblock. 3. memblock_free_all() may have to grow the reserved array itself, but it stops restricting allocations to bootmem before it does. Once it has run, the kernel has plenty to work with, including whatever the walk failed to reserve. Or am I missing something? I've now also managed to hit this without forcing the failure. I preserved a memfd whose 140000 pages are interleaved with another file's, so that each page is a range of its own, and used reserve_mem= to fill most of the next kernel's bootmem. Without the series, that kernel logs memblock: Failed to double reserved array from 131072 to 262144 entries ! for each range it can no longer reserve, and then boots to userspace as usual. Retrieving the memfd there fails with -EIO, with kho_restore_page() warning that the magic is gone. With the series, it logs the failure once, drops the handover and boots. It's still unlikely, since it needs badly fragmented preserved memory and a bootmem that's close to full, although it will get easier to hit if we manage to shrink bootmem. But the kernel doesn't die when it happens. It carries on with preserved memory in the page allocator, so I think it's worth handling, but please do tell me if there's context I'm missing here. Thanks, Chris