From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCF0C22A4F8 for ; Tue, 18 Nov 2025 13:19:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763471996; cv=none; b=P+3UTOR8Hin/8RirkN4ufFlfobxOCqm0D7J1KD6c+iD/J8flfPnpEOTXLROIpJew0jnUaJeLVPQLEU5rpRav2//IHx2f5iY+uJjRNUSjx3CnH5HzJcf++P3f7Deyoj74sa38IGqJ7y38o/yOojrdrKAlqkM8C0PguzVCYv+a3oI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763471996; c=relaxed/simple; bh=xEfBSU/j2FGHLktRs1aJpVOnTyEUSa7gj3GAPsupGvQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=VzabcyOly2RDQNfDssJY7WhjKy26zfL8qtjD6qNO7GLI5DOCr+exdq6rO8B2KwxBGcfF8VoUyyAkDuoidYmrk/ysCMC0Xd4DDgftFOLfNPUZeRdl4Hd1L22vdNL7BW0crPK9gteqdipk1uooBO5iPqCR1/gljjMJxRYI3TEKqkA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hV0NNWcz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hV0NNWcz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A61BCC116B1; Tue, 18 Nov 2025 13:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763471995; bh=xEfBSU/j2FGHLktRs1aJpVOnTyEUSa7gj3GAPsupGvQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=hV0NNWczFRQTiTZisfgnxT6TTqxqtFrXjsbKyb/0jDkDe2CrpBvZ/G2YqiqGlBI73 R4nzPN9VYeC/GXv7mcuEy/aD8p3BqFLyJP0Wp38xjy/VF2tuBQ196NHv3yELc6DNAA wxBNAGkleKSIxy4uCkWPWnfh63pe4dskhjxYuQQrRxt6dzcA/yAO6cAYO6bcae5Sx1 4x3W6yvi8ew5rSru0nUcozzx1O6R5QI68W9WqQlPMyktTnruNnWGFFM/3afmir6ohQ tTvgMSpyOzhGJfSD452gMmMLUV94nA1bhEUDFYTdB8eSuCpk/d2tM7D2RyFxb4dtG1 cz6tdOvb1RJQA== From: Pratyush Yadav To: Mike Rapoport Cc: Pratyush Yadav , Pasha Tatashin , akpm@linux-foundation.org, bhe@redhat.com, jasonmiu@google.com, arnd@arndb.de, coxu@redhat.com, dave@vasilevsky.ca, ebiggers@google.com, graf@amazon.com, kees@kernel.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-mm@kvack.org Subject: Re: [PATCH v1 04/13] kho: Verify deserialization status and fix FDT alignment access In-Reply-To: (Mike Rapoport's message of "Sat, 15 Nov 2025 11:36:19 +0200") References: <20251114155358.2884014-1-pasha.tatashin@soleen.com> <20251114155358.2884014-5-pasha.tatashin@soleen.com> Date: Tue, 18 Nov 2025 14:19:50 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Sat, Nov 15 2025, Mike Rapoport wrote: > On Fri, Nov 14, 2025 at 05:52:37PM +0100, Pratyush Yadav wrote: >> On Fri, Nov 14 2025, Pasha Tatashin wrote: >> >> > @@ -1377,16 +1387,12 @@ static void __init kho_release_scratch(void) >> > >> > void __init kho_memory_init(void) >> > { >> > - struct folio *folio; >> > - >> > if (kho_in.scratch_phys) { >> > kho_scratch = phys_to_virt(kho_in.scratch_phys); >> > kho_release_scratch(); >> > >> > - kho_mem_deserialize(kho_get_fdt()); >> > - folio = kho_restore_folio(kho_in.fdt_phys); >> > - if (!folio) >> > - pr_warn("failed to restore folio for KHO fdt\n"); >> > + if (!kho_mem_deserialize(kho_get_fdt())) >> > + kho_in.fdt_phys = 0; >> >> The folio restore does serve a purpose: it accounts for that folio in >> the system's total memory. See the call to adjust_managed_page_count() >> in kho_restore_page(). In practice, I don't think it makes much of a >> difference, but I don't see why not. > > This page is never freed, so adding it to zone managed pages or keeping it > reserved does not change anything. In practice, sure. I still don't see a good reason to _not_ initialize the page properly. It's not like it costs us much in terms of performance or code complexity. Since kho_restore_folio() makes sure the folio was _actually_ preserved from KHO, you have a safety check against previous kernel having a bug and not preserving the FDT properly. And I get that the FDT has already been used by this point, but at least you would have some known point to catch this. [...] -- Regards, Pratyush Yadav