From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1ADD1606A31C for ; Sun, 29 Nov 2026 09:59:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=YwDtq3KO; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RSh2m7qO DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=n8DkK/udYxorlFhnMKVreUMStE/0uxjtcsSQQ68hIko=; b=YwDtq3KOL55pVM+uiVwbr6SvcK ajnkvV0x2X+L/B+eDknWs5451O7uY/hDIakykVuNhiJ0J7lhOAOP0l7yTopdpDs9tLvhh2ndKfH5x fI2mcHLjprhjLwT2s6kEkv7kB9iznDrnbcA1ErXjcr1BE1P1vJ6jj4c6l9v2DFCeLSZD/Sir287aw fPEnqOV4dxmM0hRI+P/qFu1yQsbzFadMSClQiJUIwbY1bpZ6/YSnFx0xNW5UjkrBGv3JbwsNMAbZO xbIH3e7VDKsqZiyu7j5UiIsYQA1DHjscGrPudZJFazzNtBIow94tqpzajR8yULU6GsWPBqIJidr8d vv556eMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXbgy-00000001nCe-1q1c; Sun, 29 Nov 2026 09:59:32 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXbgw-00000001nCL-3fkH; Sun, 29 Nov 2026 09:59:30 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 0C41460DE1; Sun, 29 Nov 2026 09:59:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C3CA1F00898; Sun, 29 Nov 2026 09:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795946369; bh=n8DkK/udYxorlFhnMKVreUMStE/0uxjtcsSQQ68hIko=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=RSh2m7qORCgmN3vsZOl8GzvJfC71cjiALbLuUwmPkL+PqIpWkodl6tHSyilhzzHvH xPCM46lKVIjGaXUeLIzoMpQJzA+WPuZO8eWXU9sHCN9OkeB9ACEIbFZbNM3hZ89fDi /9ewRrKzisXGZwsoxQbOWge3WmLKhGg5Yd2OJSG/g0vFJQo8//lBQzkb5i9TILkW3u gpFs/2dM8GfcKd+KClSYV1KnJaKZs5jE+DEvMDxMc7jDh6+VEG8EBOClKGnHhiS6HU voH1VmtZJqYQOrZLORpzhCiNoWt2PUTImjgr/xT7Gk6OnPpF9ka4YxC3h+/DeshJCe FpA4CR4v+h51g== Date: Sun, 29 Nov 2026 11:59:21 +0200 From: Mike Rapoport To: Jingyi Sun <1045704958@qq.com> Cc: Andrew Morton , Baoquan He , Pasha Tatashin , Pratyush Yadav , Shradha Gupta , Thomas Huth , Sourabh Jain , Pingfan Liu , Benjamin Herrenschmidt , Anton Blanchard , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Russell King , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] kexec: use phys_addr_t in generic crash_free_reserved_phys_range() Message-ID: References: X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi, On Sat, Nov 28, 2026 at 04:19:03PM +0800, Jingyi Sun wrote: > The generic crash_free_reserved_phys_range() takes the range as > unsigned long, but its only caller, __crash_shrink_memory(), passes > resource_size_t values from crashk_res / crashk_low_res. On 32-bit > architectures with a 64-bit phys_addr_t that do not provide their own > helper (e.g. ARM with LPAE), a crash kernel region above 4GiB is then Which helper that would be? > truncated to its low 32 bits when /sys/kernel/kexec_crash_size is > shrunk: free_reserved_page() is called on unrelated low-memory pages, > while the pages that were actually released from the reservation stay > reserved forever. > > This was observed on QEMU (virt, cortex-a15, ARM_LPAE, 6G) with > "mem=1G@0x40000000 mem=512M@0x140000000 crashkernel=64M@0x150000000": > after "echo 0 > /sys/kernel/kexec_crash_size" the HighMem zone's > managed page count stayed unchanged, while the low-memory zone grew by > 16384 pages (64MiB), i.e. the pages at 0x50000000-0x53ffffff were > "freed" instead of 0x150000000-0x153ffffff. x86_64 with the same layout > behaves correctly. How is x86_64 related? > Use phys_addr_t for the range and the loop variable, and PHYS_PFN() to > derive the PFN. > > Fixes: c0bb9e45f3a7 ("kdump: Allow shrinking of kdump region to be overridden") > Signed-off-by: Jingyi Sun <1045704958@qq.com> Other than nits in the changelong the patch looks good, thanks! > --- > include/linux/kexec.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/linux/kexec.h b/include/linux/kexec.h > index bac11e940e74..e21dcc316bf9 100644 > --- a/include/linux/kexec.h > +++ b/include/linux/kexec.h > @@ -484,12 +484,12 @@ static inline phys_addr_t boot_phys_to_phys(unsigned long boot_phys) > #endif > > #ifndef crash_free_reserved_phys_range > -static inline void crash_free_reserved_phys_range(unsigned long begin, unsigned long end) > +static inline void crash_free_reserved_phys_range(phys_addr_t begin, phys_addr_t end) > { > - unsigned long addr; > + phys_addr_t addr; > > for (addr = begin; addr < end; addr += PAGE_SIZE) > - free_reserved_page(boot_pfn_to_page(addr >> PAGE_SHIFT)); > + free_reserved_page(boot_pfn_to_page(PHYS_PFN(addr))); > } > #endif > > > base-commit: 7cd8495c0f16275c4f9abe1cef09a7b5fcd6d046 > -- > 2.43.0 > -- Sincerely yours, Mike.