From patchwork Fri Oct 30 02:29:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 11868271 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF0D414B7 for ; Fri, 30 Oct 2020 02:29:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 745AE2076D for ; Fri, 30 Oct 2020 02:29:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 745AE2076D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 372116B005C; Thu, 29 Oct 2020 22:29:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2F9FC6B005D; Thu, 29 Oct 2020 22:29:50 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C28C6B0062; Thu, 29 Oct 2020 22:29:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id E090F6B005C for ; Thu, 29 Oct 2020 22:29:49 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 79C0F180AD807 for ; Fri, 30 Oct 2020 02:29:49 +0000 (UTC) X-FDA: 77427011298.06.game11_0a042e227292 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 69D5F10050AD9 for ; Fri, 30 Oct 2020 02:29:49 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,dan.j.williams@intel.com,,RULES_HIT:30054:30064:30089,0,RBL:192.55.52.88:@intel.com:.lbl8.mailshell.net-64.95.201.95 62.18.0.100;04y8x8rnid5amu95xbjtq3fefdigzop1443kgqd9wego85s8p1keeskb1t37bi1.zxujctf8cst4mzoytu5uszeyydfgop974hhs6u8649wms3j9kgj7zu7hja9h73y.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:69,LUA_SUMMARY:none X-HE-Tag: game11_0a042e227292 X-Filterd-Recvd-Size: 4749 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Fri, 30 Oct 2020 02:29:47 +0000 (UTC) IronPort-SDR: yATeTjv+2Wtb05MqHVd+rau+QgYxmnMBwpT8INsGapCOVooMh2LjOB8eZM/cBggXDwt/42IY3f S1uZuO8whyCg== X-IronPort-AV: E=McAfee;i="6000,8403,9789"; a="186349125" X-IronPort-AV: E=Sophos;i="5.77,431,1596524400"; d="scan'208";a="186349125" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2020 19:29:46 -0700 IronPort-SDR: 0m9zSQ8Ulvc9GCrW6m5p/5A7Eo0WvOT6RcYkfymBIH3tsBgCJGtLsWEZfarcpK8N3kCHMJXU50 K+XkQwr1gaqg== X-IronPort-AV: E=Sophos;i="5.77,431,1596524400"; d="scan'208";a="319177425" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2020 19:29:45 -0700 Subject: [PATCH] x86/mm: Fix phys_to_target_node() export From: Dan Williams To: akpm@linux-foundation.org Cc: Randy Dunlap , Thomas Gleixner , kernel test robot , Joao Martins , x86@kernel.org, Vishal Verma , linux-mm@kvack.org, linux-nvdimm@lists.01.org Date: Thu, 29 Oct 2020 19:29:45 -0700 Message-ID: <160402498564.4173389.2743697400148832021.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The core-mm has a default __weak implementation of phys_to_target_node() when the architecture does not override it. 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 Always export the symbol from the CONFIG_NUMA_KEEP_MEMINFO section of arch/x86/mm/numa.c, and teach mm/memory_hotplug.c to optionally export in case arch/x86/mm/numa.c has already performed the export. The dependency on NUMA_KEEP_MEMINFO for DEV_DAX_HMEM_DEVICES is invalid now that the symbol is properly exported in all combinations of CONFIG_NUMA_KEEP_MEMINFO and CONFIG_MEMORY_HOTPLUG. Note that in the CONFIG_NUMA=n case no export is needed since their is a dummy static inline implementation of phys_to_target_node() in that case. Reported-by: Randy Dunlap Reported-by: Thomas Gleixner Reported-by: kernel test robot Fixes: a035b6bf863e ("mm/memory_hotplug: introduce default phys_to_target_node() implementation") Cc: Joao Martins Cc: Andrew Morton Cc: x86@kernel.org Cc: Vishal Verma Signed-off-by: Dan Williams Acked-by: Randy Dunlap # build-tested Reviewed-by: David Hildenbrand Acked-by: Thomas Gleixner Tested-by: Thomas Gleixner Acked-by: Randy Dunlap # build-tested Reviewed-by: Christoph Hellwig Tested-by: Thomas Gleixner Reviewed-by: Thomas Gleixner --- arch/x86/mm/numa.c | 1 + drivers/dax/Kconfig | 1 - mm/memory_hotplug.c | 5 +++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 44148691d78b..e025947f19e0 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -938,6 +938,7 @@ int phys_to_target_node(phys_addr_t start) return meminfo_to_nid(&numa_reserved_meminfo, start); } +EXPORT_SYMBOL_GPL(phys_to_target_node); int memory_add_physaddr_to_nid(u64 start) { diff --git a/drivers/dax/Kconfig b/drivers/dax/Kconfig index 567428e10b7b..d2834c2cfa10 100644 --- a/drivers/dax/Kconfig +++ b/drivers/dax/Kconfig @@ -50,7 +50,6 @@ config DEV_DAX_HMEM Say M if unsure. config DEV_DAX_HMEM_DEVICES - depends on NUMA_KEEP_MEMINFO # for phys_to_target_node() depends on DEV_DAX_HMEM && DAX=y def_bool y diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index b44d4c7ba73b..ed326b489674 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -365,9 +365,14 @@ int __weak phys_to_target_node(u64 start) start); return 0; } + +/* If the arch did not export a strong symbol, export the weak one. */ +#ifndef CONFIG_NUMA_KEEP_MEMINFO EXPORT_SYMBOL_GPL(phys_to_target_node); #endif +#endif + /* find the smallest valid pfn in the range [start_pfn, end_pfn) */ static unsigned long find_smallest_section_pfn(int nid, struct zone *zone, unsigned long start_pfn,