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=-11.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 368AFC4363A for ; Fri, 30 Oct 2020 03:05:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 575D4206C1 for ; Fri, 30 Oct 2020 03:05:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="TigpKhuN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 575D4206C1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9A1C86B005C; Thu, 29 Oct 2020 23:05:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 951D06B0062; Thu, 29 Oct 2020 23:05:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8440A6B006C; Thu, 29 Oct 2020 23:05:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id 57C066B005C for ; Thu, 29 Oct 2020 23:05:54 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id F2F9C3623 for ; Fri, 30 Oct 2020 03:05:53 +0000 (UTC) X-FDA: 77427102228.17.bee90_180650727292 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id D3B1A180D0181 for ; Fri, 30 Oct 2020 03:05:53 +0000 (UTC) X-HE-Tag: bee90_180650727292 X-Filterd-Recvd-Size: 5282 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Fri, 30 Oct 2020 03:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=IQCVq7lEFY4ZXTcSP8xyrm8MlU2EUcpLtjS377JVJrA=; b=TigpKhuNkaCHPAVrtzYG2pTwkr MQtdqJ44dF6DgW4X3L3QiOSF1U4bfsNpakAYDDhFQN1E+Nehxpe0iOBh4C1qrJqbsqceI9THYatBd y9OnxhinSIJFKAFVxq2/j/hhkOJUCjMbE4Ghqn0/8YM8rZ5L3zzA0dxwSM4VaiROF7SqT6MRhy1f/ 96/mT8gaIv/GULDNzkhb5aEB7mRQ/oBlgV+d+Pbrha9+f4kbyjkQApjbNQyehxAqFmnE5n8hGN+GP j03L20PMrzEWvMy5oafjodPnHOf1ErW0mkdBYhj3FNP0xBsdcRB561V/IVYGghh4H226+Ddy2+roQ /ryZNJiA==; Received: from [2601:1c0:6280:3f0::371c] by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYKjb-0001Ap-DH; Fri, 30 Oct 2020 03:05:47 +0000 Subject: Re: [PATCH] x86/mm: Fix phys_to_target_node() export To: Dan Williams , akpm@linux-foundation.org Cc: Thomas Gleixner , kernel test robot , Joao Martins , x86@kernel.org, Vishal Verma , linux-mm@kvack.org, linux-nvdimm@lists.01.org References: <160402498564.4173389.2743697400148832021.stgit@dwillia2-desk3.amr.corp.intel.com> From: Randy Dunlap Message-ID: Date: Thu, 29 Oct 2020 20:05:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <160402498564.4173389.2743697400148832021.stgit@dwillia2-desk3.amr.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US 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: On 10/29/20 7:29 PM, Dan Williams wrote: > 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 Looks good. Thanks. Acked-by: Randy Dunlap # build-tested > --- > 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, > > -- ~Randy