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 E8A62399363 for ; Fri, 10 Apr 2026 07:59: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=1775807997; cv=none; b=EaC6vQuB3exmT3EcXpcQEWuXg7NTsiQ8EcaIKDsSTYOBE+nDllthQj4XUf9u4CTPUgYZ+xhji8Kja+NCFcHsoM/+Yl21T6+M+elbuplAHBrH/QEWb1Vi0JbF8bbbo4xUN+LVbMuC0sHt0SKObqlUYeCBoKAt+JK1lRBvxQjqUto= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775807997; c=relaxed/simple; bh=SxrLNnYLw7RM2+RAMFd5Z9aLlerg3Bl5esgirC0unYo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mKznE6H5oVlhxurSfOMnUB1HpMR2ehyxhYC7RY1ZuIdZxBN6L/7Yc7hT1YG+mci9v1qKlTrJOPfVcXu463CGUY0v+Wa9entteBEngv3yaadEtxcXQKizBd3COmNn6IxxRf1i3KwPH2AVykQKF18zfraxuLHlNaMefrUjEIX/rAQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bk0e4BNX; 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="bk0e4BNX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93E4BC19424; Fri, 10 Apr 2026 07:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775807996; bh=SxrLNnYLw7RM2+RAMFd5Z9aLlerg3Bl5esgirC0unYo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bk0e4BNXD6Yt7f4mKRojtk8ruecTagIIEG5ZStNZDXOJpUmflQARjCnJhnRz+paso roEnmnTZ/3YOwcWe24nYpk6kuNpdCBLakaiK6zYS+gzTDqq+QmsSOQ65c1vUMYn2/E tCcBDdNjvnqRhAw2ZL2IpfCQ5+NnBVg9CogjjWTrHur7cL+kyD3ZDma3KswYbArbZI zFuoEqE5eTB6wRIQI5VVRjH5zWbWsl/Yoy2UtK0na15HGAg0ukDR9WwlFRSKyB8Q5H ncK6y9yjMjyAMKOjFOa4svGHzlTF37gjH09YIdRl2GFIuzKWmdirlkLYsXuRmpqj8x lXfm1lzH96/Zg== Date: Fri, 10 Apr 2026 10:59:49 +0300 From: Mike Rapoport To: Evangelos Petrongonas Cc: Alexander Graf , Pasha Tatashin , Pratyush Yadav , Rob Herring , Saravana Kannan , Changyuan Lyu , Andrew Morton , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, nh-open-source@amazon.com Subject: Re: [PATCH v2] kho: skip KHO for crash kernel Message-ID: References: <20260410011609.1103-1-epetron@amazon.de> 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: <20260410011609.1103-1-epetron@amazon.de> On Fri, Apr 10, 2026 at 01:16:05AM +0000, Evangelos Petrongonas wrote: > kho_fill_kimage() unconditionally populates the kimage with KHO > metadata for every kexec image type. When the image is a crash kernel, > this can be problematic as the crash kernel can run in a small reserved > region and the KHO scratch areas can sit outside it. > The crash kernel then faults during kho_memory_init() when it > tries phys_to_virt() on the KHO FDT address: > > Unable to handle kernel paging request at virtual address xxxxxxxx > ... > fdt_offset_ptr+... > fdt_check_node_offset_+... > fdt_first_property_offset+... > fdt_get_property_namelen_+... > fdt_getprop+... > kho_memory_init+... > mm_core_init+... > start_kernel+... > > kho_locate_mem_hole() already skips KHO logic for KEXEC_TYPE_CRASH > images, but kho_fill_kimage() was missing the same guard. As > kho_fill_kimage() is the single point that populates image->kho.fdt > and image->kho.scratch, fixing it here is sufficient for both arm64 > and x86 as the FDT and boot_params path are bailing out when these > fields are unset. > > Fixes: d7255959b69a ("kho: allow kexec load before KHO finalization") > Signed-off-by: Evangelos Petrongonas Reviewed-by: Mike Rapoport (Microsoft) > --- > > v2: Per Mike's review [1], move the guard into kho_fill_kimage() instead > of patching the arch-level producers and consumers. This fixes > both arm64 and x86 in one place and avoids redundant checks. Tested again. > > Note regarding backporting > The offending commit was deployed with 6.19. The only other supported > kernel version with 6.18, unless I miss someting uses > ``` > if (!kho_out.finalized) > ``` > which in the case of crash kernel it shouldn't be finalised. Yes, this seems about right :) The only released kernel that has this issue is v6.19 and it will be EOL in less than a week. > [1] https://lore.kernel.org/all/ade2ExpM8ROXV-vy@kernel.org/ > > kernel/liveupdate/kexec_handover.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c > index cc68a3692905..1029fe8778f2 100644 > --- a/kernel/liveupdate/kexec_handover.c > +++ b/kernel/liveupdate/kexec_handover.c > @@ -1551,7 +1551,7 @@ int kho_fill_kimage(struct kimage *image) > int err = 0; > struct kexec_buf scratch; > > - if (!kho_enable) > + if (!kho_enable || image->type == KEXEC_TYPE_CRASH) > return 0; > > image->kho.fdt = virt_to_phys(kho_out.fdt); > -- > 2.47.3 > > > > > Amazon Web Services Development Center Germany GmbH > Tamara-Danz-Str. 13 > 10243 Berlin > Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger > Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B > Sitz: Berlin > Ust-ID: DE 365 538 597 > -- Sincerely yours, Mike.