From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EA37C2D0A3 for ; Fri, 30 Oct 2020 02:29:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 507A22076B for ; Fri, 30 Oct 2020 02:29:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 507A22076B 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) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F9FC6B005D; Thu, 29 Oct 2020 22:29:50 -0400 (EDT) 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-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-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 --- 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,