linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memblock tests: Fix compilation errors.
@ 2023-09-11 14:32 Rong Tao
  2023-09-14  6:12 ` Mike Rapoport
  0 siblings, 1 reply; 2+ messages in thread
From: Rong Tao @ 2023-09-11 14:32 UTC (permalink / raw)
  To: rppt, rongtao
  Cc: rtoax, open list,
	open list:MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION

From: Rong Tao <rongtao@cestc.cn>

This patch fix the follow errors.

commit 61167ad5fecd("mm: pass nid to reserve_bootmem_region()") pass nid
parameter to reserve_bootmem_region(),

    $ make -C tools/testing/memblock/
    ...
    memblock.c: In function ‘memmap_init_reserved_pages’:
    memblock.c:2111:25: error: too many arguments to function ‘reserve_bootmem_region’
    2111 |                         reserve_bootmem_region(start, end, nid);
         |                         ^~~~~~~~~~~~~~~~~~~~~~
    ../../include/linux/mm.h:32:6: note: declared here
    32 | void reserve_bootmem_region(phys_addr_t start, phys_addr_t end);
       |      ^~~~~~~~~~~~~~~~~~~~~~
    memblock.c:2122:17: error: too many arguments to function ‘reserve_bootmem_region’
    2122 |                 reserve_bootmem_region(start, end, nid);
         |                 ^~~~~~~~~~~~~~~~~~~~~~

commit dcdfdd40fa82("mm: Add support for unaccepted memory") call
accept_memory() in memblock.c

    $ make -C tools/testing/memblock/
    ...
    cc -fsanitize=address -fsanitize=undefined  main.o memblock.o \
     lib/slab.o mmzone.o slab.o tests/alloc_nid_api.o \
     tests/alloc_helpers_api.o tests/alloc_api.o tests/basic_api.o \
     tests/common.o tests/alloc_exact_nid_api.o   -o main
    /usr/bin/ld: memblock.o: in function `memblock_alloc_range_nid':
    memblock.c:(.text+0x7ae4): undefined reference to `accept_memory'

Signed-off-by: Rong Tao <rongtao@cestc.cn>
---
 tools/include/linux/mm.h          | 2 +-
 tools/testing/memblock/internal.h | 4 ++++
 tools/testing/memblock/mmzone.c   | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/include/linux/mm.h b/tools/include/linux/mm.h
index a03d9bba5151..2bc94079d616 100644
--- a/tools/include/linux/mm.h
+++ b/tools/include/linux/mm.h
@@ -29,7 +29,7 @@ static inline void *phys_to_virt(unsigned long address)
 	return __va(address);
 }
 
-void reserve_bootmem_region(phys_addr_t start, phys_addr_t end);
+void reserve_bootmem_region(phys_addr_t start, phys_addr_t end, int nid);
 
 static inline void totalram_pages_inc(void)
 {
diff --git a/tools/testing/memblock/internal.h b/tools/testing/memblock/internal.h
index fdb7f5db7308..f6c6e5474c3a 100644
--- a/tools/testing/memblock/internal.h
+++ b/tools/testing/memblock/internal.h
@@ -20,4 +20,8 @@ void memblock_free_pages(struct page *page, unsigned long pfn,
 {
 }
 
+static inline void accept_memory(phys_addr_t start, phys_addr_t end)
+{
+}
+
 #endif
diff --git a/tools/testing/memblock/mmzone.c b/tools/testing/memblock/mmzone.c
index 7b0909e8b759..d3d58851864e 100644
--- a/tools/testing/memblock/mmzone.c
+++ b/tools/testing/memblock/mmzone.c
@@ -11,7 +11,7 @@ struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
 	return NULL;
 }
 
-void reserve_bootmem_region(phys_addr_t start, phys_addr_t end)
+void reserve_bootmem_region(phys_addr_t start, phys_addr_t end, int nid)
 {
 }
 
-- 
2.41.0



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

* Re: [PATCH] memblock tests: Fix compilation errors.
  2023-09-11 14:32 [PATCH] memblock tests: Fix compilation errors Rong Tao
@ 2023-09-14  6:12 ` Mike Rapoport
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2023-09-14  6:12 UTC (permalink / raw)
  To: Rong Tao
  Cc: rongtao, open list,
	open list:MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION

On Mon, Sep 11, 2023 at 10:32:56PM +0800, Rong Tao wrote:
> From: Rong Tao <rongtao@cestc.cn>
> 
> This patch fix the follow errors.
> 
> commit 61167ad5fecd("mm: pass nid to reserve_bootmem_region()") pass nid
> parameter to reserve_bootmem_region(),
> 
>     $ make -C tools/testing/memblock/
>     ...
>     memblock.c: In function ‘memmap_init_reserved_pages’:
>     memblock.c:2111:25: error: too many arguments to function ‘reserve_bootmem_region’
>     2111 |                         reserve_bootmem_region(start, end, nid);
>          |                         ^~~~~~~~~~~~~~~~~~~~~~
>     ../../include/linux/mm.h:32:6: note: declared here
>     32 | void reserve_bootmem_region(phys_addr_t start, phys_addr_t end);
>        |      ^~~~~~~~~~~~~~~~~~~~~~
>     memblock.c:2122:17: error: too many arguments to function ‘reserve_bootmem_region’
>     2122 |                 reserve_bootmem_region(start, end, nid);
>          |                 ^~~~~~~~~~~~~~~~~~~~~~
> 
> commit dcdfdd40fa82("mm: Add support for unaccepted memory") call
> accept_memory() in memblock.c
> 
>     $ make -C tools/testing/memblock/
>     ...
>     cc -fsanitize=address -fsanitize=undefined  main.o memblock.o \
>      lib/slab.o mmzone.o slab.o tests/alloc_nid_api.o \
>      tests/alloc_helpers_api.o tests/alloc_api.o tests/basic_api.o \
>      tests/common.o tests/alloc_exact_nid_api.o   -o main
>     /usr/bin/ld: memblock.o: in function `memblock_alloc_range_nid':
>     memblock.c:(.text+0x7ae4): undefined reference to `accept_memory'
> 
> Signed-off-by: Rong Tao <rongtao@cestc.cn>

Applied, thanks!

> ---
>  tools/include/linux/mm.h          | 2 +-
>  tools/testing/memblock/internal.h | 4 ++++
>  tools/testing/memblock/mmzone.c   | 2 +-
>  3 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/include/linux/mm.h b/tools/include/linux/mm.h
> index a03d9bba5151..2bc94079d616 100644
> --- a/tools/include/linux/mm.h
> +++ b/tools/include/linux/mm.h
> @@ -29,7 +29,7 @@ static inline void *phys_to_virt(unsigned long address)
>  	return __va(address);
>  }
>  
> -void reserve_bootmem_region(phys_addr_t start, phys_addr_t end);
> +void reserve_bootmem_region(phys_addr_t start, phys_addr_t end, int nid);
>  
>  static inline void totalram_pages_inc(void)
>  {
> diff --git a/tools/testing/memblock/internal.h b/tools/testing/memblock/internal.h
> index fdb7f5db7308..f6c6e5474c3a 100644
> --- a/tools/testing/memblock/internal.h
> +++ b/tools/testing/memblock/internal.h
> @@ -20,4 +20,8 @@ void memblock_free_pages(struct page *page, unsigned long pfn,
>  {
>  }
>  
> +static inline void accept_memory(phys_addr_t start, phys_addr_t end)
> +{
> +}
> +
>  #endif
> diff --git a/tools/testing/memblock/mmzone.c b/tools/testing/memblock/mmzone.c
> index 7b0909e8b759..d3d58851864e 100644
> --- a/tools/testing/memblock/mmzone.c
> +++ b/tools/testing/memblock/mmzone.c
> @@ -11,7 +11,7 @@ struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
>  	return NULL;
>  }
>  
> -void reserve_bootmem_region(phys_addr_t start, phys_addr_t end)
> +void reserve_bootmem_region(phys_addr_t start, phys_addr_t end, int nid)
>  {
>  }
>  
> -- 
> 2.41.0
> 

-- 
Sincerely yours,
Mike.


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

end of thread, other threads:[~2023-09-14  6:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-11 14:32 [PATCH] memblock tests: Fix compilation errors Rong Tao
2023-09-14  6:12 ` Mike Rapoport

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).