Hi Dan,

On Thu, 05 Nov 2020 14:20:45 -0800 Dan Williams <[email protected]> 
wrote:
>
> The core-mm has a default __weak implementation of phys_to_target_node()
> to mirror the weak definition of memory_add_physaddr_to_nid(). That
> symbol is exported for modules. However, while the export in
> mm/memory_hotplug.c exported the symbol in the configuration cases of:
> 
>       CONFIG_NUMA_KEEP_MEMINFO=y
>       CONFIG_MEMORY_HOTPLUG=y
> 
> ...and:
> 
>       CONFIG_NUMA_KEEP_MEMINFO=n
>       CONFIG_MEMORY_HOTPLUG=y
> 
> ...it failed to export the symbol in the case of:
> 
>       CONFIG_NUMA_KEEP_MEMINFO=y
>       CONFIG_MEMORY_HOTPLUG=n
> 
> Not only is that broken, but Christoph points out that the kernel should
> not be exporting any __weak symbol, which means that
> memory_add_physaddr_to_nid() example that phys_to_target_node() copied
> is broken too.
> 
> Rework the definition of phys_to_target_node() and
> memory_add_physaddr_to_nid() to not require weak symbols. Move to the
> common arch override design-pattern of an asm header defining a symbol
> to replace the default implementation.
> 
> The only common header that all memory_add_physaddr_to_nid() producing
> architectures implement is asm/sparsemem.h. In fact, powerpc already
> defines its memory_add_physaddr_to_nid() helper in sparsemem.h.
> Double-down on that observation and define phys_to_target_node() where
> necessary in asm/sparsemem.h. An alternate consideration that was
> discarded was to put this override in asm/numa.h, but that entangles
> with the definition of MAX_NUMNODES relative to the inclusion of
> linux/nodemask.h, and requires powerpc to grow a new header.
> 
> The dependency on NUMA_KEEP_MEMINFO for DEV_DAX_HMEM_DEVICES is invalid
> now that the symbol is properly exported / stubbed in all combinations
> of CONFIG_NUMA_KEEP_MEMINFO and CONFIG_MEMORY_HOTPLUG.
> 
> Reported-by: Randy Dunlap <[email protected]>
> Tested-by: Randy Dunlap <[email protected]>
> Reported-by: Thomas Gleixner <[email protected]>
> Tested-by: Thomas Gleixner <[email protected]>
> Reviewed-by: Thomas Gleixner <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Reported-by: Christoph Hellwig <[email protected]>
> Reviewed-by: Christoph Hellwig <[email protected]>
> Reported-by: Stephen Rothwell <[email protected]>
> Fixes: a035b6bf863e ("mm/memory_hotplug: introduce default 
> phys_to_target_node() implementation")
> Cc: Joao Martins <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Cc: [email protected]
> Cc: Tony Luck <[email protected]>
> Cc: Fenghua Yu <[email protected]>
> Cc: Michael Ellerman <[email protected]>
> Cc: Benjamin Herrenschmidt <[email protected]>
> Cc: Paul Mackerras <[email protected]>
> Cc: Vishal Verma <[email protected]>
> Signed-off-by: Dan Williams <[email protected]>
> ---
> Changes since v3 [1]:
> - (Stephen) PowerPC header include dependencies make it difficult to
>   include asm/sparsemem.h in linux/numa.h due to missing definition of
>   pgprot.  Move the declaration of create_section_mapping() to
>   asm/mmzone.h. This has received a build success notification from the
>   kbuild-robot over 159 configs.

I replaced the previous version in linux-next with this today.  Thanks.

-- 
Cheers,
Stephen Rothwell

Attachment: pgpDD1ohXq7FT.pgp
Description: OpenPGP digital signature

_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to