[arm64:for-next/vcpu-hotplug 17/19] arch/arm64/kernel/smp.c:563:2: error: call to undeclared function 'unregister_cpu'; ISO C99 and later do not support implicit function declarations

Gavin Shan gshan at redhat.com
Sat Jun 29 17:41:46 PDT 2024


On 6/30/24 7:14 AM, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/vcpu-hotplug
> head:   4e1a7df4548003fc081360b0f4edce3f7a991bfc
> commit: 9d0873892f4d4bf62a351897e91e5169b4c6f4aa [17/19] arm64: Kconfig: Enable hotplug CPU on arm64 if ACPI_PROCESSOR is enabled.
> config: arm64-randconfig-r063-20240629
> compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 326ba38a991250a8587a399a260b0f7af2c9166a)
> reproduce (this is a W=1 build):
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp at intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202406300437.XnuW0n34-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
>     In file included from arch/arm64/kernel/smp.c:9:
>     In file included from include/linux/acpi.h:39:
>     In file included from include/acpi/acpi_io.h:7:
>     In file included from arch/arm64/include/asm/acpi.h:14:
>     In file included from include/linux/memblock.h:12:
>     In file included from include/linux/mm.h:2253:
>     include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
>       514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
>           |                               ~~~~~~~~~~~ ^ ~~~
>>> arch/arm64/kernel/smp.c:563:2: error: call to undeclared function 'unregister_cpu'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>       563 |         unregister_cpu(c);
>           |         ^
>     arch/arm64/kernel/smp.c:563:2: note: did you mean 'register_cpu'?
>     include/linux/cpu.h:38:12: note: 'register_cpu' declared here
>        38 | extern int register_cpu(struct cpu *cpu, int num);
>           |            ^
>     1 warning and 1 error generated.
> 
> Kconfig warnings: (for reference only)
>     WARNING: unmet direct dependencies detected for ACPI_HOTPLUG_CPU
>     Depends on [n]: ACPI [=y] && ACPI_PROCESSOR [=y] && HOTPLUG_CPU [=n]
>     Selected by [y]:
>     - ARM64 [=y] && ACPI_PROCESSOR [=y]
> 
> 
> vim +/unregister_cpu +563 arch/arm64/kernel/smp.c
> 
> eba4675008a6e4 Jonathan Cameron 2024-05-29  539
> eba4675008a6e4 Jonathan Cameron 2024-05-29  540  #ifdef CONFIG_ACPI_HOTPLUG_CPU
> eba4675008a6e4 Jonathan Cameron 2024-05-29  541  void arch_unregister_cpu(int cpu)
> eba4675008a6e4 Jonathan Cameron 2024-05-29  542  {
> eba4675008a6e4 Jonathan Cameron 2024-05-29  543  	acpi_handle acpi_handle = acpi_get_processor_handle(cpu);
> eba4675008a6e4 Jonathan Cameron 2024-05-29  544  	struct cpu *c = &per_cpu(cpu_devices, cpu);
> eba4675008a6e4 Jonathan Cameron 2024-05-29  545  	acpi_status status;
> eba4675008a6e4 Jonathan Cameron 2024-05-29  546  	unsigned long long sta;
> eba4675008a6e4 Jonathan Cameron 2024-05-29  547
> eba4675008a6e4 Jonathan Cameron 2024-05-29  548  	if (!acpi_handle) {
> eba4675008a6e4 Jonathan Cameron 2024-05-29  549  		pr_err_once("Removing a CPU without associated ACPI handle\n");
> eba4675008a6e4 Jonathan Cameron 2024-05-29  550  		return;
> eba4675008a6e4 Jonathan Cameron 2024-05-29  551  	}
> eba4675008a6e4 Jonathan Cameron 2024-05-29  552
> eba4675008a6e4 Jonathan Cameron 2024-05-29  553  	status = acpi_evaluate_integer(acpi_handle, "_STA", NULL, &sta);
> eba4675008a6e4 Jonathan Cameron 2024-05-29  554  	if (ACPI_FAILURE(status))
> eba4675008a6e4 Jonathan Cameron 2024-05-29  555  		return;
> eba4675008a6e4 Jonathan Cameron 2024-05-29  556
> eba4675008a6e4 Jonathan Cameron 2024-05-29  557  	/* For now do not allow anything that looks like physical CPU HP */
> eba4675008a6e4 Jonathan Cameron 2024-05-29  558  	if (cpu_present(cpu) && !(sta & ACPI_STA_DEVICE_PRESENT)) {
> eba4675008a6e4 Jonathan Cameron 2024-05-29  559  		pr_err_once("Changing CPU present bit is not supported\n");
> eba4675008a6e4 Jonathan Cameron 2024-05-29  560  		return;
> eba4675008a6e4 Jonathan Cameron 2024-05-29  561  	}
> eba4675008a6e4 Jonathan Cameron 2024-05-29  562
> eba4675008a6e4 Jonathan Cameron 2024-05-29 @563  	unregister_cpu(c);
> eba4675008a6e4 Jonathan Cameron 2024-05-29  564  }
> eba4675008a6e4 Jonathan Cameron 2024-05-29  565  #endif /* CONFIG_ACPI_HOTPLUG_CPU */
> eba4675008a6e4 Jonathan Cameron 2024-05-29  566
> 

It's caused by the following patch in the series.

[PATCH v10 17/19] arm64: Kconfig: Enable hotplug CPU on arm64 if ACPI_PROCESSOR is enabled

I've replied to that specific patch where improvement is needed
in arch/arm64/Kconfig

     select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU

Thanks,
Gavin

> :::::: The code at line 563 was first introduced by commit
> :::::: eba4675008a6e4cbff27b579a837bd29be2642de arm64: arch_register_cpu() variant to check if an ACPI handle is now available.
> 
> :::::: TO: Jonathan Cameron <Jonathan.Cameron at huawei.com>
> :::::: CC: Catalin Marinas <catalin.marinas at arm.com>
> 




More information about the linux-arm-kernel mailing list