From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Dan Williams <dan.j.williams@intel.com>
Cc: akpm@linux-foundation.org, Randy Dunlap <rdunlap@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
kernel test robot <lkp@intel.com>,
Christoph Hellwig <hch@infradead.org>,
Christoph Hellwig <hch@lst.de>,
Joao Martins <joao.m.martins@oracle.com>,
x86@kernel.org, Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Vishal Verma <vishal.l.verma@intel.com>,
linux-mm@kvack.org, linux-nvdimm@lists.01.org
Subject: Re: [PATCH v4] mm: Fix phys_to_target_node() and memory_add_physaddr_to_nid() exports
Date: Fri, 6 Nov 2020 17:40:16 +1100 [thread overview]
Message-ID: <20201106174016.59a2bfb2@canb.auug.org.au> (raw)
In-Reply-To: <160461461867.1505359.5301571728749534585.stgit@dwillia2-desk3.amr.corp.intel.com>
[-- Attachment #1: Type: text/plain, Size: 3377 bytes --]
Hi Dan,
On Thu, 05 Nov 2020 14:20:45 -0800 Dan Williams <dan.j.williams@intel.com> 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 <rdunlap@infradead.org>
> Tested-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: Thomas Gleixner <tglx@linutronix.de>
> Tested-by: Thomas Gleixner <tglx@linutronix.de>
> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Christoph Hellwig <hch@infradead.org>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Fixes: a035b6bf863e ("mm/memory_hotplug: introduce default phys_to_target_node() implementation")
> Cc: Joao Martins <joao.m.martins@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: x86@kernel.org
> 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>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> 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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2020-11-06 6:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 22:20 Dan Williams
2020-11-06 6:40 ` Stephen Rothwell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201106174016.59a2bfb2@canb.auug.org.au \
--to=sfr@canb.auug.org.au \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=dan.j.williams@intel.com \
--cc=fenghua.yu@intel.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=joao.m.martins@oracle.com \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=lkp@intel.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=rdunlap@infradead.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=vishal.l.verma@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox