diff mbox series

[1/7] arch_numa: Provide platform numa init hook

Message ID 20240809-mips-numa-v1-1-568751803bf8@flygoat.com (mailing list archive)
State Superseded
Headers show
Series MIPS: arch_numa enablement | expand

Commit Message

Jiaxun Yang Aug. 9, 2024, 7:25 p.m. UTC
For some pre-devicetree systems, NUMA information may come from
platform specific way.

Provide platform numa init hook to allow platform code kick in
as last resort method to supply NUMA configuration.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 drivers/base/arch_numa.c   | 7 +++++++
 include/asm-generic/numa.h | 1 +
 2 files changed, 8 insertions(+)

Comments

Arnd Bergmann Aug. 9, 2024, 7:41 p.m. UTC | #1
On Fri, Aug 9, 2024, at 21:25, Jiaxun Yang wrote:
> For some pre-devicetree systems, NUMA information may come from
> platform specific way.
>
> Provide platform numa init hook to allow platform code kick in
> as last resort method to supply NUMA configuration.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

Can you do this with a Kconfig symbol in the header instead
of a __weak symbol?

      Arnd
Jiaxun Yang Aug. 9, 2024, 7:56 p.m. UTC | #2
在2024年8月9日八月 下午8:41,Arnd Bergmann写道:
> On Fri, Aug 9, 2024, at 21:25, Jiaxun Yang wrote:
>> For some pre-devicetree systems, NUMA information may come from
>> platform specific way.
>>
>> Provide platform numa init hook to allow platform code kick in
>> as last resort method to supply NUMA configuration.
>>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>
> Can you do this with a Kconfig symbol in the header instead
> of a __weak symbol?

Hi Arnd,

Sure, is this some kind of subsystem policy or general recommendation
applies to the whole tree?

Thanks
- Jiaxun

>
>       Arnd
Arnd Bergmann Aug. 9, 2024, 8:01 p.m. UTC | #3
On Fri, Aug 9, 2024, at 21:56, Jiaxun Yang wrote:
> 在2024年8月9日八月 下午8:41,Arnd Bergmann写道:
>> On Fri, Aug 9, 2024, at 21:25, Jiaxun Yang wrote:
>>> For some pre-devicetree systems, NUMA information may come from
>>> platform specific way.
>>>
>>> Provide platform numa init hook to allow platform code kick in
>>> as last resort method to supply NUMA configuration.
>>>
>>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>
>> Can you do this with a Kconfig symbol in the header instead
>> of a __weak symbol?
>
> Sure, is this some kind of subsystem policy or general recommendation
> applies to the whole tree?

I don't think it's a general policy, possibly it's just me, but I've
had to debug too many issues that could have been avoided by not
__weak symbols, so I try to not have them in code I'm responsible
for like the asm-generic headers.

The main places that use __weak symbols are arch/mips and
drivers/pci, but there are also a number of them in mm/
and kernel/.

     Arnd
diff mbox series

Patch

diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c
index 8d49893c0e94..d464baeee69a 100644
--- a/drivers/base/arch_numa.c
+++ b/drivers/base/arch_numa.c
@@ -305,6 +305,11 @@  static int __init arch_acpi_numa_init(void)
 }
 #endif
 
+int __init __weak arch_platform_numa_init(void)
+{
+	return -EOPNOTSUPP;
+}
+
 /**
  * arch_numa_init() - Initialize NUMA
  *
@@ -318,6 +323,8 @@  void __init arch_numa_init(void)
 			return;
 		if (acpi_disabled && !numa_init(of_numa_init))
 			return;
+		if (!numa_init(arch_platform_numa_init))
+			return;
 	}
 
 	numa_init(dummy_numa_init);
diff --git a/include/asm-generic/numa.h b/include/asm-generic/numa.h
index c2b046d1fd82..53a8210fde00 100644
--- a/include/asm-generic/numa.h
+++ b/include/asm-generic/numa.h
@@ -31,6 +31,7 @@  static inline const struct cpumask *cpumask_of_node(int node)
 #endif
 
 void __init arch_numa_init(void);
+int __init arch_platform_numa_init(void);
 int __init numa_add_memblk(int nodeid, u64 start, u64 end);
 void __init early_map_cpu_to_node(unsigned int cpu, int nid);
 int __init early_cpu_to_node(int cpu);