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 17546606A322 for ; Thu, 3 Dec 2026 06:32:28 +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=nIp+4pZr Received: by kanga.kvack.org (Postfix) id 16E8B6B00EF; Thu, 3 Dec 2026 01:32:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 11E9D6B05B1; Thu, 3 Dec 2026 01:32:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 034D86B05B2; Thu, 3 Dec 2026 01:32:26 -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 D854D6B00EF for ; Thu, 3 Dec 2026 01:32:26 -0500 (EST) Received: from smtpin12.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 64DBD1A05AD for ; Thu, 3 Dec 2026 06:32:26 +0000 (UTC) X-FDA: 85501702692.12.86DDD03 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf17.hostedemail.com (Postfix) with ESMTP id CC3B34000B for ; Thu, 3 Dec 2026 06:32:24 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=nIp+4pZr; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf17.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796279544; b=W/J7NsVxNpWmyDqV0PwH4XtSqhMCR1uxHmw7UpIsTw67WvpkJ9ieGqedxaF5FeIxxL5amq OwQ9hbNeukkH+VjvLbm6aK6FxP9KPncgmhI8GI/gLiUWYd1Uo5u2bwObiYm9oU/zwK6P3I 4k/gHtZE3Jw0najd7liLMgssCnaIudI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796279544; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IOaiKKSSnJKcoSyqWbUOL4152C/cZVHE2/Y3vD1qoLk=; b=COCRWQT8qmIxgLzEytft1ZPBe15ryj2YolPg+EnHKGgU1NO5HQedMqvu88J1hX48n7FXek 7j6vtRtcW6z7KLiXJVLuYDh4xGJNyw+GRrs3ZAFWwKFsR/p+pNSDfBedSuEMllL+FHzeAL 1kURgzN1+Q0OsFpDEh/NHmh3bzS47/w= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=nIp+4pZr; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf17.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 8388F60617; Thu, 3 Dec 2026 06:32:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0D821F00893; Thu, 3 Dec 2026 06:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796279543; bh=IOaiKKSSnJKcoSyqWbUOL4152C/cZVHE2/Y3vD1qoLk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=nIp+4pZr6gWeNWKAgThfkAYol8LqVyd7xDDQ91MULH+dLSIt1beh2qluaeL6msd+u /ASBQJLWURbGmhRtdIyg9qAbxNWiCKIIH0EZkcojLMQagVA1Jgdo75UP6B57RkMyjG OVQglk+Lbd6qm5+/H7eRxvoHjbxZBf+TlG2LxsEQTtVESo2TopCmF3B4+o5SHIEnV/ S2Su5HlTXG6xCKnRH3Y971ZK0lu3x6+gWFxJXZDL+IFgpOtMqCLl5mPimW721flGjb C9IallPdaP/jz6w5vVodWiXvWMuROuFZXvgNSfP+61khox63uJEY7kaITk6dbb4nJY ComhRxIQt9ttw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 1/2] kho: skip bootmem setup in kho_init() if bootmem was inherited Reply-To: sashiko-reviews@lists.linux.dev To: "Chris Down" , rppt@kernel.org, pasha.tatashin@soleen.com, pratyush@kernel.org Cc: graf@amazon.com, kexec@lists.infradead.org, linux-mm@kvack.org, kernel-team@meta.com In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 06:32:22 +0000 X-Rspamd-Queue-Id: CC3B34000B X-Rspam-User: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Rspamd-Server: rspam03 X-Stat-Signature: a61fjaeh6cp43jec83u9ighf851smo95 X-HE-Tag: 1796279544-526622 X-HE-Meta: U2FsdGVkX1+eKzLqFI0npPI6ciD2JFQQdRIps66EAEyRWLFhZL7yMMHsvbJD1PUtKSdHZyRx9UyXxNcUSCVWOVkMhjtIZOknkAUW1LChosTSdLLt08WuBO5zaFJHRF4u0sHY1pF0xWKbG6Gf6njzWN6OPivOLXuX7+9Wrhc0Ofk3hfcWA++z37cIcrEOgwMdH/rYgZAqLlnb7Y97oMhWeJQnMZzpQFPnJKH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PI0KGmJj1r/1WMdS/8iuPQgmnY1sToA8nP5JlG3GJP5SioTG9tY3TltpHTnFo0q9VcOeEmUTSXNA2yY+vECNn6fC6DUGuD+aSZTCT8bMqWm3DNR519MbPPFdY5r/HXZpOHLNgBUfZRRMPG/0xHHEDHcPw0qA9O1dp5ZmXoWr9fT5rcU0iyBblv1uo/7D5uU0Dg51M+N/5hCWwiBrSOjatuqbnyix2I4OWJca5HaGO/jph0ootfEFZSnPGuXH+c/nlLq6aobYX/wPITjI6A/tiv6d/s7lILn+VnOeZsRYc0D6Lh6vVIdfWjTg5wfTPq0Mm3GqAHvD7HFrZrqkq9hNXlCbjS06UNX7Hc+zvCTqwlsFesvOF/SIgSbVy4tgVZYihaKgjuYQ04LwxdA462oAxC7clpzMlG5pK7brrA4z8R82IpY1zEllVz8FYoyYh/0ymrMqxV9lQMeKg2e1OX5FFSzH0TeoZJTF1uPrarC+cYaWvvW0kMbN3S/5spKEuN+XwZI= 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 X-Archived-By: Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] kho: err_free_bootmem in kho_init() frees active inherited bootmem - [Medium] kho: kho_init() skips CMA accounting when kho_mem_retrieve() fails -- commit 8ab45df6c0cc32b7be0a781a67fbb61c13c0156f Author: Chris Down kho: skip bootmem setup in kho_init() if bootmem was inherited This commit changes kho_init() to check kho_in.bootmem_phys instead of fdt when deciding whether to skip releasing bootmem areas to CMA, so inherited bootmem is left alone even if kho_mem_retrieve() fails and clears kho_in.fdt_phys. > diff --git a/kernel/liveupdate/kho_core.c b/kernel/liveupdate/kho_core.c > index 15fb892a4412d..43ecef317cfdf 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; > =20 > - 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. > + */ > + if (kho_in.bootmem_phys) > return 0; > - } > =20 > for (int i =3D 0; i < kho_bootmem_cnt; i++) { > unsigned long base_pfn =3D PHYS_PFN(kho_bootmem[i].addr); [Severity: Medium] Should the err_free_bootmem unwind path in kho_init() also check !kho_in.bootmem_phys instead of !is_kho_boot()? kernel/liveupdate/kho_core.c:kho_init() { ... err_free_bootmem: kho_out.fdt =3D NULL; if (!is_kho_boot()) { for (int i =3D 0; i < kho_bootmem_cnt; i++) { void *start =3D __va(kho_bootmem[i].addr); void *end =3D start + kho_bootmem[i].size; free_reserved_area(start, end, -1, ""); } } ... } Because is_kho_boot() checks kho_in.fdt_phys, if kho_mem_retrieve() fails and clears kho_in.fdt_phys, a subsequent failure in kho_init() will take this branch and call free_reserved_area() on the inherited kho_bootmem regions that the kernel booted out of and already released to the buddy allocator. [Severity: Medium] Should the call to kho_account_incoming_bootmem() at the start of kho_init() also test kho_in.bootmem_phys rather than is_kho_boot()? kernel/liveupdate/kho_core.c:kho_init() { ... if (is_kho_boot()) kho_account_incoming_bootmem(); ... } Before kho_mem_retrieve() runs, free_area_init() marks the inherited kho_bootmem pageblocks as MIGRATE_CMA, and memblock_free_all() releases their free pages into the MIGRATE_CMA buddy lists. When kho_mem_retrieve() fails and clears kho_in.fdt_phys, gating kho_account_incoming_bootmem() on is_kho_boot() while returning early on kho_in.bootmem_phys leaves those pageblocks unaccounted in zone->cma_pages and totalcma_pages, causing CmaFree to exceed CmaTotal in /proc/meminfo. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796126791.gi= t.chris@chrisdown.name?part=3D1