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 389FA1DE2C9 for ; Tue, 30 Dec 2025 16:26:34 +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=1767111995; cv=none; b=pz4eoB6rU2mBXIFbUX1TbDjOeX17YELwmmeT8LQ60P0bYcBXPbnCLNOc5qJXMjFVcAxa0OCCdERpEx36JTKUU87AddkCdGKQq9qwtkymCr59hoKmkorLrAvieD0Z6hiDbxtoL+GevBAQhmTSrQQ5tiomYuuTAIMsWKVTQheR3tI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767111995; c=relaxed/simple; bh=noWdpEVhxGi5t7Nr2JIuYUNiO+HkVoYB8qZqkKLGh80=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Fis8qxdfhxZ8JWYx2o4ZS1vvrCj200SqSi7927CZy0djxodNQLiTG+JRAZz92faeV+qzHHqQh6h1f8STOksRcxLTxHF+7dFpyDQfxaO8GbvyUXxOkNc4t0VouYPfNUt9eEiUSKs1SlaQJajkrfWtwpxM1O3I2iKmCbV5WGtopMU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lwbfIitK; 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="lwbfIitK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30B83C4CEFB; Tue, 30 Dec 2025 16:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767111994; bh=noWdpEVhxGi5t7Nr2JIuYUNiO+HkVoYB8qZqkKLGh80=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lwbfIitKUR2wkcqXy01+kxMaclJdqpjxOALjcpGS2TQK4eUvbWl4a4Yek/XeHrSbq V+CU3h+womQ1ItZTcAiQayJhr6HDRDmcKjiORQaGbhBaiztT3sNkMcetEuqpnkVe0h U1A+lI0ODDuBF06GqvB8d6MpkNEYFWlysJ9z5ZPp49meUdJG0evxGILRPYkNP/fHnd h9eC3JtLXfBRkWEGCzoseFllk9Uy9w5KJ3rAioh3FPItq5Kqz/htqNwYVMf+IZsXlU X20SLREp144bOoce4aWRAlbQXzBetQ1L3WrtOhO9ILQqoFiFXuSdh+ZwMhZgR4bPFG 7dioiwzG/qcNw== Date: Tue, 30 Dec 2025 18:26:28 +0200 From: Mike Rapoport To: Li Chen Cc: Alexander Graf , Pasha Tatashin , Pratyush Yadav , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] liveupdate/kho: Warn when kho_scratch is insufficient for sparsemem Message-ID: References: <20251230055345.70035-1-me@linux.beauty> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251230055345.70035-1-me@linux.beauty> Hi, On Tue, Dec 30, 2025 at 01:53:45PM +0800, Li Chen wrote: > With KHO enabled, the successor kernel can temporarily run memblock in > scratch-only mode during early boot. In that mode, SPARSEMEM may allocate > a per-node scratch buffer via sparse_buffer_init(map_count * > section_map_size()), which requires a single contiguous, aligned memblock > allocation. > > If the maximum usable scratch range in a node is smaller than the > estimated buffer size, kexec handover can hang very early in the > successor kernel, and we may even have no chance to see the error on > the console. > > Estimate the worst-case per-node requirement from the running kernel's > sparsemem layout and compare it against the reserved scratch list by > splitting scratch ranges per nid, sorting and merging them, and applying > the section_map_size() alignment constraint. Warn once when scratch > appears too small. > > This check is a heuristic based on the running kernel's sparsemem layout > and cannot account for all differences in a successor kernel. Keep it as > a warning instead of rejecting kexec loads to avoid false positives > causing unexpected regressions. Users can adjust kho_scratch accordingly > before attempting a handover. > > To reduce boot-time overhead(particularly on large NUMA servers), run > the check from a late initcall via system_long_wq instead of in > kho_reserve_scratch(). > > Signed-off-by: Li Chen > --- > kernel/liveupdate/kexec_handover.c | 396 +++++++++++++++++++++++++++++ > 1 file changed, 396 insertions(+) This is an overkill for something that a pr_err() or a panic() would be sufficient. -- Sincerely yours, Mike.