linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: David Hildenbrand <david@redhat.com>
Cc: Mike Rapoport <rppt@linux.ibm.com>, Justin He <Justin.He@arm.com>,
	Michal Hocko <mhocko@kernel.org>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Baoquan He <bhe@redhat.com>, Chuhong Yuan <hslester96@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	Kaly Xin <Kaly.Xin@arm.com>
Subject: Re: [PATCH v2 1/3] arm64/numa: export memory_add_physaddr_to_nid as EXPORT_SYMBOL_GPL
Date: Wed, 8 Jul 2020 00:04:06 -0700	[thread overview]
Message-ID: <CAPcyv4inaZgmv=S36_DofA9prKhWg4KBNPkTvzSALO6Vtb9ddw@mail.gmail.com> (raw)
In-Reply-To: <c4ee0a94-c980-80ca-c43d-15729e1a3663@redhat.com>

On Tue, Jul 7, 2020 at 11:59 PM David Hildenbrand <david@redhat.com> wrote:
>
> On 08.07.20 08:22, Mike Rapoport wrote:
> > On Tue, Jul 07, 2020 at 09:27:43PM -0700, Dan Williams wrote:
> >> On Tue, Jul 7, 2020 at 9:08 PM Justin He <Justin.He@arm.com> wrote:
> >> [..]
> >>>> Especially for architectures that use memblock info for numa info
> >>>> (which seems to be everyone except x86) why not implement a generic
> >>>> memory_add_physaddr_to_nid() that does:
> >>>>
> >>>> int memory_add_physaddr_to_nid(u64 addr)
> >>>> {
> >>>>         unsigned long start_pfn, end_pfn, pfn = PHYS_PFN(addr);
> >>>>         int nid;
> >>>>
> >>>>         for_each_online_node(nid) {
> >>>>                 get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
> >>>>                 if (pfn >= start_pfn && pfn <= end_pfn)
> >>>>                         return nid;
> >>>>         }
> >>>>         return NUMA_NO_NODE;
> >>>> }
> >>>
> >>> Thanks for your suggestion,
> >>> Could I wrap the codes and let memory_add_physaddr_to_nid simply invoke
> >>> phys_to_target_node()?
> >>
> >> I think it needs to be the reverse. phys_to_target_node() should call
> >> memory_add_physaddr_to_nid() by default, but fall back to searching
> >> reserved memory address ranges in memblock. See phys_to_target_node()
> >> in arch/x86/mm/numa.c. That one uses numa_meminfo instead of memblock,
> >> but the principle is the same i.e. that a target node may not be
> >> represented in memblock.memory, but memblock.reserved. I'm working on
> >> a patch to provide a function similar to get_pfn_range_for_nid() that
> >> operates on reserved memory.
> >
> > Do we really need yet another memblock iterator?
> > I think only x86 has memory that is not in memblock.memory but only in
> > memblock.reserved.
>
> Reading about abusing the memblock allcoator once again in memory
> hotplug paths makes me shiver.

Technical reasoning please?

arm64 numa information is established from memblock data. It seems
counterproductive to ignore that fact if we're already touching
memory_add_physaddr_to_nid() and have a use case for a driver to call
it.
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

  reply	other threads:[~2020-07-08  7:04 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07  5:59 [PATCH v2 0/3] Fix and enable pmem as RAM device on arm64 Jia He
2020-07-07  5:59 ` [PATCH v2 1/3] arm64/numa: export memory_add_physaddr_to_nid as EXPORT_SYMBOL_GPL Jia He
2020-07-07 11:35   ` David Hildenbrand
2020-07-07 11:54   ` Michal Hocko
2020-07-07 12:13     ` Mike Rapoport
2020-07-07 12:26       ` David Hildenbrand
2020-07-07 18:00         ` Mike Rapoport
2020-07-07 22:05           ` Dan Williams
2020-07-08  5:27             ` Mike Rapoport
2020-07-08  7:21               ` David Hildenbrand
2020-07-08  7:38                 ` Mike Rapoport
2020-07-08  7:40                   ` David Hildenbrand
2020-07-08  7:50                 ` Dan Williams
2020-07-08  8:26                   ` David Hildenbrand
2020-07-08  8:39                     ` Mike Rapoport
2020-07-08  8:45                       ` David Hildenbrand
2020-07-08  9:15                         ` Mike Rapoport
2020-07-08  9:25                           ` David Hildenbrand
2020-07-08  9:45                             ` Mike Rapoport
2020-07-08 10:04                               ` David Hildenbrand
2020-07-08 15:50                                 ` Dan Williams
2020-07-08 16:10                                   ` David Hildenbrand
2020-07-08 16:47                                     ` Mike Rapoport
2020-07-08  2:20     ` Justin He
2020-07-08  3:56       ` Dan Williams
2020-07-08  4:08         ` Justin He
2020-07-08  4:27           ` Dan Williams
2020-07-08  6:22             ` Mike Rapoport
2020-07-08  6:53               ` Dan Williams
2020-07-08  6:59               ` David Hildenbrand
2020-07-08  7:04                 ` Dan Williams [this message]
2020-07-08  7:16                   ` David Hildenbrand
2020-07-08  7:43                     ` Mike Rapoport
2020-07-08  5:32         ` Mike Rapoport
2020-07-08  5:48           ` Dan Williams
2020-07-08  6:19             ` Mike Rapoport
2020-07-08  6:44               ` Dan Williams
2020-07-08  6:56             ` Justin He
2020-07-08  7:00               ` David Hildenbrand
2020-07-07  5:59 ` [RFC PATCH v2 2/3] device-dax: use fallback nid when numa_node is invalid Jia He
2020-07-07  6:08   ` Justin He
2020-07-07 11:34   ` David Hildenbrand
2020-07-08  1:41     ` Justin He
2020-07-07  5:59 ` [PATCH v2 3/3] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done Jia He
2020-07-07 10:06   ` Michal Hocko
2020-07-07 11:31   ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPcyv4inaZgmv=S36_DofA9prKhWg4KBNPkTvzSALO6Vtb9ddw@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=Justin.He@arm.com \
    --cc=Kaly.Xin@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=david@redhat.com \
    --cc=hslester96@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=mhocko@kernel.org \
    --cc=rppt@linux.ibm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).