[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201031103312.GI1551@shell.armlinux.org.uk>
Date: Sat, 31 Oct 2020 10:33:12 +0000
From: Russell King - ARM Linux admin <linux@...linux.org.uk>
To: Mike Rapoport <rppt@...nel.org>
Cc: linux-arm-kernel@...ts.infradead.org,
linux-xtensa@...ux-xtensa.org, Ard Biesheuvel <ardb@...nel.org>,
Chris Zankel <chris@...kel.net>,
Florian Fainelli <f.fainelli@...il.com>,
Linus Walleij <linus.walleij@...aro.org>,
Max Filippov <jcmvbkbc@...il.com>,
Mike Rapoport <rppt@...ux.ibm.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ARM, xtensa: highmem: avoid clobbering non-page aligned
memory reservations
On Sat, Oct 31, 2020 at 11:43:45AM +0200, Mike Rapoport wrote:
> From: Ard Biesheuvel <ardb@...nel.org>
>
> free_highpages() iterates over the free memblock regions in high
> memory, and marks each page as available for the memory management
> system.
>
> Until commit cddb5ddf2b76 ("arm, xtensa: simplify initialization of
> high memory pages") it rounded beginning of each region upwards and end of
> each region downwards.
>
> However, after that commit free_highmem() rounds the beginning and end of
> each region downwards, and we may end up freeing a page that is
> memblock_reserve()d, resulting in memory corruption.
>
> Restore the original rounding of the region boundaries to avoid freeing
> reserved pages.
>
> Fixes: cddb5ddf2b76 ("arm, xtensa: simplify initialization of high memory pages")
> Link: https://lore.kernel.org/r/20201029110334.4118-1-ardb@kernel.org/
> Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
> Co-developed-by: Mike Rapoport <rppt@...ux.ibm.com>
> Signed-off-by: Mike Rapoport <rppt@...ux.ibm.com>
> ---
>
> Max, Russell,
>
> Please let me know how do you prefer to take it upstream.
> If needed this can go via memblock tree.
>
> v2: fix words order in the commit message
I really don't understand what is going on here; there seems to be a
total disconnect of communication between yourself and Ard. Ard has
already submitted a different patch for this to the patch system
already, sent yesterday.
https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9021/1
Please discuss between yourselves how you want to solve the problem,
and then submit an agreed and tested patch to those of us upstream;
please don't make it for those upstream to pick one of your patches
as you are at present.
Thanks.
>
> arch/arm/mm/init.c | 4 ++--
> arch/xtensa/mm/init.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
> index d57112a276f5..c23dbf8bebee 100644
> --- a/arch/arm/mm/init.c
> +++ b/arch/arm/mm/init.c
> @@ -354,8 +354,8 @@ static void __init free_highpages(void)
> /* set highmem page free */
> for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
> &range_start, &range_end, NULL) {
> - unsigned long start = PHYS_PFN(range_start);
> - unsigned long end = PHYS_PFN(range_end);
> + unsigned long start = PFN_UP(range_start);
> + unsigned long end = PFN_DOWN(range_end);
>
> /* Ignore complete lowmem entries */
> if (end <= max_low)
> diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
> index c6fc83efee0c..8731b7ad9308 100644
> --- a/arch/xtensa/mm/init.c
> +++ b/arch/xtensa/mm/init.c
> @@ -89,8 +89,8 @@ static void __init free_highpages(void)
> /* set highmem page free */
> for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
> &range_start, &range_end, NULL) {
> - unsigned long start = PHYS_PFN(range_start);
> - unsigned long end = PHYS_PFN(range_end);
> + unsigned long start = PFN_UP(range_start);
> + unsigned long end = PFN_DOWN(range_end);
>
> /* Ignore complete lowmem entries */
> if (end <= max_low)
> --
> 2.28.0
>
>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists