Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp385188ybt; Wed, 8 Jul 2020 02:16:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytw6vCRkJ27g02/DV2lHgiU4NeA7IALL48FMtYJBFvSKQD6J4ol0IkdeSg+9Q0aObPgIa3 X-Received: by 2002:a50:bb48:: with SMTP id y66mr60775706ede.147.1594199816918; Wed, 08 Jul 2020 02:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594199816; cv=none; d=google.com; s=arc-20160816; b=NPLN29a+G20XZKOsRWONT51IOHewbZUfRVDxKjKEtQLgKmKdN1DMxzrth5zghVrEl/ VedlMdHq9FOpwDIpUGcS8p6r6xhwwVK8V+t9QLqk3zdE8WQJPD9DmEnZXtQ6OFdoLWAO pgV1M5Ab+cFFG/DmTt3J4EmFVdo8mBjiMlJUePgxTFmmUs76M8cJSVgKl2N1bEhqGA50 7seeKra6KLCu/nfClYntdlSsS1stP9E7nYz/ggJV3I6Chrc0rwhiPfPHdlP0+NzOw01J tiOOOd13QdJmGMHEStGYnuzCoUovWz93gMe4a8Ky3Saok3TvT7sXv2VVUzPfR5q3+lSR +D0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ozEKG7jNrCSk5U6jgw8rNUk+M7a/dUYqHJ+T+4GcM2A=; b=r5e66t9ROzaM9Ud5jRJZMKjf8ymbrSDoE7qIGlSo/BdzVgli5rCK7DrTjN4yzG36pB ksR9L6V+GvjsXB9MdBEdnyxWr2NWlhNFj10xkKmMosoVRljg/PMToE5j1M2qmMJ42VJl ujPKYr7ee1BxARSTV1HLAXfL1LyLK55D5n4CYD8FfvIIGUBr1EyDZ9JSUpEQDbTHrlqG DGmJq5k7CuHbPEa+jzFLagjxwjtmiy/jzQzCwTjAdcVqeiDmbdnziGyiRaERKwq5r4SL lRJSKMoO94YuTN52Wky7WCnEGTiW2r+qErl0m4m3WWYVX8o4IelIVH5MFsanvtskD2lm /btw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JpMvnDS0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lm6si15396999ejb.268.2020.07.08.02.16.33; Wed, 08 Jul 2020 02:16:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JpMvnDS0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728024AbgGHJPb (ORCPT + 99 others); Wed, 8 Jul 2020 05:15:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:56370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726285AbgGHJPb (ORCPT ); Wed, 8 Jul 2020 05:15:31 -0400 Received: from kernel.org (unknown [87.71.40.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AE9292063A; Wed, 8 Jul 2020 09:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594199730; bh=1P3BCibtQ27BJR4HH94/+rxqEdbIvNz2+VLbK4bFC5A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JpMvnDS0sU0t8bLM4FA3w1+3DXw2v19WPhpIaJ+Bh+QhCuRE6GcLUPwkSeMR3lL9x u9T7XOCbfiKI5mq0gZkFjKcECE7YizAF2NyOleKpCYCoUKL+sjFQZ3pkzkBfDwuzyG vnZkmXHB5LWE6FOFDo5ku6TGgB1ggCmXDLKbZoJU= Date: Wed, 8 Jul 2020 12:15:20 +0300 From: Mike Rapoport To: David Hildenbrand Cc: Mike Rapoport , Dan Williams , Michal Hocko , Jia He , Catalin Marinas , Will Deacon , Vishal Verma , Dave Jiang , Andrew Morton , Baoquan He , Chuhong Yuan , Linux ARM , Linux Kernel Mailing List , Linux MM , linux-nvdimm , Kaly Xin Subject: Re: [PATCH v2 1/3] arm64/numa: export memory_add_physaddr_to_nid as EXPORT_SYMBOL_GPL Message-ID: <20200708091520.GE128651@kernel.org> References: <20200707121302.GB9411@linux.ibm.com> <474f93e7-c709-1a13-5418-29f1777f614c@redhat.com> <20200707180043.GA386073@linux.ibm.com> <20200708052626.GB386073@linux.ibm.com> <9a009cf6-6c30-91ca-a1a5-9aa090c66631@redhat.com> <999ea296-4695-1219-6a4d-a027718f61e5@redhat.com> <20200708083951.GH386073@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 08, 2020 at 10:45:17AM +0200, David Hildenbrand wrote: > On 08.07.20 10:39, Mike Rapoport wrote: > > On Wed, Jul 08, 2020 at 10:26:41AM +0200, David Hildenbrand wrote: > >> On 08.07.20 09:50, Dan Williams wrote: > >>> On Wed, Jul 8, 2020 at 12:22 AM David Hildenbrand wrote: > >>>> > >>>>>>>>>> On Tue 07-07-20 13:59:15, Jia He wrote: > >>>>>>>>>>> This exports memory_add_physaddr_to_nid() for module driver to use. > >>>>>>>>>>> > >>>>>>>>>>> memory_add_physaddr_to_nid() is a fallback option to get the nid in case > >>>>>>>>>>> NUMA_NO_NID is detected. > >>>>>>>>>>> > >>>>>>>>>>> Suggested-by: David Hildenbrand > >>>>>>>>>>> Signed-off-by: Jia He > >>>>>>>>>>> --- > >>>>>>>>>>> arch/arm64/mm/numa.c | 5 +++-- > >>>>>>>>>>> 1 file changed, 3 insertions(+), 2 deletions(-) > >>>>>>>>>>> > >>>>>>>>>>> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c > >>>>>>>>>>> index aafcee3e3f7e..7eeb31740248 100644 > >>>>>>>>>>> --- a/arch/arm64/mm/numa.c > >>>>>>>>>>> +++ b/arch/arm64/mm/numa.c > >>>>>>>>>>> @@ -464,10 +464,11 @@ void __init arm64_numa_init(void) > >>>>>>>>>>> > >>>>>>>>>>> /* > >>>>>>>>>>> * We hope that we will be hotplugging memory on nodes we already know about, > >>>>>>>>>>> - * such that acpi_get_node() succeeds and we never fall back to this... > >>>>>>>>>>> + * such that acpi_get_node() succeeds. But when SRAT is not present, the node > >>>>>>>>>>> + * id may be probed as NUMA_NO_NODE by acpi, Here provide a fallback option. > >>>>>>>>>>> */ > >>>>>>>>>>> int memory_add_physaddr_to_nid(u64 addr) > >>>>>>>>>>> { > >>>>>>>>>>> - pr_warn("Unknown node for memory at 0x%llx, assuming node 0\n", addr); > >>>>>>>>>>> return 0; > >>>>>>>>>>> } > >>>>>>>>>>> +EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); > >>>>>>>>>> > >>>>>>>>>> Does it make sense to export a noop function? Wouldn't make more sense > >>>>>>>>>> to simply make it static inline somewhere in a header? I haven't checked > >>>>>>>>>> whether there is an easy way to do that sanely bu this just hit my eyes. > > > >> I'd be curious if what we are trying to optimize here is actually worth > >> optimizing. IOW, is there a well-known scenario where the dummy value on > >> arm64 would be problematic and is worth the effort? > > > > Well, it started with Michal's comment above that EXPORT_SYMBOL_GPL() > > for a stub might be an overkill. > > > > I think Jia's suggestion [1] with addition of a comment that explains > > why and when the stub will be used, can work for both > > memory_add_physaddr_to_nid() and phys_to_target_node(). > > Agreed. > > > > > But on more theoretical/fundmanetal level, I think we lack a generic > > abstraction similar to e.g. x86 'struct numa_meminfo' that serves as > > translaton of firmware supplied information into data that can be used > > by the generic mm without need to reimplement it for each and every > > arch. > > Right. As I expressed, I am not a friend of using memblock for that, and > the pgdat node span is tricky. > > Maybe abstracting that x86 concept is possible in some way (and we could > restrict the information to boot-time properties, so we don't have to > mess with memory hot(un)plug - just as done for numa_meminfo AFAIKS). I agree with pgdat part and disagree about memblock. It already has non-init physmap, why won't we add memblock.memory to the mix? ;-) Now, seriously, memblock already has all the necessary information about the coldplug memory for several architectures. x86 being an exception because for some reason the reserved memory is not considered memory there. The infrastructure for quiering and iterating memory regions is already there. We just need to leave out the irrelevant parts, like memblock.reserved and allocation funcions. Otherwise we'll add yet another 'struct { start, end }', a horde of covnersion and re-initialization functions that will do more or less the same things as current memblock APIs. > -- > Thanks, > > David / dhildenb > > -- Sincerely yours, Mike.