From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795946370; b=ozhnbtQ+W2Z07FH2ObyR3uohGteh+D/4xf8KzSfcnwS7cgCBYG315G8ZZ51rY+uBQwCG jW4AJFKQScybGsJyZxqDQaSqD9QBm7n07h6k9qEZDKGIoxMDgouXdL5VyY3PMNvaJO7PZ alECer7jEFB/3laT1hMGwdQbxnjVsfwUHPv6+Sf8B/eI3+JyDFUNwgSjhCfV2qq/xEaKw inr4Ecu91wQHE2KALj11B271w4GjyOLJIeS7hQuke4Rx9Y7RGDYrzCpd0VKIC0t5oDwiG //4ukC7bDyKOOpM/16ckDj43ASLQdYMHjCIMtqBfE2fty76xTerFjclLVScryz8NOzA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795946370; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=n8DkK/udYxorlFhnMKVreUMStE/0uxjtcsSQQ68hIko=; b=oUC7jxU9j7ZAPQpzgOPVQ5DJLn9REZlFyQRHP6Ck/f3YKc4lZdQSCOqahBhA5gKLIeiU ywxC2MVZU5BRJy/+P8sNC12h3iVNX6QB2opRLwZ4zbmL/fS6VdnmQqRulwdR5pjjPriCC r/ZyxLagcZ8Hzczrg8BzoFNjTGhfaxo9/v4V4NZpn+1PzQ/8GgEo/AFDVrK7+3nWAp+7k MpMITfvJWD4ayFP2nQdwiT2j/84lSz/A4wNUgQojzwLfiTVdn/cg1wYZGDoNp5u1Ku5P5 2+a+PknhY/MV7cyAO7HvTNLm/ll9cDyeQh9F6HWMayQJGSrPsb75M0NgIaSjSrdsggg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RSh2m7qO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25FED606A31C for ; Sun, 29 Nov 2026 09:59:29 +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=RSh2m7qO 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-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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.