public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xtensa: use MEMBLOCK_ALLOC_ANYWHERE for KASAN shadow map
@ 2019-11-14  1:08 Max Filippov
  2019-11-14  8:11 ` Mike Rapoport
  0 siblings, 1 reply; 2+ messages in thread
From: Max Filippov @ 2019-11-14  1:08 UTC (permalink / raw)
  To: linux-xtensa
  Cc: Chris Zankel, Mike Rapoport, linux-kernel, Max Filippov, stable

KASAN shadow map doesn't need to be accessible through the linear kernel
mapping, allocate its pages with MEMBLOCK_ALLOC_ANYWHERE so that high
memory can be used. This frees up to ~100MB of low memory on xtensa
configurations with KASAN and high memory.

Cc: stable@vger.kernel.org # v5.1+
Fixes: f240ec09bb8a ("memblock: replace memblock_alloc_base(ANYWHERE)
		     with memblock_phys_alloc")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 arch/xtensa/mm/kasan_init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/xtensa/mm/kasan_init.c b/arch/xtensa/mm/kasan_init.c
index 9c957791bb33..e3baa21ff24c 100644
--- a/arch/xtensa/mm/kasan_init.c
+++ b/arch/xtensa/mm/kasan_init.c
@@ -60,7 +60,9 @@ static void __init populate(void *start, void *end)
 
 		for (k = 0; k < PTRS_PER_PTE; ++k, ++j) {
 			phys_addr_t phys =
-				memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
+				memblock_phys_alloc_range(PAGE_SIZE, PAGE_SIZE,
+							  0,
+							  MEMBLOCK_ALLOC_ANYWHERE);
 
 			if (!phys)
 				panic("Failed to allocate page table page\n");
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xtensa: use MEMBLOCK_ALLOC_ANYWHERE for KASAN shadow map
  2019-11-14  1:08 [PATCH] xtensa: use MEMBLOCK_ALLOC_ANYWHERE for KASAN shadow map Max Filippov
@ 2019-11-14  8:11 ` Mike Rapoport
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2019-11-14  8:11 UTC (permalink / raw)
  To: Max Filippov; +Cc: linux-xtensa, Chris Zankel, linux-kernel, stable

On Wed, Nov 13, 2019 at 05:08:24PM -0800, Max Filippov wrote:
> KASAN shadow map doesn't need to be accessible through the linear kernel
> mapping, allocate its pages with MEMBLOCK_ALLOC_ANYWHERE so that high
> memory can be used. This frees up to ~100MB of low memory on xtensa
> configurations with KASAN and high memory.
> 
> Cc: stable@vger.kernel.org # v5.1+
> Fixes: f240ec09bb8a ("memblock: replace memblock_alloc_base(ANYWHERE)
> 		     with memblock_phys_alloc")
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>

> ---
>  arch/xtensa/mm/kasan_init.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/xtensa/mm/kasan_init.c b/arch/xtensa/mm/kasan_init.c
> index 9c957791bb33..e3baa21ff24c 100644
> --- a/arch/xtensa/mm/kasan_init.c
> +++ b/arch/xtensa/mm/kasan_init.c
> @@ -60,7 +60,9 @@ static void __init populate(void *start, void *end)
>  
>  		for (k = 0; k < PTRS_PER_PTE; ++k, ++j) {
>  			phys_addr_t phys =
> -				memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
> +				memblock_phys_alloc_range(PAGE_SIZE, PAGE_SIZE,
> +							  0,
> +							  MEMBLOCK_ALLOC_ANYWHERE);
>  
>  			if (!phys)
>  				panic("Failed to allocate page table page\n");
> -- 
> 2.20.1
> 

-- 
Sincerely yours,
Mike.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-14  8:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-14  1:08 [PATCH] xtensa: use MEMBLOCK_ALLOC_ANYWHERE for KASAN shadow map Max Filippov
2019-11-14  8:11 ` Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox