[RFC PATCH v2 08/35] x86/topology: Switch over to GENERIC_CPU_DEVICES

Jonathan Cameron Jonathan.Cameron at Huawei.com
Thu Sep 14 04:40:25 PDT 2023


On Wed, 13 Sep 2023 16:37:56 +0000
James Morse <james.morse at arm.com> wrote:

> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> x86's struct cpus come from struct x86_cpu, which has no other members
> or users. Remove this and use the version defined by common code.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> Signed-off-by: James Morse <james.morse at arm.com>
> ----
> Changes since RFC:
>  * Fixed the second copy of arch_register_cpu() used for non-hotplug

Hi James,

See below for comment on this.  Upshot - I think you can delete that
function instead and rely on the weak version.

If you can't because of a later change, useful to call that out
in this patch description for those like me who read an review
in a linear fashion!

...

>  EXPORT_SYMBOL(arch_unregister_cpu);
>  #else /* CONFIG_HOTPLUG_CPU */
>  
> -int __init arch_register_cpu(int num)
> +int arch_register_cpu(int num)
>  {
> -	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
> +	return register_cpu(&per_cpu(cpu_devices, num), num);
>  }

Looks like the weak version introduced in patch 3.  Can this
implementation go away and fallback to that?

>  #endif /* CONFIG_HOTPLUG_CPU */
> -
> -static int __init topology_init(void)
> -{
> -	int i;
> -
> -	for_each_present_cpu(i)
> -		arch_register_cpu(i);
> -
> -	return 0;
> -}
> -subsys_initcall(topology_init);




More information about the linux-riscv mailing list