(memory hotplug) Fix acpi_get_node() when _PXM is not defined.
PATCH 1/1 (memory hotplug) Fix acpi_get_node() when _PXM is not defined.
Hello.
This patch is to avoid returning negative value for node id if _PXM is not defined in ACPI's DSDT. There are 2 possible cases.
1) The hot-add code is executed with NUMA kernel on NON-NUMA box.
2) Firmware expects only SRAT table's information to find pxm, and it doesn't expect DSDT.
If -1 is returned for node id, kernel will touch no-pgdat address when hot-add is executed.
To fix case 2) exactly, kernel should search memory block information which cames from SRAT at boottime. But, it will be arch dependent code and it is not written for i386 and ia64 yet. And it will be post later. So, at least, kernel panic should be avoided on 2.6.18 by this patch.
This patch is for 2.6.18-rc3. And I tested this patch on my Tiger4 with hot-add emulation.
Please apply.
drivers/acpi/numa.c | 4 ++++ 1 files changed, 4 insertions(+)
drivers/acpi/numa.c +4 -0
@@ -263,6 +263,10 @@ int acpi_get_node(acpi_handle *handle)if (pxm >=0 ) node =acpi_map_pxm_to_node (pxm); +/* _PXM might not be defined by firmware. */ +if (node <0 ) + node = first_online_node; +return node; }EXPORT_SYMBOL (acpi_get_node);
Signature · 1 line
Yasunori Goto
Quoted 17 lines · Yasunori Goto
Hello.
This patch is to avoid returning negative value for node id if
_PXMis not defined in ACPI's DSDT. There are 2 possible cases.1) The hot-add code is executed with NUMA kernel on NON-NUMA box.
2) Firmware expects only SRAT table's information to find pxm, and it doesn't expect DSDT.If -1 is returned for node id, kernel will touch no-pgdat address when hot-add is executed.
To fix case 2) exactly, kernel should search memory block information which cames from SRAT at boottime. But, it will be arch dependent code and it is not written for i386 and ia64 yet. And it will be post later. So, at least, kernel panic should be avoided on 2.6.18 by this patch.
Quoted 4 lines
This patch is for 2.6.18-rc3. And I tested this patch on my Tiger4 with hot-add emulation.
Please apply.
I would rather give the arch a chance to sort out what the node is.
I don't think Linux should require the ACPI add event to contain the _pxm information. (I don't see it required in the spec). acpi_get_node is only going to work with systems that implement the acpi table in this way.
I think something like this might be better...
drivers/acpi/acpi_memhotplug.c +3 -0
@@ -241,6 +241,9 @@continue ; } +if (node <0 ) + node =memory_add_physaddr_to_nid (info->start_addr); + result =add_memory (node, info->start_addr, info->length);if (result)continue ;
Quoted 37 lines · keith mannthey
Quoted 17 lines · Yasunori Goto
Hello.
This patch is to avoid returning negative value for node id if
_PXMis not defined in ACPI's DSDT. There are 2 possible cases.1) The hot-add code is executed with NUMA kernel on NON-NUMA box.
2) Firmware expects only SRAT table's information to find pxm, and it doesn't expect DSDT.If -1 is returned for node id, kernel will touch no-pgdat address when hot-add is executed.
To fix case 2) exactly, kernel should search memory block information which cames from SRAT at boottime. But, it will be arch dependent code and it is not written for i386 and ia64 yet. And it will be post later. So, at least, kernel panic should be avoided on 2.6.18 by this patch.
Quoted 4 lines
This patch is for 2.6.18-rc3. And I tested this patch on my Tiger4 with hot-add emulation.
Please apply.
I would rather give the arch a chance to sort out what the node is.
I don't think Linux should require the ACPI add event to contain the
_pxminformation. (I don't see it required in the spec).acpi_get_nodeis only going to work with systems that implement the acpi table in this way.
I think something like this might be better...diff -urN
linux-2.6.18-rc3-stock/drivers/acpi/acpi_memhotplug.clinux-2.6.17/drivers/acpi/acpi_memhotplug.c
drivers/acpi/acpi_memhotplug.c line 249
Quoted 9 lines
drivers/acpi/acpi_memhotplug.c +3
-0@@ -241,6 +241,9 @@continue ; } +if (node <0 ) + node =memory_add_physaddr_to_nid (info->start_addr); + result =add_memory (node, info->start_addr, info->length);if (result)continue ;
Sorry about that pressed send a bit early.
drivers/acpi/acpi_memhotplug.c +3 -0
@@ -241,6 +241,9 @@continue ; } +if (node <0 ) + node =memory_add_physaddr_to_nid (info->start_addr); + result =add_memory (node, info->start_addr, info->length);if (result)continue ;
Quoted 3 lines
I don't think Linux should require the ACPI add event to contain the
_pxminformation. (I don't see it required in the spec).
Agree.
Quoted 3 lines
acpi_get_node
is only going to work with systems that implement the acpi table in this way.
This cause is just I didn't know that there is a box without _PXM in DSDT. :-P
I prefer that acpi_get_node() should include your case. Then caller of it can get node without knowledge about SRAT or DSDT by one call. So, my idea was like followings.
acpi_get_node()
{
:
if (node < 0)
node = arch_search_srat_info(handle);
if (node < 0) /* NUMA kernel executed on non NUMA box */
node = 0;
return node;
}arch_search_srat_info() must be made for each arch (i386, x86-64, ia64). And I don't know that all of them can be posted by publish of 2.6.18. So, I would like to rescue againt panic.
However, I might make sense one more by your patch....
Quoted 1 line
I think something like this might be better...
Why do you enter memory_add_physaddr_to_nid() IN the loop of searching mem_device? This implies, there is a _CRS which have multiple memory block entries, and each entries might belong DIFFERENT node each other. If so, above my idea is not appropriate. :-(
BTW, memory_add_physaddr_to_nid() is not defined for ia64's NUMA box and i386's NUMA box.
Thanks.
Quoted 14 lines
diff -urN
linux-2.6.18-rc3-stock/drivers/acpi/acpi_memhotplug.clinux-2.6.17/drivers/acpi/acpi_memhotplug.cdrivers/acpi/acpi_memhotplug.c +3
-0@@ -241,6 +241,9 @@continue ; } +if (node <0 ) + node =memory_add_physaddr_to_nid (info->start_addr); + result =add_memory (node, info->start_addr, info->length);if (result)continue ;
Signature · 1 line
Yasunori Goto