From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 394E2606A31A for ; Wed, 2 Dec 2026 10:59:13 +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=CdKk7AnR Received: by kanga.kvack.org (Postfix) id 5E4946B0681; Wed, 2 Dec 2026 05:59:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 594EE6B0684; Wed, 2 Dec 2026 05:59:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4ABBA6B0685; Wed, 2 Dec 2026 05:59:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CDFC66B0681 for ; Wed, 2 Dec 2026 05:59:11 -0500 (EST) Received: from smtpin03.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6410B40291 for ; Wed, 2 Dec 2026 10:59:06 +0000 (UTC) X-FDA: 85498745892.03.D9A9103 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf17.hostedemail.com (Postfix) with ESMTP id C4A8640005 for ; Wed, 2 Dec 2026 10:59:04 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=CdKk7AnR; spf=pass (imf17.hostedemail.com: domain of pratyush@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=pratyush@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796209144; b=t041XlE/Eirg11jAhIcTs8+HAymXFl2eDtq4IeueeAk+1iZykwD4//HXDQPsNNHQPgGCxn uKKMHL4WHJI9VemRqDAtGVnLhjGqIg5YdCCz0Eqxp8665UbtL+DE4BdVmybPkfG90Xc+kH Bn+Ew7rvrvVCcVzigfDtkHnparha/SY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796209144; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JPxE3S8G5XsvRzeRTLGd+G/IODPjwtlxgHGcZBJZAps=; b=AponomQiOlDDCs6oZUZxjeBYRMMdcT8C+Eh9a67+XDwKGvI06AQpoRJ9FjMf/7IBLEOTMe iHk+u/5KZHHyUN+PqyZlbHFCb/MYqFuZWgmca9z0pIEVR1M17WxfDHcOs0oD3s5IGPzcsf rKjTjajjDX1FJlQOR09dWneG4PA2bac= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=CdKk7AnR; spf=pass (imf17.hostedemail.com: domain of pratyush@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=pratyush@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id BFC2C4074C; Wed, 2 Dec 2026 10:59:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C05671F00896; Wed, 2 Dec 2026 10:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796209143; bh=JPxE3S8G5XsvRzeRTLGd+G/IODPjwtlxgHGcZBJZAps=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=CdKk7AnRuhFw+Ro8BeOTB6qctktnOhFCRBgsRflg2eVwGqdPLSW3nsC2N6UPRggNb l2/qZ7/8i4XSup7lyE3huLFWPkzBDGXBQpSMTBzX9JoQQ1GT0UjPFiLI/5U28s9RXH Pn1eWv90yjJQw0dw3ACCbxGAf5vd7Xcdk+OpgOOcZdlwB9LQBqFhIdRfdbSE1tTBS4 ErnU3PZShqceTZ/4hUhr598SnjRc2jsHbzSGVzC533VLM0wIIIhmIEt96nfOgvt2cH ikS6TjnEoTDaib11zneVCjkpHWhx7Evez8iuQt9ypE93P3bmqacJPvSBB9NgbIWvpA 1+Vy6VU6ckc3A== From: Pratyush Yadav To: Chris Down Cc: rppt@kernel.org, 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 1/2] kho: skip bootmem setup in kho_init() if bootmem was inherited In-Reply-To: (Chris Down's message of "Tue, 01 Dec 2026 22:32:09 -0800") References: Date: Wed, 02 Dec 2026 10:59:00 +0000 Message-ID: <2vxzmrqouex7.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C4A8640005 X-Stat-Signature: cyxro5qu8msy3x567aiepcbquos3muhg X-Rspam-User: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=4.0.1 X-HE-Tag: 1796209144-350443 X-HE-Meta: U2FsdGVkX1/jZCya2Qn4x542v9fXe4kZN34XDLEki+ahC2Ic7oQKn+0A88e7N1bq0R2mZLXphBfcqFsS7ducEfxTfCHYH22Zo+JAXOhLE9GREXv7HexmhQRz2sRfrWzEovL+0dsmCx/e8zbYywwVXHikiqBwbz+Mu2EW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1ynZuqRIQMRltoXqQI1bWMatyr8ypgq3wdGMBgaYwYUbrV9bapaBnwn/j5kFx9Z7Ugk58/rqSqlyA718kIfKxaCx7/fCeseEGij9i90HrtLbUGfSmuLpl402BeTiiRuRe8ugNZbWEK1my848YMW2E/3u4aoBzFYFM4obyW9XXeJNHhGRJrqXpByz1AtsWMxQcnZKWlm0n3Juo4x7uyMA8+wimPI/UBOJmBdDGW+RFO+9vKQJcT+3d5I= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Tue, Dec 01 2026, Chris Down wrote: > On a cold boot, kho_reserve_bootmem() reserves the bootmem areas in > memblock, and kho_init() later releases them to the page allocator as > CMA. A kernel that was handed its bootmem areas by the previous kernel > boots out of them instead. kho_init() must leave them alone. > > kho_init() tells the two cases apart by whether there is a handover > FDT. That doesn't work if kho_mem_retrieve() fails. It clears > kho_in.fdt_phys so that KHO users don't treat the boot as a KHO boot, > but the bootmem areas are still the inherited ones. kho_init() would > then run init_cma_reserved_pageblock() over memory that is in use. > > Nothing makes kho_mem_retrieve() fail at the moment, but the next > patch does. Test kho_in.bootmem_phys instead, which is what > kho_memory_init() uses to choose between retrieving the handover and > reserving new bootmem areas. > > Signed-off-by: Chris Down > --- > kernel/liveupdate/kho_core.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/kernel/liveupdate/kho_core.c b/kernel/liveupdate/kho_core.c > index 15fb892a4412..43ecef317cfd 100644 > --- a/kernel/liveupdate/kho_core.c > +++ b/kernel/liveupdate/kho_core.c > @@ -1928,10 +1928,16 @@ static __init int kho_init(void) > if (err) > goto err_free_fdt; > > - if (fdt) { > + if (fdt) > kho_in_debugfs_init(&kho_in.dbg, fdt); > + > + /* > + * We've booted from the inherited bootmem. That means this kernel is > + * already using it. As such, leave it alone even if the handover is > + * dropped later. Nit: I don't understand what "even if handover is dropped later" means. Doesn't the handover get dropped _before_ kho_init()? Also, perhaps "even if the handover fails" is better? > + */ > + if (kho_in.bootmem_phys) kho_memory_init_early() clears kho_in.bootmem_phys on failure. So this doesn't work. It clears it because kho_memory_init() uses to check if it should even try to retrieve preserved memory. Perhaps it should only clear fdt_phys and kho_memory_init() should check fdt_phys instead? > return 0; > - } > > for (int i = 0; i < kho_bootmem_cnt; i++) { > unsigned long base_pfn = PHYS_PFN(kho_bootmem[i].addr); -- Regards, Pratyush Yadav