linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] libnvdimm, e820: fix numa node for e820-type-12 pmem ranges
@ 2015-11-12 17:53 Dan Williams
  2015-11-13 16:48 ` Toshi Kani
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2015-11-12 17:53 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: linux-fsdevel, Boaz Harrosh, stable

Rather than punt on the numa node for these e820 ranges try to find a
better answer with memory_add_physaddr_to_nid() when it is available.

Cc: <stable@vger.kernel.org>
Reported-by: Boaz Harrosh <boaz@plexistor.com>
Tested-by: Boaz Harrosh <boaz@plexistor.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
Only change from the original version is a compile fix for the
CONFIG_MEMORY_HOTPLUG=n case.

 drivers/nvdimm/e820.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c
index 8282db2ef99e..b0045a505dc8 100644
--- a/drivers/nvdimm/e820.c
+++ b/drivers/nvdimm/e820.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2015, Intel Corporation.
  */
 #include <linux/platform_device.h>
+#include <linux/memory_hotplug.h>
 #include <linux/libnvdimm.h>
 #include <linux/module.h>
 
@@ -25,6 +26,18 @@ static int e820_pmem_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_MEMORY_HOTPLUG
+static int e820_range_to_nid(resource_size_t addr)
+{
+	return memory_add_physaddr_to_nid(addr);
+}
+#else
+static int e820_range_to_nid(resource_size_t addr)
+{
+	return NUMA_NO_NODE;
+}
+#endif
+
 static int e820_pmem_probe(struct platform_device *pdev)
 {
 	static struct nvdimm_bus_descriptor nd_desc;
@@ -48,7 +61,7 @@ static int e820_pmem_probe(struct platform_device *pdev)
 		memset(&ndr_desc, 0, sizeof(ndr_desc));
 		ndr_desc.res = p;
 		ndr_desc.attr_groups = e820_pmem_region_attribute_groups;
-		ndr_desc.numa_node = NUMA_NO_NODE;
+		ndr_desc.numa_node = e820_range_to_nid(p->start);
 		set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags);
 		if (!nvdimm_pmem_region_create(nvdimm_bus, &ndr_desc))
 			goto err;


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] libnvdimm, e820: fix numa node for e820-type-12 pmem ranges
  2015-11-12 17:53 [PATCH v2] libnvdimm, e820: fix numa node for e820-type-12 pmem ranges Dan Williams
@ 2015-11-13 16:48 ` Toshi Kani
  2015-11-13 17:00   ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Toshi Kani @ 2015-11-13 16:48 UTC (permalink / raw)
  To: Dan Williams, linux-nvdimm; +Cc: linux-fsdevel, stable

On Thu, 2015-11-12 at 09:53 -0800, Dan Williams wrote:
> Rather than punt on the numa node for these e820 ranges try to find a
> better answer with memory_add_physaddr_to_nid() when it is available.
> 
> Cc: <stable@vger.kernel.org>
> Reported-by: Boaz Harrosh <boaz@plexistor.com>
> Tested-by: Boaz Harrosh <boaz@plexistor.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> Only change from the original version is a compile fix for the
> CONFIG_MEMORY_HOTPLUG=n case.
> 
>  drivers/nvdimm/e820.c |   15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c
> index 8282db2ef99e..b0045a505dc8 100644
> --- a/drivers/nvdimm/e820.c
> +++ b/drivers/nvdimm/e820.c
> @@ -3,6 +3,7 @@
>   * Copyright (c) 2015, Intel Corporation.
>   */
>  #include <linux/platform_device.h>
> +#include <linux/memory_hotplug.h>
>  #include <linux/libnvdimm.h>
>  #include <linux/module.h>
>  
> @@ -25,6 +26,18 @@ static int e820_pmem_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_MEMORY_HOTPLUG
> +static int e820_range_to_nid(resource_size_t addr)
> +{
> +	return memory_add_physaddr_to_nid(addr);
> +}
> +#else
> +static int e820_range_to_nid(resource_size_t addr)
> +{
> +	return NUMA_NO_NODE;
> +}
> +#endif

"linux/memory_hotplug.h" defines as follows.

#ifdef CONFIG_NUMA
extern int memory_add_physaddr_to_nid(u64 start);
#else
static inline int memory_add_physaddr_to_nid(u64 start)
{
        return 0;
}
#endif

So, memory_add_physaddr_to_nid() should be defined with #ifdef CONFIG_NUMA.

#ifdef CONFIG_MEMORY_HOTPLUG
int memory_add_physaddr_to_nid(u64 start)
{


Thanks,
-Toshi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] libnvdimm, e820: fix numa node for e820-type-12 pmem ranges
  2015-11-13 16:48 ` Toshi Kani
@ 2015-11-13 17:00   ` Dan Williams
  2015-11-13 17:42     ` Toshi Kani
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2015-11-13 17:00 UTC (permalink / raw)
  To: Toshi Kani
  Cc: linux-nvdimm@lists.01.org, linux-fsdevel, stable@vger.kernel.org

On Fri, Nov 13, 2015 at 8:48 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> On Thu, 2015-11-12 at 09:53 -0800, Dan Williams wrote:
>> Rather than punt on the numa node for these e820 ranges try to find a
>> better answer with memory_add_physaddr_to_nid() when it is available.
>>
>> Cc: <stable@vger.kernel.org>
>> Reported-by: Boaz Harrosh <boaz@plexistor.com>
>> Tested-by: Boaz Harrosh <boaz@plexistor.com>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> ---
>> Only change from the original version is a compile fix for the
>> CONFIG_MEMORY_HOTPLUG=n case.
>>
>>  drivers/nvdimm/e820.c |   15 ++++++++++++++-
>>  1 file changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c
>> index 8282db2ef99e..b0045a505dc8 100644
>> --- a/drivers/nvdimm/e820.c
>> +++ b/drivers/nvdimm/e820.c
>> @@ -3,6 +3,7 @@
>>   * Copyright (c) 2015, Intel Corporation.
>>   */
>>  #include <linux/platform_device.h>
>> +#include <linux/memory_hotplug.h>
>>  #include <linux/libnvdimm.h>
>>  #include <linux/module.h>
>>
>> @@ -25,6 +26,18 @@ static int e820_pmem_remove(struct platform_device *pdev)
>>       return 0;
>>  }
>>
>> +#ifdef CONFIG_MEMORY_HOTPLUG
>> +static int e820_range_to_nid(resource_size_t addr)
>> +{
>> +     return memory_add_physaddr_to_nid(addr);
>> +}
>> +#else
>> +static int e820_range_to_nid(resource_size_t addr)
>> +{
>> +     return NUMA_NO_NODE;
>> +}
>> +#endif
>
> "linux/memory_hotplug.h" defines as follows.
>
> #ifdef CONFIG_NUMA
> extern int memory_add_physaddr_to_nid(u64 start);
> #else
> static inline int memory_add_physaddr_to_nid(u64 start)
> {
>         return 0;
> }
> #endif
>
> So, memory_add_physaddr_to_nid() should be defined with #ifdef CONFIG_NUMA.
>
> #ifdef CONFIG_MEMORY_HOTPLUG
> int memory_add_physaddr_to_nid(u64 start)
> {
>

I thought so too, but 0day reported this:

https://lists.01.org/pipermail/kbuild-all/2015-November/014618.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] libnvdimm, e820: fix numa node for e820-type-12 pmem ranges
  2015-11-13 17:00   ` Dan Williams
@ 2015-11-13 17:42     ` Toshi Kani
  0 siblings, 0 replies; 4+ messages in thread
From: Toshi Kani @ 2015-11-13 17:42 UTC (permalink / raw)
  To: Dan Williams
  Cc: linux-nvdimm@lists.01.org, linux-fsdevel, stable@vger.kernel.org

On Fri, 2015-11-13 at 09:00 -0800, Dan Williams wrote:
> On Fri, Nov 13, 2015 at 8:48 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > On Thu, 2015-11-12 at 09:53 -0800, Dan Williams wrote:
> > > Rather than punt on the numa node for these e820 ranges try to find a
> > > better answer with memory_add_physaddr_to_nid() when it is available.
> > > 
 :
> > > +#ifdef CONFIG_MEMORY_HOTPLUG
> > > +static int e820_range_to_nid(resource_size_t addr)
> > > +{
> > > +     return memory_add_physaddr_to_nid(addr);
> > > +}
> > > +#else
> > > +static int e820_range_to_nid(resource_size_t addr)
> > > +{
> > > +     return NUMA_NO_NODE;
> > > +}
> > > +#endif
> > 
> > "linux/memory_hotplug.h" defines as follows.
> > 
> > #ifdef CONFIG_NUMA
> > extern int memory_add_physaddr_to_nid(u64 start);
> > #else
> > static inline int memory_add_physaddr_to_nid(u64 start)
> > {
> >         return 0;
> > }
> > #endif
> > 
> > So, memory_add_physaddr_to_nid() should be defined with #ifdef CONFIG_NUMA.
> > 
> > #ifdef CONFIG_MEMORY_HOTPLUG
> > int memory_add_physaddr_to_nid(u64 start)
> > {
> > 
> 
> I thought so too, but 0day reported this:
> 
> https://lists.01.org/pipermail/kbuild-all/2015-November/014618.html

Oh, I see.  "memory_hotplug.h" has #ifdef CONFIG_MEMORY_HOTPLUG before the
 memory_add_physaddr_to_nid() prototype definition...

Thanks,
-Toshi

 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-13 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-12 17:53 [PATCH v2] libnvdimm, e820: fix numa node for e820-type-12 pmem ranges Dan Williams
2015-11-13 16:48 ` Toshi Kani
2015-11-13 17:00   ` Dan Williams
2015-11-13 17:42     ` Toshi Kani

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).