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=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 5576DC2D0A3 for ; Fri, 6 Nov 2020 06:40:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AA1A6208C3 for ; Fri, 6 Nov 2020 06:40:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.b="WZU30Q/y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA1A6208C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9712D6B005C; Fri, 6 Nov 2020 01:40:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 920416B005D; Fri, 6 Nov 2020 01:40:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80E906B0068; Fri, 6 Nov 2020 01:40:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0143.hostedemail.com [216.40.44.143]) by kanga.kvack.org (Postfix) with ESMTP id 52DDA6B005C for ; Fri, 6 Nov 2020 01:40:28 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DD6D21EE6 for ; Fri, 6 Nov 2020 06:40:27 +0000 (UTC) X-FDA: 77453044494.01.quiet87_310eb57272d0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id C04561004BE45 for ; Fri, 6 Nov 2020 06:40:27 +0000 (UTC) X-HE-Tag: quiet87_310eb57272d0 X-Filterd-Recvd-Size: 6509 Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Fri, 6 Nov 2020 06:40:26 +0000 (UTC) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4CS9kB07Z4z9sRK; Fri, 6 Nov 2020 17:40:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1604644822; bh=4gkQRIBRnS4TBA+uN2ymy2jL+Yn0naxTFoCuzo4imw4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WZU30Q/ywEpioSKQVsEQ+qjSVJocvP7yrqDwgbNrcXb7TxyF/BaTKoTlJx4qMaMuC BHKtjygNwqRcU4kopBzXlXIUfQY5lvq0Zvn8H6mu8sAOXdIDYuww4umyMkzohdGdAD Nhx4TI3NirOaBohd3VJDgwMcj3nmni3pinmZ/lNyOaIGjQLsxrLnMEimtzNy4iul5O oEcho3xTw5x+Y+tlPgfGnsqG4yLHzJuOAnkwEScs95r3PBnr7zYUPcfcljtr10Yiqk 2+LBsv1uLhKCyZGL4OmD3dX2KAw4p7uuPofnUbZ616M1VMgiHbNyapkKGqw80Sz/pe B1uruls7sHvRw== Date: Fri, 6 Nov 2020 17:40:16 +1100 From: Stephen Rothwell To: Dan Williams Cc: akpm@linux-foundation.org, Randy Dunlap , Thomas Gleixner , kernel test robot , Christoph Hellwig , Christoph Hellwig , Joao Martins , x86@kernel.org, Tony Luck , Fenghua Yu , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Vishal Verma , 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 Message-ID: <20201106174016.59a2bfb2@canb.auug.org.au> In-Reply-To: <160461461867.1505359.5301571728749534585.stgit@dwillia2-desk3.amr.corp.intel.com> References: <160461461867.1505359.5301571728749534585.stgit@dwillia2-desk3.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/Y_kTeFZZ18zhKZijEZoNUv6"; protocol="application/pgp-signature"; micalg=pgp-sha256 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: --Sig_/Y_kTeFZZ18zhKZijEZoNUv6 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Dan, On Thu, 05 Nov 2020 14:20:45 -0800 Dan Williams = 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: >=20 > CONFIG_NUMA_KEEP_MEMINFO=3Dy > CONFIG_MEMORY_HOTPLUG=3Dy >=20 > ...and: >=20 > CONFIG_NUMA_KEEP_MEMINFO=3Dn > CONFIG_MEMORY_HOTPLUG=3Dy >=20 > ...it failed to export the symbol in the case of: >=20 > CONFIG_NUMA_KEEP_MEMINFO=3Dy > CONFIG_MEMORY_HOTPLUG=3Dn >=20 > 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. >=20 > 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. >=20 > 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. >=20 > 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. >=20 > Reported-by: Randy Dunlap > Tested-by: Randy Dunlap > Reported-by: Thomas Gleixner > Tested-by: Thomas Gleixner > Reviewed-by: Thomas Gleixner > Reported-by: kernel test robot > Reported-by: Christoph Hellwig > Reviewed-by: Christoph Hellwig > Reported-by: Stephen Rothwell > Fixes: a035b6bf863e ("mm/memory_hotplug: introduce default phys_to_target= _node() implementation") > Cc: Joao Martins > Cc: Andrew Morton > Cc: x86@kernel.org > Cc: Tony Luck > Cc: Fenghua Yu > Cc: Michael Ellerman > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Vishal Verma > Signed-off-by: Dan Williams > --- > 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. --=20 Cheers, Stephen Rothwell --Sig_/Y_kTeFZZ18zhKZijEZoNUv6 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEENIC96giZ81tWdLgKAVBC80lX0GwFAl+k79AACgkQAVBC80lX 0GxcdQf/RSVyUmmC0LZ7GOxRFITkfQy3+JTAaPWls21QnKUMxQ70oeTOBvmQRPnf ijrFuJsCd7Tc9JNQoHfMxXyU0WfEU1H2PpXxeveiCD0SqL/WQ4W2U7LTeR+rKP6v 36P96eG2OGmvznQKpdVAqU8B21KNZuaBam+8uepit1iGOb+LTmZITd93uh/1B2xc 5LoclZpuNBUSuMyBQAswxs6psEnGStYPgnfqVGW13gzqxARTCk44s1n4/VdxJR0K Y3KMvXyTZc2cX6apVKJE8tODtXke69dR9iYxGvuEDuYLS/ydTeG40Gev5E0CpVtq 2wnAeZ++vGkZ340pKMyRr39DJiOjdw== =u2UN -----END PGP SIGNATURE----- --Sig_/Y_kTeFZZ18zhKZijEZoNUv6--