summaryrefslogtreecommitdiff
path: root/drivers/acpi/numa.c
diff options
context:
space:
mode:
authorDavid Daney <david.daney@cavium.com>2016-05-24 15:35:42 -0700
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-05-30 14:27:08 +0200
commite0af261a437db4f4b21478ac677ccca5fc0ec07e (patch)
tree5dc990a6d1b924b27c2e42261f77a2050aec1d1e /drivers/acpi/numa.c
parent3770442e79380cf105c8e272622c565cf63524d6 (diff)
downloadlwn-e0af261a437db4f4b21478ac677ccca5fc0ec07e.tar.gz
lwn-e0af261a437db4f4b21478ac677ccca5fc0ec07e.zip
ACPI / NUMA: Improve SRAT error detection and add messages
Loosely based on code from Robert Richter and Hanjun Guo. Improve out of range node detection as well as allow for Larger SRAT entities. Add printing of nice messages. Signed-off-by: David Daney <david.daney@cavium.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/numa.c')
-rw-r--r--drivers/acpi/numa.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 811f90a70eab..fad6d288117f 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -252,8 +252,11 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
if (srat_disabled())
goto out_err;
- if (ma->header.length != sizeof(struct acpi_srat_mem_affinity))
+ if (ma->header.length < sizeof(struct acpi_srat_mem_affinity)) {
+ pr_err("SRAT: Unexpected header length: %d\n",
+ ma->header.length);
goto out_err_bad_srat;
+ }
if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
goto out_err;
hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE;
@@ -267,13 +270,17 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
pxm &= 0xff;
node = acpi_map_pxm_to_node(pxm);
- if (node < 0) {
- printk(KERN_ERR "SRAT: Too many proximity domains.\n");
+ if (node == NUMA_NO_NODE || node >= MAX_NUMNODES) {
+ pr_err("SRAT: Too many proximity domains.\n");
goto out_err_bad_srat;
}
- if (numa_add_memblk(node, start, end) < 0)
+ if (numa_add_memblk(node, start, end) < 0) {
+ pr_err("SRAT: Failed to add memblk to node %u [mem %#010Lx-%#010Lx]\n",
+ node, (unsigned long long) start,
+ (unsigned long long) end - 1);
goto out_err_bad_srat;
+ }
node_set(node, numa_nodes_parsed);