Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796193131; b=zci3cezcyyoLB03m7L7lSp5wfzbGqTBAtfjCUXRhoZnq2FqBt6dcCmWdRz/AwZpNmUfW vkjDGugZDhfll60sEWmEntdQu1VuR/Rv3Lajm/2FJ9iSH+6m1B4Vt6CD/RS03vqmV6VJi 9qOM+iwfmpiQv1RBuCNe+dIFYhJ4PmtDBBJEh4n4CPNLcTC5UYr0Fz86Xnz4GDQrc3v2I HNTnexDSszaRHZDEs+5tuyUn2+9GWvXswvSj3b8q4vlcNw2ohFSk5SK9EJsouji0Ux1UB C96s60rk03N+mVugOR8T8dfVbkqTxHW2CyUaMJxbUFHzj3iselzbFab0ekvnR1zSRvg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796193131; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:Message-ID:From:Subject:To:Cc:MIME-Version:Content-Type: Content-Disposition:User-Agent; bh=duF63pS7s/KLnhNDbUh1h8fcQMn4QPw2BwBiIP1lzo4=; b=bpF4eigpIMu/kmh9+riXXI074wKvBKB+MWIIqLDtJYHDq/3Oj5A3h63VBapqbTdodJ3n Q7cU68px/r8g9HSapY8xjgt/TcTkHDKWd2t252beENNwNkGFcvQgXnfAtMO18B9iA9wEE Yi1wOrgARmgXgBgNx5oE6sILhWTQTQ1BsX9wWLoLXq9sKlMG5mDz9nxWpjQfxi+sXq3p1 m8F5YQkHCot37ttbmv0hXagusMcJdSEcrjNJNftuQD2zNE2jQG0nD1yr6o2yayLYQPA4n kyVQQrcKk0qSksbtOS99nMdMCQPVpF8R4ifmqmcqvGyGRsIzSRPZ7mJlqAxrbzL3q2w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=chrisdown.name; spf=pass smtp.mailfrom=chrisdown.name; dkim=pass header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=Z63vU7wN; arc=none smtp.remote-ip=209.85.128.172 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B190606A31A for ; Wed, 2 Dec 2026 06:32:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1B190606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=chrisdown.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chrisdown.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=Z63vU7wN Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-8b0ca1ebc8bso112568107b3.2 for ; Tue, 01 Dec 2026 22:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; t=1796193130; x=1796797930; darn=vger.kernel.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=Z63vU7wNL4M1XIsBZWAIx2i0rT8jgVDxfWdoV7J70ROERIo8mSYT+/bARjN7NJBMz/ tOh5SSsat8Ni1alb87FOkcdn82FfhT7QCwmooWpQnstH+VeIWHBm3Nu21bkG1NaQoP/z TVD2pHVutSJ9BdFMTh+KxDfesflAGBCeaDk74= 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=qVbV4ZQ9F8wb1Q6KIln5qkSyB/Y0xZcHBSlanVA9Vw+G1gWMJ2ye+TVS0j8nDft+qU 8t4girI07LzZhOzVDsbteAjzaQvV7WkWNzImxm422OkuGcbQUEWSoYzGwhH7cQx4AP7A hKgC1yR3QSBmSKdJNcwxJISlJ5ELAScmOTPuifqSClvlJs4dUGlxS9Mqbb7nrVEIlL7Z q7vF+iEPDuIgyGahf+mtx5/MaPqZTN6aGYWKoRkV43tAABA6eXjOQ/r38PGhwhLvFx+w O/1goqj83Q1YXxM+BW5FKlmNhAbG7KF1400zO2ReVLSvzZPaCA66EayEGbCY0nXgJczV 98GA== X-Forwarded-Encrypted: i=1; AL+hErH0WxKOsWKyFCCcyvOXuVCdRc9vRVlfLsjaKnJHgJcHiiG13n2vJE65dSJtbNtbMgAXtAMdD6m17LKcD44=@vger.kernel.org X-Gm-Message-State: APuU4Z9ylZrLLduwRAHmKEuhqxu8ilW79UtIsWySUu9AqzvjHEITEx+I QKPLZQEvadhjsAdzK3j/4W7xQNBaVIzS31GAsG+lDCZ9VQf3N5YFS9ce1+DaQXZ6QaY= X-Gm-Gg: AZFdTZdiyJT/c7Z7/1JnRUG8DhECpkca7Oe3F2oQgYAW4CSSo+zb0kxNGbENxmZQbeM T3Kd9/l6Hu0EMMbDTixrCZ8mGLy7UP/fiEZI+YBiSTFkB0JAB3nEsGwF7RVt9x6OL8sbYcB3wXT 5f/psCxk196Rsl0WWenfZSEv+sWf0xMSsMAyo9XxKHsrgKLaVKpxYXPfwr8Fa6tzlazu101Kqfw kxc0OQTMOe6mewks5FeBleeCBTdGbrutu8aaCFsptPHBv1ZSHpOWBDLNEnRCrddAtknLf3/ocxw lUMFdI6CDgQx6BsZIRW8Ji9vTzExCzd5+fjUd3rboawDt4cklwK3KgzAZpJ6MKYNjG77ODZNU8E K6cw4u8rIp53fKARhgcSObi1sdHKNDkLpmn1dxjVLv+HvCCrDjfEtcD2DdBF672vIhuKra3iiGC /zGlxDwZjBxdB3aviv393l7Gu38/zx0sqArBTxHve1N4IwDYxLg4bNwIPZYsMrJt3qmRzURMdob cbYplyWApeUDyv/qgn3Uxib4CI7tz5WZ2DYMrsNy24H4FcHCZOXXVj66Q0nvxpYpoJBq6ZOq9J+ bLR/pVFxVN1z9fznssFVPTqhNjyoOfO6dDHmCW3JatFaTv4M5oFLGJUmp7O2QEH4Z7pK7yEpuhy 1s/YMnIu2sWnTSZhm6VFlZN0SNF7SUfTSPMl36EawMoUZi9bQMOuFV3px/kpcPkVAyo6YKkUHVv R8F3T9wqEqgwTeLoWCT9NTQF0KFAawWTPzBQS3pJHBn7tGxIU7NRqzJI8p6Bwbf71HCWSt0GjYc OUXN+wgLedElag9PkdEtZ3+ 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-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 User-Agent: Mutt/2.4.3 (cc9e3943) (2026-10-09) 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