All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Jia He <justin.he@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Mike Rapoport <rppt@linux.ibm.com>, Baoquan He <bhe@redhat.com>,
	Chuhong Yuan <hslester96@gmail.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
	Kaly Xin <Kaly.Xin@arm.com>
Subject: Re: [PATCH 1/3] arm64/numa: set numa_off to false when numa node is fake
Date: Mon, 6 Jul 2020 11:46:05 +0100	[thread overview]
Message-ID: <20200706114605.000050ac@Huawei.com> (raw)
In-Reply-To: <20200706112921.00006f7f@Huawei.com>

On Mon, 6 Jul 2020 11:29:21 +0100
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> On Mon, 6 Jul 2020 09:19:45 +0800
> Jia He <justin.he@arm.com> wrote:
> 
> Hi,
> 
> > Previously, numa_off is set to true unconditionally in dummy_numa_init(),
> > even if there is a fake numa node.
> > 
> > But acpi will translate node id to NUMA_NO_NODE(-1) in acpi_map_pxm_to_node()
> > because it regards numa_off as turning off the numa node.  
> 
> That is correct.  It is operating exactly as it should, if SRAT hasn't been parsed
> and you are on ACPI platform there are no nodes.  They cannot be created at
> some later date.  The dummy code doesn't change this. It just does enough to carry
> on operating with no specified nodes.
> 
> > 
> > Without this patch, pmem can't be probed as a RAM device on arm64 if SRAT table
> > isn't present.
> > 
> > $ndctl create-namespace -fe namespace0.0 --mode=devdax --map=dev -s 1g -a 64K
> > kmem dax0.0: rejecting DAX region [mem 0x240400000-0x2bfffffff] with invalid node: -1
> > kmem: probe of dax0.0 failed with error -22
> > 
> > This fixes it by setting numa_off to false.  
> 
> Without the SRAT protection patch [1] you may well run into problems
> because someone somewhere will have _PXM in a DSDT but will
> have a non existent SRAT.   We had this happen on an AMD platform when we
> tried to introduce working _PXM support for PCI. [2]
> 
> So whilst this seems superficially safe, I'd definitely be crossing your fingers.
> Note, at that time I proposed putting the numa_off = false into the x86 code
> path precisely to cut out that possibility (was rejected at the time, at least
> partly because the clarifications to the ACPI spec were not pubilc.)
> 
> The patch in [1] should sort things out however by ensuring we only create
> new domains where we should actually be doing so. However, in your case
> it will return NUMA_NO_NODE anyway so this isn't the right way to fix things.
> 
> [1] https://patchwork.kernel.org/patch/11632063/
> [2] https://patchwork.kernel.org/patch/10597777/

Thinking a bit more on this...

I'd like to understand more on what your use case is.

Do you have an NFIT that is setting the proximity domain for the
non-volatile memory in SPA structures?  If so the ACPI spec (6.3 makes this
clear) requires those match with domains described in SRAT.
If SRAT isn't there, then we can't expect sensible results from using these
values from NFIT.
If SRAT is there and numa=off is set then we should probably also rule out
parsing NFIT, or make all nfit handling fine with NO_NUMA_NODE, preferably
with explicit checks to ensure we don't try to use the Proximity Node values
as they have no meaning with numa=off. I note that the core NFIT parsing
is fine with the value not being supplied in the first place.

https://elixir.bootlin.com/linux/latest/source/drivers/acpi/nfit/core.c#L2947

Thanks,

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> > 
> > Signed-off-by: Jia He <justin.he@arm.com>
> > ---
> >  arch/arm64/mm/numa.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> > index aafcee3e3f7e..7689986020d9 100644
> > --- a/arch/arm64/mm/numa.c
> > +++ b/arch/arm64/mm/numa.c
> > @@ -440,7 +440,8 @@ static int __init dummy_numa_init(void)
> >  		return ret;
> >  	}
> >  
> > -	numa_off = true;
> > +	/* force numa_off to be false since we have a fake numa node here */
> > +	numa_off = false;
> >  	return 0;
> >  }
> >    
> 



WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Jia He <justin.he@arm.com>
Cc: Baoquan He <bhe@redhat.com>, Kaly Xin <Kaly.Xin@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Chuhong Yuan <hslester96@gmail.com>,
	linux-kernel@vger.kernel.org, Mike Rapoport <rppt@linux.ibm.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] arm64/numa: set numa_off to false when numa node is fake
Date: Mon, 6 Jul 2020 11:46:05 +0100	[thread overview]
Message-ID: <20200706114605.000050ac@Huawei.com> (raw)
In-Reply-To: <20200706112921.00006f7f@Huawei.com>

On Mon, 6 Jul 2020 11:29:21 +0100
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> On Mon, 6 Jul 2020 09:19:45 +0800
> Jia He <justin.he@arm.com> wrote:
> 
> Hi,
> 
> > Previously, numa_off is set to true unconditionally in dummy_numa_init(),
> > even if there is a fake numa node.
> > 
> > But acpi will translate node id to NUMA_NO_NODE(-1) in acpi_map_pxm_to_node()
> > because it regards numa_off as turning off the numa node.  
> 
> That is correct.  It is operating exactly as it should, if SRAT hasn't been parsed
> and you are on ACPI platform there are no nodes.  They cannot be created at
> some later date.  The dummy code doesn't change this. It just does enough to carry
> on operating with no specified nodes.
> 
> > 
> > Without this patch, pmem can't be probed as a RAM device on arm64 if SRAT table
> > isn't present.
> > 
> > $ndctl create-namespace -fe namespace0.0 --mode=devdax --map=dev -s 1g -a 64K
> > kmem dax0.0: rejecting DAX region [mem 0x240400000-0x2bfffffff] with invalid node: -1
> > kmem: probe of dax0.0 failed with error -22
> > 
> > This fixes it by setting numa_off to false.  
> 
> Without the SRAT protection patch [1] you may well run into problems
> because someone somewhere will have _PXM in a DSDT but will
> have a non existent SRAT.   We had this happen on an AMD platform when we
> tried to introduce working _PXM support for PCI. [2]
> 
> So whilst this seems superficially safe, I'd definitely be crossing your fingers.
> Note, at that time I proposed putting the numa_off = false into the x86 code
> path precisely to cut out that possibility (was rejected at the time, at least
> partly because the clarifications to the ACPI spec were not pubilc.)
> 
> The patch in [1] should sort things out however by ensuring we only create
> new domains where we should actually be doing so. However, in your case
> it will return NUMA_NO_NODE anyway so this isn't the right way to fix things.
> 
> [1] https://patchwork.kernel.org/patch/11632063/
> [2] https://patchwork.kernel.org/patch/10597777/

Thinking a bit more on this...

I'd like to understand more on what your use case is.

Do you have an NFIT that is setting the proximity domain for the
non-volatile memory in SPA structures?  If so the ACPI spec (6.3 makes this
clear) requires those match with domains described in SRAT.
If SRAT isn't there, then we can't expect sensible results from using these
values from NFIT.
If SRAT is there and numa=off is set then we should probably also rule out
parsing NFIT, or make all nfit handling fine with NO_NUMA_NODE, preferably
with explicit checks to ensure we don't try to use the Proximity Node values
as they have no meaning with numa=off. I note that the core NFIT parsing
is fine with the value not being supplied in the first place.

https://elixir.bootlin.com/linux/latest/source/drivers/acpi/nfit/core.c#L2947

Thanks,

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> > 
> > Signed-off-by: Jia He <justin.he@arm.com>
> > ---
> >  arch/arm64/mm/numa.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> > index aafcee3e3f7e..7689986020d9 100644
> > --- a/arch/arm64/mm/numa.c
> > +++ b/arch/arm64/mm/numa.c
> > @@ -440,7 +440,8 @@ static int __init dummy_numa_init(void)
> >  		return ret;
> >  	}
> >  
> > -	numa_off = true;
> > +	/* force numa_off to be false since we have a fake numa node here */
> > +	numa_off = false;
> >  	return 0;
> >  }
> >    
> 



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-07-06 10:47 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06  1:19 [PATCH 0/3] Fix and enable pmem as RAM on arm64 Jia He
2020-07-06  1:19 ` Jia He
2020-07-06  1:19 ` [PATCH 1/3] arm64/numa: set numa_off to false when numa node is fake Jia He
2020-07-06  1:19   ` Jia He
2020-07-06  8:02   ` David Hildenbrand
2020-07-06  8:02     ` David Hildenbrand
2020-07-06 12:36     ` Justin He
2020-07-06 12:36       ` Justin He
2020-07-06 12:36       ` Justin He
2020-07-06 13:56       ` David Hildenbrand
2020-07-06 13:56         ` David Hildenbrand
2020-07-06 13:56         ` David Hildenbrand
2020-07-06 10:29   ` Jonathan Cameron
2020-07-06 10:29     ` Jonathan Cameron
2020-07-06 10:46     ` Jonathan Cameron [this message]
2020-07-06 10:46       ` Jonathan Cameron
2020-07-06 12:47       ` Justin He
2020-07-06 12:47         ` Justin He
2020-07-06 12:47         ` Justin He
2020-07-06 13:03         ` Jonathan Cameron
2020-07-06 13:03           ` Jonathan Cameron
2020-07-06 13:03           ` Jonathan Cameron
2020-07-06  1:19 ` [PATCH 2/3] mm/memory_hotplug: harden try_offline_node against bogus nid Jia He
2020-07-06  1:19   ` Jia He
2020-07-06  7:57   ` David Hildenbrand
2020-07-06  7:57     ` David Hildenbrand
2020-07-06 13:45     ` Justin He
2020-07-06 13:45       ` Justin He
2020-07-06 13:45       ` Justin He
2020-07-06  1:19 ` [PATCH 3/3] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done Jia He
2020-07-06  1:19   ` Jia He
2020-07-06  7:49   ` David Hildenbrand
2020-07-06  7:49     ` David Hildenbrand
2020-07-07 22:10     ` Dan Williams
2020-07-07 22:10       ` Dan Williams
2020-07-07 22:10       ` Dan Williams

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=20200706114605.000050ac@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=Kaly.Xin@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=hslester96@gmail.com \
    --cc=justin.he@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.