2022-08-31 05:45:30

by Yupeng Li

[permalink] [raw]
Subject: [PATCH 1/1] LoongArch: Fixed arch_remove_memory undefined build error.

The kernel build error when unslected CONFIG_MEMORY_HOTREMOVE, the
arch_remove_memory in mm/memory_hotplug.c was undefined.
Removed CONFIG_MEMORY_HOTREMOVE requirement refer to the definitions
of other platform architectures.Some build error messages like:

LD vmlinux.o
MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
loongarch64-linux-gnu-ld: mm/memory_hotplug.o: in function `.L242':
memory_hotplug.c:(.ref.text+0x930): undefined reference to `arch_remove_memory'
make: *** [Makefile:1169:vmlinux] 错误 1

Signed-off-by: Yupeng Li <[email protected]>
Signed-off-by: Caicai <[email protected]>
---
arch/loongarch/mm/init.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/arch/loongarch/mm/init.c b/arch/loongarch/mm/init.c
index 7094a68c9b83..191ed8e47895 100644
--- a/arch/loongarch/mm/init.c
+++ b/arch/loongarch/mm/init.c
@@ -142,7 +142,6 @@ int memory_add_physaddr_to_nid(u64 start)
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
#endif

-#ifdef CONFIG_MEMORY_HOTREMOVE
void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
{
unsigned long start_pfn = start >> PAGE_SHIFT;
@@ -155,7 +154,6 @@ void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
__remove_pages(start_pfn, nr_pages, altmap);
}
#endif
-#endif

/*
* Align swapper_pg_dir in to 64K, allows its address to be loaded
--
2.34.1


2022-09-04 12:38:25

by Huacai Chen

[permalink] [raw]
Subject: Re: [PATCH 1/1] LoongArch: Fixed arch_remove_memory undefined build error.

Applied to loongarch-fixes, thanks.

Huacai

On Wed, Aug 31, 2022 at 1:49 PM Yupeng Li <[email protected]> wrote:
>
> The kernel build error when unslected CONFIG_MEMORY_HOTREMOVE, the
> arch_remove_memory in mm/memory_hotplug.c was undefined.
> Removed CONFIG_MEMORY_HOTREMOVE requirement refer to the definitions
> of other platform architectures.Some build error messages like:
>
> LD vmlinux.o
> MODPOST vmlinux.symvers
> MODINFO modules.builtin.modinfo
> GEN modules.builtin
> LD .tmp_vmlinux.kallsyms1
> loongarch64-linux-gnu-ld: mm/memory_hotplug.o: in function `.L242':
> memory_hotplug.c:(.ref.text+0x930): undefined reference to `arch_remove_memory'
> make: *** [Makefile:1169:vmlinux] 错误 1
>
> Signed-off-by: Yupeng Li <[email protected]>
> Signed-off-by: Caicai <[email protected]>
> ---
> arch/loongarch/mm/init.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/arch/loongarch/mm/init.c b/arch/loongarch/mm/init.c
> index 7094a68c9b83..191ed8e47895 100644
> --- a/arch/loongarch/mm/init.c
> +++ b/arch/loongarch/mm/init.c
> @@ -142,7 +142,6 @@ int memory_add_physaddr_to_nid(u64 start)
> EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
> #endif
>
> -#ifdef CONFIG_MEMORY_HOTREMOVE
> void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
> {
> unsigned long start_pfn = start >> PAGE_SHIFT;
> @@ -155,7 +154,6 @@ void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
> __remove_pages(start_pfn, nr_pages, altmap);
> }
> #endif
> -#endif
>
> /*
> * Align swapper_pg_dir in to 64K, allows its address to be loaded
> --
> 2.34.1
>
>