https://github.com/torvalds/linux
Revision a927bd6ba952d13c52b8b385030943032f659a3e authored by Dan Williams on 22 November 2020, 06:17:05 UTC, committed by Linus Torvalds on 22 November 2020, 18:48:22 UTC
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.

[dan.j.williams@intel.com: v4]
  Link: https://lkml.kernel.org/r/160461461867.1505359.5301571728749534585.stgit@dwillia2-desk3.amr.corp.intel.com
[dan.j.williams@intel.com: powerpc: fix create_section_mapping compile warning]
  Link: https://lkml.kernel.org/r/160558386174.2948926.2740149041249041764.stgit@dwillia2-desk3.amr.corp.intel.com

Fixes: a035b6bf863e ("mm/memory_hotplug: introduce default phys_to_target_node() implementation")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Thomas Gleixner <tglx@linutronix.de>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Link: https://lkml.kernel.org/r/160447639846.1133764.7044090803980177548.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent bc2dc44
History
Tip revision: a927bd6ba952d13c52b8b385030943032f659a3e authored by Dan Williams on 22 November 2020, 06:17:05 UTC
mm: fix phys_to_target_node() and memory_add_physaddr_to_nid() exports
Tip revision: a927bd6
File Mode Size
bpfilter
netfilter
Kconfig -rw-r--r-- 25.9 KB
Makefile -rw-r--r-- 2.8 KB
af_inet.c -rw-r--r-- 51.4 KB
ah4.c -rw-r--r-- 13.6 KB
arp.c -rw-r--r-- 35.8 KB
bpf_tcp_ca.c -rw-r--r-- 6.4 KB
cipso_ipv4.c -rw-r--r-- 61.3 KB
datagram.c -rw-r--r-- 3.1 KB
devinet.c -rw-r--r-- 68.6 KB
esp4.c -rw-r--r-- 27.6 KB
esp4_offload.c -rw-r--r-- 8.5 KB
fib_frontend.c -rw-r--r-- 38.6 KB
fib_lookup.h -rw-r--r-- 1.6 KB
fib_notifier.c -rw-r--r-- 1.6 KB
fib_rules.c -rw-r--r-- 9.8 KB
fib_semantics.c -rw-r--r-- 52.2 KB
fib_trie.c -rw-r--r-- 71.7 KB
fou.c -rw-r--r-- 28.1 KB
gre_demux.c -rw-r--r-- 4.8 KB
gre_offload.c -rw-r--r-- 7.0 KB
icmp.c -rw-r--r-- 32.7 KB
igmp.c -rw-r--r-- 72.6 KB
inet_connection_sock.c -rw-r--r-- 30.7 KB
inet_diag.c -rw-r--r-- 35.3 KB
inet_fragment.c -rw-r--r-- 14.4 KB
inet_hashtables.c -rw-r--r-- 22.2 KB
inet_timewait_sock.c -rw-r--r-- 8.9 KB
inetpeer.c -rw-r--r-- 8.5 KB
ip_forward.c -rw-r--r-- 4.1 KB
ip_fragment.c -rw-r--r-- 17.6 KB
ip_gre.c -rw-r--r-- 45.4 KB
ip_input.c -rw-r--r-- 18.3 KB
ip_options.c -rw-r--r-- 14.8 KB
ip_output.c -rw-r--r-- 43.0 KB
ip_sockglue.c -rw-r--r-- 40.9 KB
ip_tunnel.c -rw-r--r-- 29.6 KB
ip_tunnel_core.c -rw-r--r-- 29.3 KB
ip_vti.c -rw-r--r-- 17.0 KB
ipcomp.c -rw-r--r-- 4.4 KB
ipconfig.c -rw-r--r-- 42.3 KB
ipip.c -rw-r--r-- 18.4 KB
ipmr.c -rw-r--r-- 75.8 KB
ipmr_base.c -rw-r--r-- 10.2 KB
metrics.c -rw-r--r-- 2.2 KB
netfilter.c -rw-r--r-- 2.5 KB
netlink.c -rw-r--r-- 737 bytes
nexthop.c -rw-r--r-- 44.8 KB
ping.c -rw-r--r-- 27.6 KB
proc.c -rw-r--r-- 20.2 KB
protocol.c -rw-r--r-- 2.1 KB
raw.c -rw-r--r-- 26.1 KB
raw_diag.c -rw-r--r-- 6.3 KB
route.c -rw-r--r-- 89.5 KB
syncookies.c -rw-r--r-- 12.6 KB
sysctl_net_ipv4.c -rw-r--r-- 35.4 KB
tcp.c -rw-r--r-- 109.2 KB
tcp_bbr.c -rw-r--r-- 40.9 KB
tcp_bic.c -rw-r--r-- 6.0 KB
tcp_bpf.c -rw-r--r-- 14.6 KB
tcp_cdg.c -rw-r--r-- 11.1 KB
tcp_cong.c -rw-r--r-- 11.4 KB
tcp_cubic.c -rw-r--r-- 15.5 KB
tcp_dctcp.c -rw-r--r-- 7.2 KB
tcp_dctcp.h -rw-r--r-- 1.0 KB
tcp_diag.c -rw-r--r-- 5.5 KB
tcp_fastopen.c -rw-r--r-- 16.5 KB
tcp_highspeed.c -rw-r--r-- 4.9 KB
tcp_htcp.c -rw-r--r-- 7.4 KB
tcp_hybla.c -rw-r--r-- 4.9 KB
tcp_illinois.c -rw-r--r-- 8.3 KB
tcp_input.c -rw-r--r-- 195.9 KB
tcp_ipv4.c -rw-r--r-- 78.1 KB
tcp_lp.c -rw-r--r-- 8.8 KB
tcp_metrics.c -rw-r--r-- 26.8 KB
tcp_minisocks.c -rw-r--r-- 26.6 KB
tcp_nv.c -rw-r--r-- 15.7 KB
tcp_offload.c -rw-r--r-- 8.1 KB
tcp_output.c -rw-r--r-- 118.6 KB
tcp_rate.c -rw-r--r-- 7.8 KB
tcp_recovery.c -rw-r--r-- 7.5 KB
tcp_scalable.c -rw-r--r-- 1.4 KB
tcp_timer.c -rw-r--r-- 22.5 KB
tcp_ulp.c -rw-r--r-- 3.4 KB
tcp_vegas.c -rw-r--r-- 9.7 KB
tcp_vegas.h -rw-r--r-- 940 bytes
tcp_veno.c -rw-r--r-- 5.8 KB
tcp_westwood.c -rw-r--r-- 8.3 KB
tcp_yeah.c -rw-r--r-- 6.6 KB
tunnel4.c -rw-r--r-- 6.5 KB
udp.c -rw-r--r-- 82.0 KB
udp_bpf.c -rw-r--r-- 1.3 KB
udp_diag.c -rw-r--r-- 7.2 KB
udp_impl.h -rw-r--r-- 966 bytes
udp_offload.c -rw-r--r-- 16.5 KB
udp_tunnel_core.c -rw-r--r-- 5.6 KB
udp_tunnel_nic.c -rw-r--r-- 24.2 KB
udp_tunnel_stub.c -rw-r--r-- 199 bytes
udplite.c -rw-r--r-- 2.9 KB
xfrm4_input.c -rw-r--r-- 4.2 KB
xfrm4_output.c -rw-r--r-- 1.1 KB
xfrm4_policy.c -rw-r--r-- 5.9 KB
xfrm4_protocol.c -rw-r--r-- 6.6 KB
xfrm4_state.c -rw-r--r-- 469 bytes
xfrm4_tunnel.c -rw-r--r-- 2.7 KB

back to top