linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Cleanup ARM arches to use common memblocks_present
@ 2019-01-09 20:20 Logan Gunthorpe
  2019-01-09 20:20 ` [PATCH 1/2] ARM: mm: make use of new memblocks_present() helper Logan Gunthorpe
  2019-01-09 20:21 ` [PATCH 2/2] arm64: " Logan Gunthorpe
  0 siblings, 2 replies; 6+ messages in thread
From: Logan Gunthorpe @ 2019-01-09 20:20 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: Will Deacon, Catalin Marinas, Russell King, Stephen Bates,
	Logan Gunthorpe

Hey,

We've recently added a new memblocks_present() helper macro to clean
up some common code with ARM and code we are adding in RISC-V. The
commit that added the helper is:

9def36e0fa9a ("mm/sparse: add common helper to mark all memblocks present")

This series includes two patches to switch ARM and ARM64 to use the
new function.

Thanks,

Logan

--

Logan Gunthorpe (2):
  ARM: mm: make use of new memblocks_present() helper
  arm64: mm: make use of new memblocks_present() helper

 arch/arm/mm/init.c   | 17 +----------------
 arch/arm64/mm/init.c | 20 +-------------------
 2 files changed, 2 insertions(+), 35 deletions(-)

--
2.19.0

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

* [PATCH 1/2] ARM: mm: make use of new memblocks_present() helper
  2019-01-09 20:20 [PATCH 0/2] Cleanup ARM arches to use common memblocks_present Logan Gunthorpe
@ 2019-01-09 20:20 ` Logan Gunthorpe
  2019-01-09 20:21 ` [PATCH 2/2] arm64: " Logan Gunthorpe
  1 sibling, 0 replies; 6+ messages in thread
From: Logan Gunthorpe @ 2019-01-09 20:20 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: Will Deacon, Catalin Marinas, Russell King, Stephen Bates,
	Logan Gunthorpe, Kees Cook, Philip Derrin,
	Steven Rostedt (VMware),
	Nicolas Pitre

Cleanup the arm_memory_present() function seeing it's very
similar to other arches.

The new memblocks_present() helper checks for node ids which the
arm version did not. However, this is equivalent seeing
HAVE_MEMBLOCK_NODE_MAP should be false in this arch and therefore
memblock_get_region_node() should return 0.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Kees Cook <keescook@chromium.org>
Cc: Philip Derrin <philip@cog.systems>
Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mm/init.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 478ea8b7db87..6c50dd407ba8 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -182,21 +182,6 @@ int pfn_valid(unsigned long pfn)
 EXPORT_SYMBOL(pfn_valid);
 #endif
 
-#ifndef CONFIG_SPARSEMEM
-static void __init arm_memory_present(void)
-{
-}
-#else
-static void __init arm_memory_present(void)
-{
-	struct memblock_region *reg;
-
-	for_each_memblock(memory, reg)
-		memory_present(0, memblock_region_memory_base_pfn(reg),
-			       memblock_region_memory_end_pfn(reg));
-}
-#endif
-
 static bool arm_memblock_steal_permitted = true;
 
 phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
@@ -292,7 +277,7 @@ void __init bootmem_init(void)
 	 * Sparsemem tries to allocate bootmem in memory_present(),
 	 * so must be done after the fixed reservations
 	 */
-	arm_memory_present();
+	memblocks_present();
 
 	/*
 	 * sparse_init() needs the bootmem allocator up and running.
-- 
2.19.0


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

* [PATCH 2/2] arm64: mm: make use of new memblocks_present() helper
  2019-01-09 20:20 [PATCH 0/2] Cleanup ARM arches to use common memblocks_present Logan Gunthorpe
  2019-01-09 20:20 ` [PATCH 1/2] ARM: mm: make use of new memblocks_present() helper Logan Gunthorpe
@ 2019-01-09 20:21 ` Logan Gunthorpe
  2019-01-10 14:15   ` Will Deacon
  1 sibling, 1 reply; 6+ messages in thread
From: Logan Gunthorpe @ 2019-01-09 20:21 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: Will Deacon, Catalin Marinas, Russell King, Stephen Bates,
	Logan Gunthorpe

Cleanup the arm64_memory_present() function seeing it's very
similar to other arches.

memblocks_present() is a direct replacement of arm64_memory_present()

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/mm/init.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 7205a9085b4d..2302b4093a63 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -285,24 +285,6 @@ int pfn_valid(unsigned long pfn)
 }
 EXPORT_SYMBOL(pfn_valid);
 
-#ifndef CONFIG_SPARSEMEM
-static void __init arm64_memory_present(void)
-{
-}
-#else
-static void __init arm64_memory_present(void)
-{
-	struct memblock_region *reg;
-
-	for_each_memblock(memory, reg) {
-		int nid = memblock_get_region_node(reg);
-
-		memory_present(nid, memblock_region_memory_base_pfn(reg),
-				memblock_region_memory_end_pfn(reg));
-	}
-}
-#endif
-
 static phys_addr_t memory_limit = PHYS_ADDR_MAX;
 
 /*
@@ -489,7 +471,7 @@ void __init bootmem_init(void)
 	 * Sparsemem tries to allocate bootmem in memory_present(), so must be
 	 * done after the fixed reservations.
 	 */
-	arm64_memory_present();
+	memblocks_present();
 
 	sparse_init();
 	zone_sizes_init(min, max);
-- 
2.19.0


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

* Re: [PATCH 2/2] arm64: mm: make use of new memblocks_present() helper
  2019-01-09 20:21 ` [PATCH 2/2] arm64: " Logan Gunthorpe
@ 2019-01-10 14:15   ` Will Deacon
  2019-01-10 16:51     ` Logan Gunthorpe
  0 siblings, 1 reply; 6+ messages in thread
From: Will Deacon @ 2019-01-10 14:15 UTC (permalink / raw)
  To: Logan Gunthorpe
  Cc: linux-kernel, linux-arm-kernel, Catalin Marinas, Russell King,
	Stephen Bates

On Wed, Jan 09, 2019 at 01:21:00PM -0700, Logan Gunthorpe wrote:
> Cleanup the arm64_memory_present() function seeing it's very
> similar to other arches.
> 
> memblocks_present() is a direct replacement of arm64_memory_present()
> 
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm64/mm/init.c | 20 +-------------------
>  1 file changed, 1 insertion(+), 19 deletions(-)

Acked-by: Will Deacon <will.deacon@arm.com>

Did you want us to take this via the arm64 tree?

Will

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

* Re: [PATCH 2/2] arm64: mm: make use of new memblocks_present() helper
  2019-01-10 14:15   ` Will Deacon
@ 2019-01-10 16:51     ` Logan Gunthorpe
  2019-01-21 17:34       ` Catalin Marinas
  0 siblings, 1 reply; 6+ messages in thread
From: Logan Gunthorpe @ 2019-01-10 16:51 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-kernel, linux-arm-kernel, Catalin Marinas, Russell King,
	Stephen Bates



On 2019-01-10 7:15 a.m., Will Deacon wrote:
> On Wed, Jan 09, 2019 at 01:21:00PM -0700, Logan Gunthorpe wrote:
>> Cleanup the arm64_memory_present() function seeing it's very
>> similar to other arches.
>>
>> memblocks_present() is a direct replacement of arm64_memory_present()
>>
>> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
>> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> ---
>>  arch/arm64/mm/init.c | 20 +-------------------
>>  1 file changed, 1 insertion(+), 19 deletions(-)
> 
> Acked-by: Will Deacon <will.deacon@arm.com>
> 
> Did you want us to take this via the arm64 tree?

Yes please.

Thanks,

Logan

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

* Re: [PATCH 2/2] arm64: mm: make use of new memblocks_present() helper
  2019-01-10 16:51     ` Logan Gunthorpe
@ 2019-01-21 17:34       ` Catalin Marinas
  0 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2019-01-21 17:34 UTC (permalink / raw)
  To: Logan Gunthorpe
  Cc: Will Deacon, Stephen Bates, linux-kernel, linux-arm-kernel, Russell King

On Thu, Jan 10, 2019 at 09:51:52AM -0700, Logan Gunthorpe wrote:
> On 2019-01-10 7:15 a.m., Will Deacon wrote:
> > On Wed, Jan 09, 2019 at 01:21:00PM -0700, Logan Gunthorpe wrote:
> >> Cleanup the arm64_memory_present() function seeing it's very
> >> similar to other arches.
> >>
> >> memblocks_present() is a direct replacement of arm64_memory_present()
> >>
> >> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> >> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
> >> Cc: Will Deacon <will.deacon@arm.com>
> >> ---
> >>  arch/arm64/mm/init.c | 20 +-------------------
> >>  1 file changed, 1 insertion(+), 19 deletions(-)
> > 
> > Acked-by: Will Deacon <will.deacon@arm.com>
> > 
> > Did you want us to take this via the arm64 tree?
> 
> Yes please.

Patch 2/2 queued for 5.1. Thanks.

-- 
Catalin

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

end of thread, other threads:[~2019-01-21 17:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 20:20 [PATCH 0/2] Cleanup ARM arches to use common memblocks_present Logan Gunthorpe
2019-01-09 20:20 ` [PATCH 1/2] ARM: mm: make use of new memblocks_present() helper Logan Gunthorpe
2019-01-09 20:21 ` [PATCH 2/2] arm64: " Logan Gunthorpe
2019-01-10 14:15   ` Will Deacon
2019-01-10 16:51     ` Logan Gunthorpe
2019-01-21 17:34       ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).