Skip to contentSkip to conversation

ACPI NUMA support for ARM64

PATCH In review David Daney 9 participants 31 messages May 24, 2016 – Aug 16, 2016

Subsystems (6)
x86 ACPI arm64 x86 MM +2 more subsystems
lore
Share & tools
lore
#0 lore raw

v7 cover ACPI NUMA support for ARM64

From: David Daney <[email protected]>

Rebased to Linus' master branch at commit 1d6da87a3241 ("Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux")

ACPI 5.1 already introduced NUMA support for ARM64, which can get the NUMA domain information from SRAT and SLIT table, so parse those two tables to get mappings from cpu/mem to numa node configuration and system locality.

v7 updates:

- Rebased to resolve one merge conflict.

- New patch 13/15 to enable use of existing MADT parsing code instead of adding an additional implementation of the parser.

- Added some Acked-by headers to patches in arm64 arch directories.

v6 updates:

- Changed message printed in 13/14 to omit meaningless "cpu" number. (noted by Dennis Chen and Hanjun Guo)

- New patch 7/14 to print different messages for NUMA disabled case. (noted by Dennis Chen)

- Squashed two patches into 14/14.

- Added Reviewed-by to 4/14

v5 updates:

- Fixed ia64 build failure by gating some unused functions with #if CONFIG_{X86,ARM64}.

- Fixed section mismatch errors for X86 case.

- Removed unneeded #include from some files.

- Tested to build cleanly on ARM64, X86_64, IA64

v4 updates:

- Updated from Hanjun Guo's v3 patches.

- Rebased on top of v16 of device-tree NUMA patches.

- Reordered some of the changes so that we don't introduce code and then change it several times in the patch set. New code is introduced in its final form. Code reused from x86 is first moved with no change, and then a separate patch to make any needed changes.

- code that is used only by ia64, moved to architecture specific files.

v3 updates:
- Deep investigation about the ACPI_DEBUG_PRINT() and remvoe that for acpi/numa.c (patch 2/12)

- Remove the duplicate NULL check for table print (patch 3/12)

- Introduce CONFIG_ACPI_HAS_NUMA_ARCH_FIXUP to remove duplicate dummy function for acpi_numa_arch_fixup()

- Solve the problem that the mapping from logical cpu to numa node is wrong which spotted out by Lorenzo

- cleanups for x86 and move acpi_numa_slit_init() and some other functions to common place, then reduce the duplicate of x86 and arm64 (patch 7-12/12).

- rebased on top of 4.4 and Ganapat's v9 patch set.

David Daney (4):
arm64, numa: Cleanup NUMA disabled messages.
acpi, numa: move bad_srat() and srat_disabled() to
drivers/acpi/numa.c
acpi, numa, srat: Improve SRAT error detection and add messages. ACPI / processor: Add acpi_map_madt_entry().

Hanjun Guo (10):
acpi, numa: Use pr_fmt() instead of printk
acpi, numa: Replace ACPI_DEBUG_PRINT() with pr_debug() acpi, numa: remove duplicate NULL check
acpi, numa: move acpi_numa_slit_init() to drivers/acpi/numa.c arm64, numa: rework numa_add_memblk()
x86, acpi, numa: cleanup acpi_numa_processor_affinity_init() acpi, numa: remove unneeded acpi_numa=1
acpi, numa: Move acpi_numa_memory_affinity_init() to
drivers/acpi/numa.c
arm64, acpi, numa: NUMA support based on SRAT and SLIT acpi, numa: Enable ACPI based NUMA on ARM64

Robert Richter (1):
acpi, numa: Move acpi_numa_arch_fixup() to ia64 only

 arch/arm64/include/asm/acpi.h |   8 ++
 arch/arm64/include/asm/numa.h |   2 +
 arch/arm64/kernel/Makefile    |   1 +
 arch/arm64/kernel/acpi_numa.c | 112 +++++++++++++++++++++
 arch/arm64/kernel/smp.c       |   2 +
 arch/arm64/mm/numa.c          |  28 ++++--
 arch/ia64/include/asm/acpi.h  |   3 +
 arch/ia64/kernel/acpi.c       |   2 +-
 arch/ia64/kernel/setup.c      |   1 +
 arch/x86/include/asm/acpi.h   |   1 -
 arch/x86/mm/numa.c            |   2 +-
 arch/x86/mm/srat.c            | 116 +---------------------
 drivers/acpi/Kconfig          |   4 +-
 drivers/acpi/numa.c           | 226 ++++++++++++++++++++++++++++++++----------
 drivers/acpi/processor_core.c |  26 ++++-
 drivers/of/of_numa.c          |   4 +-
 include/acpi/acpi_numa.h      |   4 +
 include/acpi/processor.h      |   1 +
 include/linux/acpi.h          |  18 +++-
 19 files changed, 369 insertions(+), 192 deletions(-)
 create mode 100644 arch/arm64/kernel/acpi_numa.c
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH v7 1/15 acpi, numa: Use pr_fmt() instead of printk

From: Hanjun Guo <[email protected]>

Just do some cleanups to replace printk with pr_fmt().

---
 drivers/acpi/numa.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/acpi/numa.c +7 -10
index d176e0e..bdb7622 100644
@@ -18,6 +18,9 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
+
+#define pr_fmt(fmt) "ACPI: " fmt
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -28,8 +31,6 @@
 #include <linux/nodemask.h>
 #include <linux/topology.h>
 
-#define PREFIX "ACPI: "
-
 #define ACPI_NUMA	0x80000000
 #define _COMPONENT	ACPI_NUMA
 ACPI_MODULE_NAME("numa");
@@ -187,9 +188,8 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
 #endif				/* ACPI_DEBUG_OUTPUT */
 		break;
 	default:
-		printk(KERN_WARNING PREFIX
-		       "Found unsupported SRAT entry (type = 0x%x)\n",
-		       header->type);
+		pr_warn("Found unsupported SRAT entry (type = 0x%x)\n",
+			header->type);
 		break;
 	}
 }
@@ -222,7 +222,7 @@ static int __init acpi_parse_slit(struct acpi_table_header *table)
 	struct acpi_table_slit *slit = (struct acpi_table_slit *)table;
 
 	if (!slit_valid(slit)) {
-		printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
+		pr_info("SLIT table looks invalid. Not used.\n");
 		return -EINVAL;
 	}
 	acpi_numa_slit_init(slit);
@@ -233,12 +233,9 @@ static int __init acpi_parse_slit(struct acpi_table_header *table)
 void __init __weak
 acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
 {
-	printk(KERN_WARNING PREFIX
-	       "Found unsupported x2apic [0x%08x] SRAT entry\n", pa->apic_id);
-	return;
+	pr_warn("Found unsupported x2apic [0x%08x] SRAT entry\n", pa->apic_id);
 }
 
-
 static int __init
 acpi_parse_x2apic_affinity(struct acpi_subtable_header *header,
 			   const unsigned long end)
Signature · 1 line
1.7.11.7
#2 lore raw

PATCH v7 2/15 acpi, numa: Replace ACPI_DEBUG_PRINT() with pr_debug()

In reply to David Daney

From: Hanjun Guo <[email protected]>

ACPI_DEBUG_PRINT is a bit fragile in acpi/numa.c, the first thing is that component ACPI_NUMA(0x80000000) is not described in the Documentation/acpi/debug.txt, and even not defined in the struct acpi_dlayer acpi_debug_layers which we can not dynamically enable/disable it with /sys/modules/acpi/parameters/debug_layer. another thing is that ACPI_DEBUG_OUTPUT is controlled by ACPICA which not coordinate well with ACPI drivers.

Replace ACPI_DEBUG_PRINT() with pr_debug() in this patch as pr_debug will do the same thing for debug purpose and it can make the code much cleaner, also remove the related code which not needed anymore if ACPI_DEBUG_PRINT() is gone.

---
 drivers/acpi/numa.c | 59 +++++++++++++++++++----------------------------------
 1 file changed, 21 insertions(+), 38 deletions(-)
drivers/acpi/numa.c +21 -38
index bdb7622..a089c39 100644
@@ -31,10 +31,6 @@
 #include <linux/nodemask.h>
 #include <linux/topology.h>
 
-#define ACPI_NUMA	0x80000000
-#define _COMPONENT	ACPI_NUMA
-ACPI_MODULE_NAME("numa");
-
 static nodemask_t nodes_found_map = NODE_MASK_NONE;
 
 /* maps to convert between proximity domain and logical node ID */
@@ -129,64 +125,51 @@ EXPORT_SYMBOL(acpi_map_pxm_to_online_node);
 static void __init
 acpi_table_print_srat_entry(struct acpi_subtable_header *header)
 {
-
-	ACPI_FUNCTION_NAME("acpi_table_print_srat_entry");
-
 	if (!header)
 		return;
 
 	switch (header->type) {
-
 	case ACPI_SRAT_TYPE_CPU_AFFINITY:
-#ifdef ACPI_DEBUG_OUTPUT
 		{
 			struct acpi_srat_cpu_affinity *p =
 			    (struct acpi_srat_cpu_affinity *)header;
-			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-					  "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
-					  p->apic_id, p->local_sapic_eid,
-					  p->proximity_domain_lo,
-					  (p->flags & ACPI_SRAT_CPU_ENABLED)?
-					  "enabled" : "disabled"));
+			pr_debug("SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
+				 p->apic_id, p->local_sapic_eid,
+				 p->proximity_domain_lo,
+				 (p->flags & ACPI_SRAT_CPU_ENABLED) ?
+				 "enabled" : "disabled");
 		}
-#endif				/* ACPI_DEBUG_OUTPUT */
 		break;
 
 	case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
-#ifdef ACPI_DEBUG_OUTPUT
 		{
 			struct acpi_srat_mem_affinity *p =
 			    (struct acpi_srat_mem_affinity *)header;
-			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-					  "SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n",
-					  (unsigned long)p->base_address,
-					  (unsigned long)p->length,
-					  p->proximity_domain,
-					  (p->flags & ACPI_SRAT_MEM_ENABLED)?
-					  "enabled" : "disabled",
-					  (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)?
-					  " hot-pluggable" : "",
-					  (p->flags & ACPI_SRAT_MEM_NON_VOLATILE)?
-					  " non-volatile" : ""));
+			pr_debug("SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n",
+				 (unsigned long)p->base_address,
+				 (unsigned long)p->length,
+				 p->proximity_domain,
+				 (p->flags & ACPI_SRAT_MEM_ENABLED) ?
+				 "enabled" : "disabled",
+				 (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) ?
+				 " hot-pluggable" : "",
+				 (p->flags & ACPI_SRAT_MEM_NON_VOLATILE) ?
+				 " non-volatile" : "");
 		}
-#endif				/* ACPI_DEBUG_OUTPUT */
 		break;
 
 	case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
-#ifdef ACPI_DEBUG_OUTPUT
 		{
 			struct acpi_srat_x2apic_cpu_affinity *p =
 			    (struct acpi_srat_x2apic_cpu_affinity *)header;
-			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-					  "SRAT Processor (x2apicid[0x%08x]) in"
-					  " proximity domain %d %s\n",
-					  p->apic_id,
-					  p->proximity_domain,
-					  (p->flags & ACPI_SRAT_CPU_ENABLED) ?
-					  "enabled" : "disabled"));
+			pr_debug("SRAT Processor (x2apicid[0x%08x]) in proximity domain %d %s\n",
+				 p->apic_id,
+				 p->proximity_domain,
+				 (p->flags & ACPI_SRAT_CPU_ENABLED) ?
+				 "enabled" : "disabled");
 		}
-#endif				/* ACPI_DEBUG_OUTPUT */
 		break;
+
 	default:
 		pr_warn("Found unsupported SRAT entry (type = 0x%x)\n",
 			header->type);
Signature · 1 line
1.7.11.7
#3 lore raw

PATCH v7 3/15 acpi, numa: remove duplicate NULL check

In reply to David Daney

From: Hanjun Guo <[email protected]>

The argument "header" for acpi_table_print_srat_entry() is always checked before the function is called, it's duplicate to check it again, remove it.

---
 drivers/acpi/numa.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/acpi/numa.c +0 -3
index a089c39..6f1cad8 100644
@@ -125,9 +125,6 @@ EXPORT_SYMBOL(acpi_map_pxm_to_online_node);
 static void __init
 acpi_table_print_srat_entry(struct acpi_subtable_header *header)
 {
-	if (!header)
-		return;
-
 	switch (header->type) {
 	case ACPI_SRAT_TYPE_CPU_AFFINITY:
 		{
Signature · 1 line
1.7.11.7
#4 lore raw

PATCH v7 4/15 acpi, numa: Move acpi_numa_arch_fixup() to ia64 only

In reply to David Daney

From: Robert Richter <[email protected]>

Since acpi_numa_arch_fixup() is only used in arch ia64, move it there to make a generic interface easier. This avoids empty function stubs or some complex kconfig options for x86 and arm64.

---
 arch/ia64/include/asm/acpi.h | 3 +++
 arch/ia64/kernel/acpi.c      | 2 +-
 arch/ia64/kernel/setup.c     | 1 +
 arch/x86/mm/srat.c           | 2 --
 drivers/acpi/numa.c          | 2 --
 include/linux/acpi.h         | 1 -
 6 files changed, 5 insertions(+), 6 deletions(-)
arch/ia64/include/asm/acpi.h +3 -0
index aa0fdf1..a3d0211 100644
@@ -140,6 +140,9 @@ static inline void per_cpu_scan_finalize(int min_cpus, int reserve_cpus)
 		}
 	}
 }
+
+extern void acpi_numa_fixup(void);
+
 #endif /* CONFIG_ACPI_NUMA */
 
 #endif /*__KERNEL__*/
arch/ia64/kernel/acpi.c +1 -1
index b1698bc..92b7bc9 100644
@@ -524,7 +524,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
 	return 0;
 }
 
-void __init acpi_numa_arch_fixup(void)
+void __init acpi_numa_fixup(void)
 {
 	int i, j, node_from, node_to;
 
arch/ia64/kernel/setup.c +1 -0
index 2029a38..afddb3e 100644
@@ -552,6 +552,7 @@ setup_arch (char **cmdline_p)
 	early_acpi_boot_init();
 # ifdef CONFIG_ACPI_NUMA
 	acpi_numa_init();
+	acpi_numa_fixup();
 #  ifdef CONFIG_ACPI_HOTPLUG_CPU
 	prefill_possible_map();
 #  endif
arch/x86/mm/srat.c +0 -2
index b5f8218..90b6ed9 100644
@@ -212,8 +212,6 @@ out_err:
 	return -1;
 }
 
-void __init acpi_numa_arch_fixup(void) {}
-
 int __init x86_acpi_numa_init(void)
 {
 	int ret;
drivers/acpi/numa.c +0 -2
index 6f1cad8..fb2c0d6 100644
@@ -324,8 +324,6 @@ int __init acpi_numa_init(void)
 	/* SLIT: System Locality Information Table */
 	acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit);
 
-	acpi_numa_arch_fixup();
-
 	if (cnt < 0)
 		return cnt;
 	else if (!parsed_numa_memblks)
include/linux/acpi.h +0 -1
index 288fac5..8010b26 100644
@@ -237,7 +237,6 @@ void acpi_numa_slit_init (struct acpi_table_slit *slit);
 void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
 void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
 int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
-void acpi_numa_arch_fixup(void);
 
 #ifndef PHYS_CPUID_INVALID
 typedef u32 phys_cpuid_t;
Signature · 1 line
1.7.11.7
#5 lore raw

PATCH v7 5/15 acpi, numa: move acpi_numa_slit_init() to drivers/acpi/numa.c

In reply to David Daney

From: Hanjun Guo <[email protected]>

Identical implementations of acpi_numa_slit_init() are used by both x86 and follow-on arm64 support. Move it to drivers/acpi/numa.c, and guard with CONFIG_X86 || CONFIG_ARM64 because ia64 has its own architecture specific implementation.

No code change.

---
 arch/x86/mm/srat.c  | 27 ---------------------------
 drivers/acpi/numa.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 27 deletions(-)
arch/x86/mm/srat.c +0 -27
index 90b6ed9..f242a11 100644
@@ -42,33 +42,6 @@ static __init inline int srat_disabled(void)
 	return acpi_numa < 0;
 }
 
-/*
- * Callback for SLIT parsing.  pxm_to_node() returns NUMA_NO_NODE for
- * I/O localities since SRAT does not list them.  I/O localities are
- * not supported at this point.
- */
-void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
-{
-	int i, j;
-
-	for (i = 0; i < slit->locality_count; i++) {
-		const int from_node = pxm_to_node(i);
-
-		if (from_node == NUMA_NO_NODE)
-			continue;
-
-		for (j = 0; j < slit->locality_count; j++) {
-			const int to_node = pxm_to_node(j);
-
-			if (to_node == NUMA_NO_NODE)
-				continue;
-
-			numa_set_distance(from_node, to_node,
-				slit->entry[slit->locality_count * i + j]);
-		}
-	}
-}
-
 /* Callback for Proximity Domain -> x2APIC mapping */
 void __init
 acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
drivers/acpi/numa.c +29 -0
index fb2c0d6..7e0649d 100644
@@ -197,6 +197,35 @@ static int __init slit_valid(struct acpi_table_slit *slit)
 	return 1;
 }
 
+#if defined(CONFIG_X86) || defined(CONFIG_ARM64)
+/*
+ * Callback for SLIT parsing.  pxm_to_node() returns NUMA_NO_NODE for
+ * I/O localities since SRAT does not list them.  I/O localities are
+ * not supported at this point.
+ */
+void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
+{
+	int i, j;
+
+	for (i = 0; i < slit->locality_count; i++) {
+		const int from_node = pxm_to_node(i);
+
+		if (from_node == NUMA_NO_NODE)
+			continue;
+
+		for (j = 0; j < slit->locality_count; j++) {
+			const int to_node = pxm_to_node(j);
+
+			if (to_node == NUMA_NO_NODE)
+				continue;
+
+			numa_set_distance(from_node, to_node,
+				slit->entry[slit->locality_count * i + j]);
+		}
+	}
+}
+#endif /* defined(CONFIG_X86) || defined (CONFIG_ARM64) */
+
 static int __init acpi_parse_slit(struct acpi_table_header *table)
 {
 	struct acpi_table_slit *slit = (struct acpi_table_slit *)table;
Signature · 1 line
1.7.11.7
#6 lore raw

PATCH v7 6/15 arm64, numa: rework numa_add_memblk()

In reply to David Daney

From: Hanjun Guo <[email protected]>

Rework numa_add_memblk() to update the parameter "u64 size" to "u64 end", this will make it consistent with x86 and simplifies the arm64 ACPI NUMA code to be added later.

---
 arch/arm64/mm/numa.c | 12 ++++++------
 drivers/of/of_numa.c |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)
arch/arm64/mm/numa.c +6 -6
index 98dc104..6cb03f9 100644
@@ -131,25 +131,25 @@ void __init early_map_cpu_to_node(unsigned int cpu, int nid)
  * numa_add_memblk - Set node id to memblk
  * @nid: NUMA node ID of the new memblk
  * @start: Start address of the new memblk
- * @size:  Size of the new memblk
+ * @end:  End address of the new memblk
  *
  * RETURNS:
  * 0 on success, -errno on failure.
  */
-int __init numa_add_memblk(int nid, u64 start, u64 size)
+int __init numa_add_memblk(int nid, u64 start, u64 end)
 {
 	int ret;
 
-	ret = memblock_set_node(start, size, &memblock.memory, nid);
+	ret = memblock_set_node(start, (end - start), &memblock.memory, nid);
 	if (ret < 0) {
 		pr_err("NUMA: memblock [0x%llx - 0x%llx] failed to add on node %d\n",
-			start, (start + size - 1), nid);
+			start, (end - 1), nid);
 		return ret;
 	}
 
 	node_set(nid, numa_nodes_parsed);
 	pr_info("NUMA: Adding memblock [0x%llx - 0x%llx] on node %d\n",
-			start, (start + size - 1), nid);
+			start, (end - 1), nid);
 	return ret;
 }
 
@@ -367,7 +367,7 @@ static int __init dummy_numa_init(void)
 	       0LLU, PFN_PHYS(max_pfn) - 1);
 
 	for_each_memblock(memory, mblk) {
-		ret = numa_add_memblk(0, mblk->base, mblk->size);
+		ret = numa_add_memblk(0, mblk->base, mblk->base + mblk->size);
 		if (!ret)
 			continue;
 
drivers/of/of_numa.c +2 -2
index 0f2784b..ed5a097 100644
@@ -91,8 +91,8 @@ static int __init of_numa_parse_memory_nodes(void)
 		pr_debug("NUMA:  base = %llx len = %llx, node = %u\n",
 			 rsrc.start, rsrc.end - rsrc.start + 1, nid);
 
-		r = numa_add_memblk(nid, rsrc.start,
-				    rsrc.end - rsrc.start + 1);
+
+		r = numa_add_memblk(nid, rsrc.start, rsrc.end + 1);
 		if (r)
 			break;
 	}
Signature · 1 line
1.7.11.7
#7 lore raw

PATCH v7 7/15 arm64, numa: Cleanup NUMA disabled messages.

In reply to David Daney

From: David Daney <[email protected]>

As noted by Dennis Chen, we don't want to print "No NUMA configuration found" if NUMA was forced off from the command line.

Change the type of numa_off to bool, and clean up printing code. Print "NUMA disabled" if forced off on command line and "No NUMA configuration found" if there was no firmware NUMA information.

---
 arch/arm64/mm/numa.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm64/mm/numa.c +7 -4
index 6cb03f9..1def1de 100644
@@ -29,7 +29,7 @@ static int cpu_to_node_map[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE };
 
 static int numa_distance_cnt;
 static u8 *numa_distance;
-static int numa_off;
+static bool numa_off;
 
 static __init int numa_parse_early_param(char *opt)
 {
@@ -37,7 +37,7 @@ static __init int numa_parse_early_param(char *opt)
 		return -EINVAL;
 	if (!strncmp(opt, "off", 3)) {
 		pr_info("%s\n", "NUMA turned off");
-		numa_off = 1;
+		numa_off = true;
 	}
 	return 0;
 }
@@ -362,7 +362,10 @@ static int __init dummy_numa_init(void)
 	int ret;
 	struct memblock_region *mblk;
 
-	pr_info("%s\n", "No NUMA configuration found");
+	if (numa_off)
+		pr_info("NUMA disabled\n"); /* Forced off on command line. */
+	else
+		pr_info("No NUMA configuration found\n");
 	pr_info("NUMA: Faking a node at [mem %#018Lx-%#018Lx]\n",
 	       0LLU, PFN_PHYS(max_pfn) - 1);
 
@@ -375,7 +378,7 @@ static int __init dummy_numa_init(void)
 		return ret;
 	}
 
-	numa_off = 1;
+	numa_off = true;
 	return 0;
 }
 
Signature · 1 line
1.7.11.7
Reviewed-by on v7 7/15
#8 lore raw

Re: [PATCH v7 07/15] arm64, numa: Cleanup NUMA disabled messages.

Quoted 59 lines · David Daney

From: David Daney <[email protected]>

As noted by Dennis Chen, we don't want to print "No NUMA configuration found" if NUMA was forced off from the command line.

Change the type of numa_off to bool, and clean up printing code. Print "NUMA disabled" if forced off on command line and "No NUMA configuration found" if there was no firmware NUMA information.

---
 arch/arm64/mm/numa.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm64/mm/numa.c +7 -5
index 6cb03f9..1def1de 100644
@@ -29,7 +29,7 @@ static int cpu_to_node_map[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE };
 
 static int numa_distance_cnt;
 static u8 *numa_distance;
-static int numa_off;
+static bool numa_off;
 
 static __init int numa_parse_early_param(char *opt)
 {
@@ -37,7 +37,7 @@ static __init int numa_parse_early_param(char *opt)
                return -EINVAL;
        if (!strncmp(opt, "off", 3)) {
                pr_info("%s\n", "NUMA turned off");
-               numa_off = 1;
+               numa_off = true;
        }
        return 0;
 }
@@ -362,7 +362,10 @@ static int __init dummy_numa_init(void)
        int ret;
        struct memblock_region *mblk;
 
-       pr_info("%s\n", "No NUMA configuration found");
+       if (numa_off)
+               pr_info("NUMA disabled\n"); /* Forced off on command line. */
+       else
+               pr_info("No NUMA configuration found\n");
        pr_info("NUMA: Faking a node at [mem %#018Lx-%#018Lx]\n",
               0LLU, PFN_PHYS(max_pfn) - 1);
 
@@ -375,7 +378,7 @@ static int __init dummy_numa_init(void)
                return ret;
        }
 
-       numa_off = 1;
+       numa_off = true;
        return 0;
 }
 
--
Quoted 2 lines

1.7.11.7

Signature · 2 lines
Regards,
Dennis
Reviewed-by on v7 7/15
#9 lore raw

Re: [PATCH v7 07/15] arm64, numa: Cleanup NUMA disabled messages.

In reply to David Daney
Quoted 50 lines · David Daney

From: David Daney <[email protected]>

As noted by Dennis Chen, we don't want to print "No NUMA configuration found" if NUMA was forced off from the command line.

Change the type of numa_off to bool, and clean up printing code. Print "NUMA disabled" if forced off on command line and "No NUMA configuration found" if there was no firmware NUMA information.

---
  arch/arm64/mm/numa.c | 11 +++++++----
  1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm64/mm/numa.c +6 -3
index 6cb03f9..1def1de 100644
@@ -29,7 +29,7 @@ static int cpu_to_node_map[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE };
 
  static int numa_distance_cnt;
  static u8 *numa_distance;
-static int numa_off;
+static bool numa_off;
 
  static __init int numa_parse_early_param(char *opt)
  {
@@ -37,7 +37,7 @@ static __init int numa_parse_early_param(char *opt)
  		return -EINVAL;
  	if (!strncmp(opt, "off", 3)) {
  		pr_info("%s\n", "NUMA turned off");
-		numa_off = 1;
+		numa_off = true;
  	}
  	return 0;
  }
@@ -362,7 +362,10 @@ static int __init dummy_numa_init(void)
  	int ret;
  	struct memblock_region *mblk;
 
-	pr_info("%s\n", "No NUMA configuration found");
+	if (numa_off)
+		pr_info("NUMA disabled\n"); /* Forced off on command line. */
+	else
+		pr_info("No NUMA configuration found\n");
  	pr_info("NUMA: Faking a node at [mem %#018Lx-%#018Lx]\n",
  	       0LLU, PFN_PHYS(max_pfn) - 1);
 

arch/arm64/mm/numa.c static int __init dummy_numa_init(void) · line 383

Quoted 7 lines
arch/arm64/mm/numa.c +1 -1
@@ -375,7 +378,7 @@ static int __init dummy_numa_init(void)
  		return ret;
  	}
 
-	numa_off = 1;
+	numa_off = true;
  	return 0;
  }
Quoted 2 lines
#10 lore raw

PATCH v7 8/15 x86, acpi, numa: cleanup acpi_numa_processor_affinity_init()

In reply to David Daney

From: Hanjun Guo <[email protected]>

Cleanup acpi_numa_processor_affinity_init() in preparation for its move to drivers/acpi/numa.c. It will be reused by arm64, this has no functional change.

---
 arch/x86/mm/srat.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)
arch/x86/mm/srat.c +5 -16
index f242a11..9e2a833 100644
@@ -26,11 +26,6 @@
 
 int acpi_numa __initdata;
 
-static __init int setup_node(int pxm)
-{
-	return acpi_map_pxm_to_node(pxm);
-}
-
 static __init void bad_srat(void)
 {
 	printk(KERN_ERR "SRAT: SRAT not used.\n");
@@ -64,7 +59,7 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
 			 pxm, apic_id);
 		return;
 	}
-	node = setup_node(pxm);
+	node = acpi_map_pxm_to_node(pxm);
 	if (node < 0) {
 		printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
 		bad_srat();
@@ -100,7 +95,7 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
 	pxm = pa->proximity_domain_lo;
 	if (acpi_srat_revision >= 2)
 		pxm |= *((unsigned int*)pa->proximity_domain_hi) << 8;
-	node = setup_node(pxm);
+	node = acpi_map_pxm_to_node(pxm);
 	if (node < 0) {
 		printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
 		bad_srat();
@@ -124,12 +119,6 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
 	       pxm, apic_id, node);
 }
 
-#ifdef CONFIG_MEMORY_HOTPLUG
-static inline int save_add_info(void) {return 1;}
-#else
-static inline int save_add_info(void) {return 0;}
-#endif
-
 /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
 int __init
 acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
@@ -145,7 +134,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
 	if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
 		goto out_err;
 	hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE;
-	if (hotpluggable && !save_add_info())
+	if (hotpluggable && !IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
 		goto out_err;
 
 	start = ma->base_address;
@@ -154,7 +143,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
 	if (acpi_srat_revision <= 1)
 		pxm &= 0xff;
 
-	node = setup_node(pxm);
+	node = acpi_map_pxm_to_node(pxm);
 	if (node < 0) {
 		printk(KERN_ERR "SRAT: Too many proximity domains.\n");
 		goto out_err_bad_srat;
@@ -182,7 +171,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
 out_err_bad_srat:
 	bad_srat();
 out_err:
-	return -1;
+	return -EINVAL;
 }
 
 int __init x86_acpi_numa_init(void)
Signature · 1 line
1.7.11.7
#11 lore raw

PATCH v7 9/15 acpi, numa: move bad_srat() and srat_disabled() to drivers/acpi/numa.c

In reply to David Daney

From: David Daney <[email protected]>

bad_srat() and srat_disabled() are shared by x86 and follow-on arm64 patches. Move them to drivers/acpi/numa.c in preparation for arm64 support.

[[email protected] moved definitions to drivers/acpi/numa.c]
---
 arch/x86/include/asm/acpi.h |  1 -
 arch/x86/mm/numa.c          |  2 +-
 arch/x86/mm/srat.c          | 13 -------------
 drivers/acpi/numa.c         | 12 ++++++++++++
 include/acpi/acpi_numa.h    |  4 ++++
 5 files changed, 17 insertions(+), 15 deletions(-)
arch/x86/include/asm/acpi.h +0 -1
index 94c18eb..65f1e95 100644
@@ -145,7 +145,6 @@ static inline void disable_acpi(void) { }
 #define ARCH_HAS_POWER_INIT	1
 
 #ifdef CONFIG_ACPI_NUMA
-extern int acpi_numa;
 extern int x86_acpi_numa_init(void);
 #endif /* CONFIG_ACPI_NUMA */
 
arch/x86/mm/numa.c +1 -1
index 9c086c5..968ac02 100644
@@ -1,4 +1,5 @@
 /* Common code for 32 and 64-bit NUMA */
+#include <linux/acpi.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/string.h>
@@ -15,7 +16,6 @@
 #include <asm/e820.h>
 #include <asm/proto.h>
 #include <asm/dma.h>
-#include <asm/acpi.h>
 #include <asm/amd_nb.h>
 
 #include "numa_internal.h"
arch/x86/mm/srat.c +0 -13
index 9e2a833..4217071f 100644
@@ -24,19 +24,6 @@
 #include <asm/apic.h>
 #include <asm/uv/uv.h>
 
-int acpi_numa __initdata;
-
-static __init void bad_srat(void)
-{
-	printk(KERN_ERR "SRAT: SRAT not used.\n");
-	acpi_numa = -1;
-}
-
-static __init inline int srat_disabled(void)
-{
-	return acpi_numa < 0;
-}
-
 /* Callback for Proximity Domain -> x2APIC mapping */
 void __init
 acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
drivers/acpi/numa.c +12 -0
index 7e0649d..af0c8d5 100644
@@ -40,6 +40,7 @@ static int node_to_pxm_map[MAX_NUMNODES]
 			= { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
 
 unsigned char acpi_srat_revision __initdata;
+int acpi_numa __initdata;
 
 int pxm_to_node(int pxm)
 {
@@ -197,6 +198,17 @@ static int __init slit_valid(struct acpi_table_slit *slit)
 	return 1;
 }
 
+void __init bad_srat(void)
+{
+	pr_err("SRAT: SRAT not used.\n");
+	acpi_numa = -1;
+}
+
+int __init srat_disabled(void)
+{
+	return acpi_numa < 0;
+}
+
 #if defined(CONFIG_X86) || defined(CONFIG_ARM64)
 /*
  * Callback for SLIT parsing.  pxm_to_node() returns NUMA_NO_NODE for
include/acpi/acpi_numa.h +4 -0
index 94a37cd..d4b7294 100644
@@ -15,6 +15,10 @@ extern int pxm_to_node(int);
 extern int node_to_pxm(int);
 extern int acpi_map_pxm_to_node(int);
 extern unsigned char acpi_srat_revision;
+extern int acpi_numa __initdata;
+
+extern void bad_srat(void);
+extern int srat_disabled(void);
 
 #endif				/* CONFIG_ACPI_NUMA */
 #endif				/* __ACP_NUMA_H */
Signature · 1 line
1.7.11.7
#12 lore raw

PATCH v7 10/15 acpi, numa: remove unneeded acpi_numa=1

In reply to David Daney

From: Hanjun Guo <[email protected]>

acpi_numa is default to 0, it's set to -1 when disable acpi numa or when a bad SRAT is parsed, and it's only consumed in srat_disabled() (compare it with 0) to continue parse the SRAT or not, so we don't need to set acpi_numa to 1 when we get a valid SRAT entry.

---
 arch/x86/mm/srat.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/mm/srat.c +0 -2
index 4217071f..30460f5 100644
@@ -59,7 +59,6 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
 	}
 	set_apicid_to_node(apic_id, node);
 	node_set(node, numa_nodes_parsed);
-	acpi_numa = 1;
 	printk(KERN_INFO "SRAT: PXM %u -> APIC 0x%04x -> Node %u\n",
 	       pxm, apic_id, node);
 }
@@ -101,7 +100,6 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
 
 	set_apicid_to_node(apic_id, node);
 	node_set(node, numa_nodes_parsed);
-	acpi_numa = 1;
 	printk(KERN_INFO "SRAT: PXM %u -> APIC 0x%02x -> Node %u\n",
 	       pxm, apic_id, node);
 }
Signature · 1 line
1.7.11.7
#13 lore raw

PATCH v7 11/15 acpi, numa: Move acpi_numa_memory_affinity_init() to drivers/acpi/numa.c

In reply to David Daney

From: Hanjun Guo <[email protected]>

acpi_numa_memory_affinity_init() will be reused by arm64. Move it to drivers/acpi/numa.c to facilitate reuse.

No code change.

---
 arch/x86/mm/srat.c  | 57 --------------------------------------------------
 drivers/acpi/numa.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 57 deletions(-)
arch/x86/mm/srat.c +0 -57
index 30460f5..b1ecff4 100644
@@ -15,8 +15,6 @@
 #include <linux/bitmap.h>
 #include <linux/module.h>
 #include <linux/topology.h>
-#include <linux/bootmem.h>
-#include <linux/memblock.h>
 #include <linux/mm.h>
 #include <asm/proto.h>
 #include <asm/numa.h>
@@ -104,61 +102,6 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
 	       pxm, apic_id, node);
 }
 
-/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
-int __init
-acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
-{
-	u64 start, end;
-	u32 hotpluggable;
-	int node, pxm;
-
-	if (srat_disabled())
-		goto out_err;
-	if (ma->header.length != sizeof(struct acpi_srat_mem_affinity))
-		goto out_err_bad_srat;
-	if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
-		goto out_err;
-	hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE;
-	if (hotpluggable && !IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
-		goto out_err;
-
-	start = ma->base_address;
-	end = start + ma->length;
-	pxm = ma->proximity_domain;
-	if (acpi_srat_revision <= 1)
-		pxm &= 0xff;
-
-	node = acpi_map_pxm_to_node(pxm);
-	if (node < 0) {
-		printk(KERN_ERR "SRAT: Too many proximity domains.\n");
-		goto out_err_bad_srat;
-	}
-
-	if (numa_add_memblk(node, start, end) < 0)
-		goto out_err_bad_srat;
-
-	node_set(node, numa_nodes_parsed);
-
-	pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s%s\n",
-		node, pxm,
-		(unsigned long long) start, (unsigned long long) end - 1,
-		hotpluggable ? " hotplug" : "",
-		ma->flags & ACPI_SRAT_MEM_NON_VOLATILE ? " non-volatile" : "");
-
-	/* Mark hotplug range in memblock. */
-	if (hotpluggable && memblock_mark_hotplug(start, ma->length))
-		pr_warn("SRAT: Failed to mark hotplug range [mem %#010Lx-%#010Lx] in memblock\n",
-			(unsigned long long)start, (unsigned long long)end - 1);
-
-	max_possible_pfn = max(max_possible_pfn, PFN_UP(end - 1));
-
-	return 0;
-out_err_bad_srat:
-	bad_srat();
-out_err:
-	return -EINVAL;
-}
-
 int __init x86_acpi_numa_init(void)
 {
 	int ret;
drivers/acpi/numa.c +60 -0

72 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#14 lore raw

PATCH v7 12/15 acpi, numa, srat: Improve SRAT error detection and add messages.

In reply to David Daney

From: David Daney <[email protected]>

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.

---
 drivers/acpi/numa.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/acpi/numa.c +11 -4
index 811f90a..fad6d28 100644
@@ -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);
 
Signature · 1 line
1.7.11.7
#15 lore raw

PATCH v7 13/15 ACPI / processor: Add acpi_map_madt_entry().

In reply to David Daney

From: David Daney <[email protected]>

Follow-on arm64 ACPI/NUMA patches need to map MADT entries very early (before kmalloc is usable).

Add acpi_map_madt_entry() which, indirectly, uses early_memremap()/early_memunmap() to access the table and parse out the mpidr. The existing implementation of map_madt_entry() is modified to take a pointer to the MADT as a parameter and the callers adjusted.

---
 drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++----
 include/acpi/processor.h      |  1 +
 2 files changed, 23 insertions(+), 4 deletions(-)
drivers/acpi/processor_core.c +22 -4
index 33a38d6..9125d7d 100644
@@ -108,13 +108,12 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry,
 	return -EINVAL;
 }
 
-static phys_cpuid_t map_madt_entry(int type, u32 acpi_id)
+static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt,
+				   int type, u32 acpi_id)
 {
 	unsigned long madt_end, entry;
 	phys_cpuid_t phys_id = PHYS_CPUID_INVALID;	/* CPU hardware ID */
-	struct acpi_table_madt *madt;
 
-	madt = get_madt_table();
 	if (!madt)
 		return phys_id;
 
@@ -145,6 +144,25 @@ static phys_cpuid_t map_madt_entry(int type, u32 acpi_id)
 	return phys_id;
 }
 
+phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id)
+{
+	struct acpi_table_madt *madt = NULL;
+	acpi_size tbl_size;
+	phys_cpuid_t rv;
+
+	acpi_get_table_with_size(ACPI_SIG_MADT, 0,
+				 (struct acpi_table_header **)&madt,
+				 &tbl_size);
+	if (!madt)
+		return PHYS_CPUID_INVALID;
+
+	rv = map_madt_entry(madt, 1, acpi_id);
+
+	early_acpi_os_unmap_memory(madt, tbl_size);
+
+	return rv;
+}
+
 static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
 {
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -185,7 +203,7 @@ phys_cpuid_t acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id)
 
 	phys_id = map_mat_entry(handle, type, acpi_id);
 	if (invalid_phys_cpuid(phys_id))
-		phys_id = map_madt_entry(type, acpi_id);
+		phys_id = map_madt_entry(get_madt_table(), type, acpi_id);
 
 	return phys_id;
 }
include/acpi/processor.h +1 -0
index 6f1805d..f473e66 100644
@@ -309,6 +309,7 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
 
 /* in processor_core.c */
 phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
+phys_cpuid_t acpi_map_madt_entry(u32 acpi_id);
 int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id);
 int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
 
Signature · 1 line
1.7.11.7
maintainer Acked-by on v7 13/15
#16 lore raw

Re: [PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry().

Quoted 5 lines · David Daney

From: David Daney <[email protected]>

Follow-on arm64 ACPI/NUMA patches need to map MADT entries very early (before kmalloc is usable).

Quoted 7 lines

Add acpi_map_madt_entry() which, indirectly, uses early_memremap()/early_memunmap() to access the table and parse out the mpidr. The existing implementation of map_madt_entry() is modified to take a pointer to the MADT as a parameter and the callers adjusted.

#17 lore raw

Re: [PATCH v7 13/15] ACPI / processor: Add acpi_map_madt_entry().

In reply to David Daney
Quoted 44 lines · David Daney

From: David Daney <[email protected]>

Follow-on arm64 ACPI/NUMA patches need to map MADT entries very early (before kmalloc is usable).

Add acpi_map_madt_entry() which, indirectly, uses early_memremap()/early_memunmap() to access the table and parse out the mpidr. The existing implementation of map_madt_entry() is modified to take a pointer to the MADT as a parameter and the callers adjusted.

---
  drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++----
  include/acpi/processor.h      |  1 +
  2 files changed, 23 insertions(+), 4 deletions(-)
drivers/acpi/processor_core.c +5 -3
index 33a38d6..9125d7d 100644
@@ -108,13 +108,12 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry,
  	return -EINVAL;
  }
 
-static phys_cpuid_t map_madt_entry(int type, u32 acpi_id)
+static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt,
+				   int type, u32 acpi_id)
  {
  	unsigned long madt_end, entry;
  	phys_cpuid_t phys_id = PHYS_CPUID_INVALID;	/* CPU hardware ID */
-	struct acpi_table_madt *madt;
 
-	madt = get_madt_table();
  	if (!madt)
  		return phys_id;
 
@@ -145,6 +144,25 @@ static phys_cpuid_t map_madt_entry(int type, u32 acpi_id)
  	return phys_id;
  }
 
+phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id)
+{
+	struct acpi_table_madt *madt = NULL;

drivers/acpi/processor_core.c static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) · line 159

Quoted 10 lines
drivers/acpi/processor_core.c +10 -0
+	acpi_size tbl_size;
+	phys_cpuid_t rv;
+
+	acpi_get_table_with_size(ACPI_SIG_MADT, 0,
+				 (struct acpi_table_header **)&madt,
+				 &tbl_size);
+	if (!madt)
+		return PHYS_CPUID_INVALID;
+
+	rv = map_madt_entry(madt, 1, acpi_id);

Just nit-pick, pass 1 here means we need to define an acpi processor device object in DSDT (see function map_gicc_mpidr(), device_declaration), it would be fine for x2apic and gic mode, but not for lapic mode, since the function name is acpi_map_madt_entry which is general for all architecture, it will confuse people I think.

How about rename acpi_map_madt_entry() to acpi_map_madt_gicc_entry()? It's only used for AMR64 to get mpidrs from GICC entries using acpi_id, other than that, it's good to me.

Thanks
Hanjun

#18 lore raw

PATCH v7 14/15 arm64, acpi, numa: NUMA support based on SRAT and SLIT

In reply to David Daney

From: Hanjun Guo <[email protected]>

Introduce a new file to hold ACPI based NUMA information parsing from SRAT and SLIT.

SRAT includes the CPU ACPI ID to Proximity Domain mappings and memory ranges to Proximity Domain mapping. SLIT has the information of inter node distances(relative number for access latency).

[[email protected] reorderd and combinded with other patches in Hanjun Guo's original set, removed get_mpidr_in_madt() and use acpi_map_madt_entry() instead.]

---
 arch/arm64/include/asm/acpi.h |   8 +++
 arch/arm64/include/asm/numa.h |   2 +
 arch/arm64/kernel/Makefile    |   1 +
 arch/arm64/kernel/acpi_numa.c | 112 ++++++++++++++++++++++++++++++++++++++++++
 arch/arm64/kernel/smp.c       |   2 +
 arch/arm64/mm/numa.c          |   5 +-
 6 files changed, 129 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/kernel/acpi_numa.c
arch/arm64/include/asm/acpi.h +8 -0
index aee323b..4b13ecd 100644
@@ -113,4 +113,12 @@ static inline const char *acpi_get_enable_method(int cpu)
 pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr);
 #endif
 
+#ifdef CONFIG_ACPI_NUMA
+int arm64_acpi_numa_init(void);
+int acpi_numa_get_nid(unsigned int cpu, u64 hwid);
+#else
+static inline int arm64_acpi_numa_init(void) { return -ENOSYS; }
+static inline int acpi_numa_get_nid(unsigned int cpu, u64 hwid) { return NUMA_NO_NODE; }
+#endif /* CONFIG_ACPI_NUMA */
+
 #endif /*_ASM_ACPI_H*/
arch/arm64/include/asm/numa.h +2 -0
index e9b4f29..600887e 100644
@@ -5,6 +5,8 @@
 
 #ifdef CONFIG_NUMA
 
+#define NR_NODE_MEMBLKS		(MAX_NUMNODES * 2)
+
 /* currently, arm64 implements flat NUMA topology */
 #define parent_node(node)	(node)
 
arch/arm64/kernel/Makefile +1 -0
index 2173149..a5125c6 100644
@@ -42,6 +42,7 @@ arm64-obj-$(CONFIG_EFI)			+= efi.o efi-entry.stub.o
 arm64-obj-$(CONFIG_PCI)			+= pci.o
 arm64-obj-$(CONFIG_ARMV8_DEPRECATED)	+= armv8_deprecated.o
 arm64-obj-$(CONFIG_ACPI)		+= acpi.o
+arm64-obj-$(CONFIG_ACPI_NUMA)		+= acpi_numa.o
 arm64-obj-$(CONFIG_ARM64_ACPI_PARKING_PROTOCOL)	+= acpi_parking_protocol.o
 arm64-obj-$(CONFIG_PARAVIRT)		+= paravirt.o
 arm64-obj-$(CONFIG_RANDOMIZE_BASE)	+= kaslr.o
arch/arm64/kernel/acpi_numa.c new file +112 -0

112 lines not on this page · raw message

arch/arm64/kernel/smp.c +2 -0
index 678e084..d099306 100644
@@ -560,6 +560,8 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
 	 */
 	acpi_set_mailbox_entry(cpu_count, processor);
 
+	early_map_cpu_to_node(cpu_count, acpi_numa_get_nid(cpu_count, hwid));
+
 	cpu_count++;
 }
 
arch/arm64/mm/numa.c +4 -1
index 1def1de..c7fe3ec 100644
@@ -17,6 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/acpi.h>
 #include <linux/bootmem.h>
 #include <linux/memblock.h>
 #include <linux/module.h>
@@ -391,7 +392,9 @@ static int __init dummy_numa_init(void)
 void __init arm64_numa_init(void)
 {
 	if (!numa_off) {
-		if (!numa_init(of_numa_init))
+		if (!acpi_disabled && !numa_init(arm64_acpi_numa_init))
+			return;
+		if (acpi_disabled && !numa_init(of_numa_init))
 			return;
 	}
 
Signature · 1 line
1.7.11.7
maintainer Reviewed-by on v7 14/15
#19 lore raw

Re: [PATCH v7 14/15] arm64, acpi, numa: NUMA support based on SRAT and SLIT

Quoted 9 lines · David Daney

From: Hanjun Guo <[email protected]>

Introduce a new file to hold ACPI based NUMA information parsing from SRAT and SLIT.

SRAT includes the CPU ACPI ID to Proximity Domain mappings and memory ranges to Proximity Domain mapping. SLIT has the information of inter node distances(relative number for access latency).

Quoted 8 lines
[rrichter at cavium.com Reworked for numa v10 series ]

[david.daney at cavium.com reorderd and combinded with other patches in Hanjun Guo's original set, removed get_mpidr_in_madt() and use acpi_map_madt_entry() instead.]

Tested-by on v7 14/15
#20 lore raw

Re: [PATCH v7 14/15] arm64, acpi, numa: NUMA support based on SRAT and SLIT

In reply to David Daney
Quoted 13 lines · David Daney

From: Hanjun Guo <[email protected]>

Introduce a new file to hold ACPI based NUMA information parsing from SRAT and SLIT.

SRAT includes the CPU ACPI ID to Proximity Domain mappings and memory ranges to Proximity Domain mapping. SLIT has the information of inter node distances(relative number for access latency).

Quoted 5 lines

[[email protected] reorderd and combinded with other patches in Hanjun Guo's original set, removed get_mpidr_in_madt() and use acpi_map_madt_entry() instead.]

---

I've tested this patch on Juno board with home made SRAT and SLIT table, so feel free to add:

Signature · 2 lines
Regards,
Dennis
maintainer
#21 lore raw

Re: [PATCH v7 14/15] arm64, acpi, numa: NUMA support based on SRAT and SLIT

In reply to David Daney
Quoted 7 lines · David Daney
arch/arm64/include/asm/acpi.h +0 -0
index aee323b..4b13ecd 100644
@@ -113,4 +113,12 @@ static inline const char *acpi_get_enable_method(int cpu)
 pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr);
 #endif

arch/arm64/include/asm/acpi.h static inline const char *acpi_get_enable_method(int cpu) · line 124

Quoted 10 lines
arch/arm64/include/asm/acpi.h +8 -0
 
+#ifdef CONFIG_ACPI_NUMA
+int arm64_acpi_numa_init(void);
+int acpi_numa_get_nid(unsigned int cpu, u64 hwid);
+#else
+static inline int arm64_acpi_numa_init(void) { return -ENOSYS; }
+static inline int acpi_numa_get_nid(unsigned int cpu, u64 hwid) { return NUMA_NO_NODE; }
+#endif /* CONFIG_ACPI_NUMA */
+
 #endif /*_ASM_ACPI_H*/

Apparently this doesn't always build since asm/acpi.h is conditionally included from linux/acpi.h only when CONFIG_ACPI is enabled. Disabling this option on arm64 leads to:

arch/arm64/mm/numa.c: In function ?arm64_numa_init?:
arch/arm64/mm/numa.c:395:24: error: ?arm64_acpi_numa_init? undeclared (first use in this function)
if (!acpi_disabled && !numa_init(arm64_acpi_numa_init))

I'll fix it in arch/arm64 by including asm/acpi.h directly as we do in a couple of other files:

------------------8<------------------------------

Quoted 1 line

From 9a83bf400e0b4ef066b83eeaecdbca909b8491ea Mon Sep 17 00:00:00 2001

From: Catalin Marinas <[email protected]>
Date: Mon, 15 Aug 2016 16:33:10 +0100
Subject: [PATCH] arm64: Fix NUMA build error when !CONFIG_ACPI
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since asm/acpi.h is only included by linux/acpi.h when CONFIG_ACPI is enabled, disabling the latter leads to the following build error on arm64:

arch/arm64/mm/numa.c: In function ?arm64_numa_init?:
arch/arm64/mm/numa.c:395:24: error: ?arm64_acpi_numa_init? undeclared (first use in this function)
if (!acpi_disabled && !numa_init(arm64_acpi_numa_init))

This patch include the asm/acpi.h explicitly in arch/arm64/mm/numa.c for the arm64_acpi_numa_init() definition.

Fixes d8b47fca8c23 ("arm64, ACPI, NUMA: NUMA support based on SRAT and SLIT")
---
 arch/arm64/mm/numa.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/mm/numa.c +2 -0
index c7fe3ec70774..5bb15eab6f00 100644
@@ -23,6 +23,8 @@
 #include <linux/module.h>
 #include <linux/of.h>
 
+#include <asm/acpi.h>
+
 struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
 EXPORT_SYMBOL(node_data);
 nodemask_t numa_nodes_parsed __initdata;
#22 lore raw

Re: [PATCH v7 14/15] arm64, acpi, numa: NUMA support based on SRAT and SLIT

Quoted 23 lines · Catalin Marinas
Quoted 7 lines · David Daney
arch/arm64/include/asm/acpi.h +0 -0
index aee323b..4b13ecd 100644
@@ -113,4 +113,12 @@ static inline const char *acpi_get_enable_method(int cpu)
  pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr);
  #endif

arch/arm64/include/asm/acpi.h static inline const char *acpi_get_enable_method(int cpu) · line 124

Quoted 10 lines
arch/arm64/include/asm/acpi.h +8 -0
 
+#ifdef CONFIG_ACPI_NUMA
+int arm64_acpi_numa_init(void);
+int acpi_numa_get_nid(unsigned int cpu, u64 hwid);
+#else
+static inline int arm64_acpi_numa_init(void) { return -ENOSYS; }
+static inline int acpi_numa_get_nid(unsigned int cpu, u64 hwid) { return NUMA_NO_NODE; }
+#endif /* CONFIG_ACPI_NUMA */
+
  #endif /*_ASM_ACPI_H*/

Apparently this doesn't always build since asm/acpi.h is conditionally included from linux/acpi.h only when CONFIG_ACPI is enabled. Disabling this option on arm64 leads to:

Quoted 6 lines

arch/arm64/mm/numa.c: In function ‘arm64_numa_init’:
arch/arm64/mm/numa.c:395:24: error: ‘arm64_acpi_numa_init’ undeclared (first use in this function)

    if (!acpi_disabled && !numa_init(arm64_acpi_numa_init))

I'll fix it in arch/arm64 by including asm/acpi.h directly as we do in a couple of other files:

Sounds good. Thanks for fixing it.

David

Quoted 33 lines

------------------8<------------------------------
From 9a83bf400e0b4ef066b83eeaecdbca909b8491ea Mon Sep 17 00:00:00 2001
From: Catalin Marinas <[email protected]>
Date: Mon, 15 Aug 2016 16:33:10 +0100
Subject: [PATCH] arm64: Fix NUMA build error when !CONFIG_ACPI
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since asm/acpi.h is only included by linux/acpi.h when CONFIG_ACPI is enabled, disabling the latter leads to the following build error on arm64:

arch/arm64/mm/numa.c: In function ‘arm64_numa_init’:
arch/arm64/mm/numa.c:395:24: error: ‘arm64_acpi_numa_init’ undeclared (first use in this function)

    if (!acpi_disabled && !numa_init(arm64_acpi_numa_init))

This patch include the asm/acpi.h explicitly in arch/arm64/mm/numa.c for the arm64_acpi_numa_init() definition.

Fixes d8b47fca8c23 ("arm64, ACPI, NUMA: NUMA support based on SRAT and SLIT")
---
  arch/arm64/mm/numa.c | 2 ++
  1 file changed, 2 insertions(+)
arch/arm64/mm/numa.c +0 -0
index c7fe3ec70774..5bb15eab6f00 100644

arch/arm64/mm/numa.c line 30

Quoted 8 lines
arch/arm64/mm/numa.c +2 -0
@@ -23,6 +23,8 @@
  #include <linux/module.h>
  #include <linux/of.h>
 
+#include <asm/acpi.h>
+
  struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
  EXPORT_SYMBOL(node_data);
  nodemask_t numa_nodes_parsed __initdata;

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Reviewed-by
#23 lore raw

Re: [PATCH v7 14/15] arm64, acpi, numa: NUMA support based on SRAT and SLIT

In reply to Catalin Marinas
Quoted 61 lines · Catalin Marinas
Quoted 7 lines · David Daney
arch/arm64/include/asm/acpi.h +0 -0
index aee323b..4b13ecd 100644
@@ -113,4 +113,12 @@ static inline const char *acpi_get_enable_method(int cpu)
 pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr);
 #endif

arch/arm64/include/asm/acpi.h static inline const char *acpi_get_enable_method(int cpu) · line 124

Quoted 10 lines
arch/arm64/include/asm/acpi.h +8 -0
 
+#ifdef CONFIG_ACPI_NUMA
+int arm64_acpi_numa_init(void);
+int acpi_numa_get_nid(unsigned int cpu, u64 hwid);
+#else
+static inline int arm64_acpi_numa_init(void) { return -ENOSYS; }
+static inline int acpi_numa_get_nid(unsigned int cpu, u64 hwid) { return NUMA_NO_NODE; }
+#endif /* CONFIG_ACPI_NUMA */
+
 #endif /*_ASM_ACPI_H*/

Apparently this doesn't always build since asm/acpi.h is conditionally included from linux/acpi.h only when CONFIG_ACPI is enabled. Disabling this option on arm64 leads to:

arch/arm64/mm/numa.c: In function ‘arm64_numa_init’:
arch/arm64/mm/numa.c:395:24: error: ‘arm64_acpi_numa_init’ undeclared (first use in this function)
if (!acpi_disabled && !numa_init(arm64_acpi_numa_init))

I'll fix it in arch/arm64 by including asm/acpi.h directly as we do in a couple of other files:

------------------8<------------------------------
From 9a83bf400e0b4ef066b83eeaecdbca909b8491ea Mon Sep 17 00:00:00 2001
From: Catalin Marinas <[email protected]>
Date: Mon, 15 Aug 2016 16:33:10 +0100
Subject: [PATCH] arm64: Fix NUMA build error when !CONFIG_ACPI
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since asm/acpi.h is only included by linux/acpi.h when CONFIG_ACPI is enabled, disabling the latter leads to the following build error on arm64:

arch/arm64/mm/numa.c: In function ‘arm64_numa_init’:
arch/arm64/mm/numa.c:395:24: error: ‘arm64_acpi_numa_init’ undeclared (first use in this function)
if (!acpi_disabled && !numa_init(arm64_acpi_numa_init))

This patch include the asm/acpi.h explicitly in arch/arm64/mm/numa.c for the arm64_acpi_numa_init() definition.

Fixes d8b47fca8c23 ("arm64, ACPI, NUMA: NUMA support based on SRAT and SLIT")
---
 arch/arm64/mm/numa.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/mm/numa.c +0 -0
index c7fe3ec70774..5bb15eab6f00 100644

arch/arm64/mm/numa.c line 30

Quoted 8 lines
arch/arm64/mm/numa.c +2 -0
@@ -23,6 +23,8 @@
 #include <linux/module.h>
 #include <linux/of.h>
 
+#include <asm/acpi.h>
+
 struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
 EXPORT_SYMBOL(node_data);
 nodemask_t numa_nodes_parsed __initdata;

Thanks a lot!

Hanjun

#24 lore raw

PATCH v7 15/15 acpi, numa: Enable ACPI based NUMA on ARM64

In reply to David Daney

From: Hanjun Guo <[email protected]>

Add function needed for cpu to node mapping, and enable ACPI based NUMA for ARM64 in Kconfig

---
 drivers/acpi/Kconfig |  4 ++--
 drivers/acpi/numa.c  | 37 ++++++++++++++++++++++++++++++++++++-
 include/linux/acpi.h | 17 ++++++++++++++++-
 3 files changed, 54 insertions(+), 4 deletions(-)
drivers/acpi/Kconfig +2 -2
index b7e2e77..dd76b36 100644
@@ -291,8 +291,8 @@ config ACPI_THERMAL
 config ACPI_NUMA
 	bool "NUMA support"
 	depends on NUMA
-	depends on (X86 || IA64)
-	default y if IA64_GENERIC || IA64_SGI_SN2
+	depends on (X86 || IA64 || ARM64)
+	default y if IA64_GENERIC || IA64_SGI_SN2 || ARM64
 
 config ACPI_CUSTOM_DSDT_FILE
 	string "Custom DSDT Table file to include"
drivers/acpi/numa.c +36 -1
index fad6d28..9b7ce40 100644
@@ -170,6 +170,18 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
 		}
 		break;
 
+	case ACPI_SRAT_TYPE_GICC_AFFINITY:
+		{
+			struct acpi_srat_gicc_affinity *p =
+			    (struct acpi_srat_gicc_affinity *)header;
+			pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n",
+				 p->acpi_processor_uid,
+				 p->proximity_domain,
+				 (p->flags & ACPI_SRAT_GICC_ENABLED) ?
+				 "enabled" : "disabled");
+		}
+		break;
+
 	default:
 		pr_warn("Found unsupported SRAT entry (type = 0x%x)\n",
 			header->type);
@@ -360,6 +372,24 @@ acpi_parse_processor_affinity(struct acpi_subtable_header *header,
 	return 0;
 }
 
+static int __init
+acpi_parse_gicc_affinity(struct acpi_subtable_header *header,
+			 const unsigned long end)
+{
+	struct acpi_srat_gicc_affinity *processor_affinity;
+
+	processor_affinity = (struct acpi_srat_gicc_affinity *)header;
+	if (!processor_affinity)
+		return -EINVAL;
+
+	acpi_table_print_srat_entry(header);
+
+	/* let architecture-dependent part to do it */
+	acpi_numa_gicc_affinity_init(processor_affinity);
+
+	return 0;
+}
+
 static int __initdata parsed_numa_memblks;
 
 static int __init
@@ -404,6 +434,9 @@ int __init acpi_numa_init(void)
 {
 	int cnt = 0;
 
+	if (acpi_disabled)
+		return -EINVAL;
+
 	/*
 	 * Should not limit number with cpu num that is from NR_CPUS or nr_cpus=
 	 * SRAT cpu entries could have different order with that in MADT.
@@ -412,13 +445,15 @@ int __init acpi_numa_init(void)
 
 	/* SRAT: Static Resource Affinity Table */
 	if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
-		struct acpi_subtable_proc srat_proc[2];
+		struct acpi_subtable_proc srat_proc[3];
 
 		memset(srat_proc, 0, sizeof(srat_proc));
 		srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY;
 		srat_proc[0].handler = acpi_parse_processor_affinity;
 		srat_proc[1].id = ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY;
 		srat_proc[1].handler = acpi_parse_x2apic_affinity;
+		srat_proc[1].id = ACPI_SRAT_TYPE_GICC_AFFINITY;
+		srat_proc[1].handler = acpi_parse_gicc_affinity;
 
 		acpi_table_parse_entries_array(ACPI_SIG_SRAT,
 					sizeof(struct acpi_table_srat),
include/linux/acpi.h +16 -1
index 8010b26..9515db6 100644
@@ -232,10 +232,25 @@ int acpi_table_parse_madt(enum acpi_madt_type id,
 int acpi_parse_mcfg (struct acpi_table_header *header);
 void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
 
-/* the following four functions are architecture-dependent */
+/* the following numa functions are architecture-dependent */
 void acpi_numa_slit_init (struct acpi_table_slit *slit);
+
+#if defined(CONFIG_X86) || defined(CONFIG_IA64)
 void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
+#else
+static inline void
+acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) { }
+#endif
+
 void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
+
+#ifdef CONFIG_ARM64
+void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa);
+#else
+static inline void
+acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { }
+#endif
+
 int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
 
 #ifndef PHYS_CPUID_INVALID
Signature · 1 line
1.7.11.7
#25 lore raw

Re: [PATCH v7 15/15] acpi, numa: Enable ACPI based NUMA on ARM64

Quoted 93 lines · David Daney

From: Hanjun Guo <[email protected]>

Add function needed for cpu to node mapping, and enable ACPI based NUMA for ARM64 in Kconfig

---
  drivers/acpi/Kconfig |  4 ++--
  drivers/acpi/numa.c  | 37 ++++++++++++++++++++++++++++++++++++-
  include/linux/acpi.h | 17 ++++++++++++++++-
  3 files changed, 54 insertions(+), 4 deletions(-)
drivers/acpi/Kconfig +2 -2
index b7e2e77..dd76b36 100644
@@ -291,8 +291,8 @@ config ACPI_THERMAL
  config ACPI_NUMA
  	bool "NUMA support"
  	depends on NUMA
-	depends on (X86 || IA64)
-	default y if IA64_GENERIC || IA64_SGI_SN2
+	depends on (X86 || IA64 || ARM64)
+	default y if IA64_GENERIC || IA64_SGI_SN2 || ARM64
 
  config ACPI_CUSTOM_DSDT_FILE
  	string "Custom DSDT Table file to include"
drivers/acpi/numa.c +33 -0
index fad6d28..9b7ce40 100644
@@ -170,6 +170,18 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
  		}
  		break;
 
+	case ACPI_SRAT_TYPE_GICC_AFFINITY:
+		{
+			struct acpi_srat_gicc_affinity *p =
+			    (struct acpi_srat_gicc_affinity *)header;
+			pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n",
+				 p->acpi_processor_uid,
+				 p->proximity_domain,
+				 (p->flags & ACPI_SRAT_GICC_ENABLED) ?
+				 "enabled" : "disabled");
+		}
+		break;
+
  	default:
  		pr_warn("Found unsupported SRAT entry (type = 0x%x)\n",
  			header->type);
@@ -360,6 +372,24 @@ acpi_parse_processor_affinity(struct acpi_subtable_header *header,
  	return 0;
  }
 
+static int __init
+acpi_parse_gicc_affinity(struct acpi_subtable_header *header,
+			 const unsigned long end)
+{
+	struct acpi_srat_gicc_affinity *processor_affinity;
+
+	processor_affinity = (struct acpi_srat_gicc_affinity *)header;
+	if (!processor_affinity)
+		return -EINVAL;
+
+	acpi_table_print_srat_entry(header);
+
+	/* let architecture-dependent part to do it */
+	acpi_numa_gicc_affinity_init(processor_affinity);
+
+	return 0;
+}
+
  static int __initdata parsed_numa_memblks;
 
  static int __init
@@ -404,6 +434,9 @@ int __init acpi_numa_init(void)
  {
  	int cnt = 0;
 
+	if (acpi_disabled)
+		return -EINVAL;
+
  	/*
  	 * Should not limit number with cpu num that is from NR_CPUS or nr_cpus=
  	 * SRAT cpu entries could have different order with that in MADT.
@@ -412,13 +445,15 @@ int __init acpi_numa_init(void)
 
  	/* SRAT: Static Resource Affinity Table */
  	if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {

drivers/acpi/numa.c int __init acpi_numa_init(void) · line 456

Quoted 10 lines
drivers/acpi/numa.c +3 -1
-		struct acpi_subtable_proc srat_proc[2];
+		struct acpi_subtable_proc srat_proc[3];
 
  		memset(srat_proc, 0, sizeof(srat_proc));
  		srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY;
  		srat_proc[0].handler = acpi_parse_processor_affinity;
  		srat_proc[1].id = ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY;
  		srat_proc[1].handler = acpi_parse_x2apic_affinity;
+		srat_proc[1].id = ACPI_SRAT_TYPE_GICC_AFFINITY;
+		srat_proc[1].handler = acpi_parse_gicc_affinity;

Should be srat_proc[2].id and srat_proc[2].handler, right?

Regards,
Matthias

Quoted 35 lines
drivers/acpi/numa.c +0 -0
  		acpi_table_parse_entries_array(ACPI_SIG_SRAT,
  					sizeof(struct acpi_table_srat),
include/linux/acpi.h +16 -1
index 8010b26..9515db6 100644
@@ -232,10 +232,25 @@ int acpi_table_parse_madt(enum acpi_madt_type id,
  int acpi_parse_mcfg (struct acpi_table_header *header);
  void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
 
-/* the following four functions are architecture-dependent */
+/* the following numa functions are architecture-dependent */
  void acpi_numa_slit_init (struct acpi_table_slit *slit);
+
+#if defined(CONFIG_X86) || defined(CONFIG_IA64)
  void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
+#else
+static inline void
+acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) { }
+#endif
+
  void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
+
+#ifdef CONFIG_ARM64
+void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa);
+#else
+static inline void
+acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { }
+#endif
+
  int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
 
  #ifndef PHYS_CPUID_INVALID
#26 lore raw

Re: [PATCH v7 15/15] acpi, numa: Enable ACPI based NUMA on ARM64

Quoted 99 lines · Matthias Brugger
Quoted 96 lines · David Daney

From: Hanjun Guo <[email protected]>

Add function needed for cpu to node mapping, and enable ACPI based NUMA for ARM64 in Kconfig

---
  drivers/acpi/Kconfig |  4 ++--
  drivers/acpi/numa.c  | 37 ++++++++++++++++++++++++++++++++++++-
  include/linux/acpi.h | 17 ++++++++++++++++-
  3 files changed, 54 insertions(+), 4 deletions(-)
drivers/acpi/Kconfig +2 -2
index b7e2e77..dd76b36 100644
@@ -291,8 +291,8 @@ config ACPI_THERMAL
  config ACPI_NUMA
      bool "NUMA support"
      depends on NUMA
-    depends on (X86 || IA64)
-    default y if IA64_GENERIC || IA64_SGI_SN2
+    depends on (X86 || IA64 || ARM64)
+    default y if IA64_GENERIC || IA64_SGI_SN2 || ARM64
 
  config ACPI_CUSTOM_DSDT_FILE
      string "Custom DSDT Table file to include"
drivers/acpi/numa.c +34 -1
index fad6d28..9b7ce40 100644
@@ -170,6 +170,18 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
          }
          break;
 
+    case ACPI_SRAT_TYPE_GICC_AFFINITY:
+        {
+            struct acpi_srat_gicc_affinity *p =
+                (struct acpi_srat_gicc_affinity *)header;
+            pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n",
+                 p->acpi_processor_uid,
+                 p->proximity_domain,
+                 (p->flags & ACPI_SRAT_GICC_ENABLED) ?
+                 "enabled" : "disabled");
+        }
+        break;
+
      default:
          pr_warn("Found unsupported SRAT entry (type = 0x%x)\n",
              header->type);
@@ -360,6 +372,24 @@ acpi_parse_processor_affinity(struct acpi_subtable_header *header,
      return 0;
  }
 
+static int __init
+acpi_parse_gicc_affinity(struct acpi_subtable_header *header,
+             const unsigned long end)
+{
+    struct acpi_srat_gicc_affinity *processor_affinity;
+
+    processor_affinity = (struct acpi_srat_gicc_affinity *)header;
+    if (!processor_affinity)
+        return -EINVAL;
+
+    acpi_table_print_srat_entry(header);
+
+    /* let architecture-dependent part to do it */
+    acpi_numa_gicc_affinity_init(processor_affinity);
+
+    return 0;
+}
+
  static int __initdata parsed_numa_memblks;
 
  static int __init
@@ -404,6 +434,9 @@ int __init acpi_numa_init(void)
  {
      int cnt = 0;
 
+    if (acpi_disabled)
+        return -EINVAL;
+
      /*
       * Should not limit number with cpu num that is from NR_CPUS or nr_cpus=
       * SRAT cpu entries could have different order with that in MADT.
@@ -412,13 +445,15 @@ int __init acpi_numa_init(void)
 
      /* SRAT: Static Resource Affinity Table */
      if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
-        struct acpi_subtable_proc srat_proc[2];
+        struct acpi_subtable_proc srat_proc[3];
 
Quoted 9 lines

drivers/acpi/numa.c int __init acpi_numa_init(void) · line 456

Quoted 7 lines
drivers/acpi/numa.c +2 -0
          memset(srat_proc, 0, sizeof(srat_proc));
          srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY;
          srat_proc[0].handler = acpi_parse_processor_affinity;
          srat_proc[1].id = ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY;
          srat_proc[1].handler = acpi_parse_x2apic_affinity;
+        srat_proc[1].id = ACPI_SRAT_TYPE_GICC_AFFINITY;
+        srat_proc[1].handler = acpi_parse_gicc_affinity;

Should be srat_proc[2].id and srat_proc[2].handler, right?

Good catch, will send a updated version shortly.

Thanks
Hanjun

#27 lore raw
In reply to David Daney
Quoted 111 lines · David Daney

From: David Daney <[email protected]>

Rebased to Linus' master branch at commit 1d6da87a3241 ("Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux")

ACPI 5.1 already introduced NUMA support for ARM64, which can get the NUMA domain information from SRAT and SLIT table, so parse those two tables to get mappings from cpu/mem to numa node configuration and system locality.

v7 updates:

- Rebased to resolve one merge conflict.

- New patch 13/15 to enable use of existing MADT parsing code instead of adding an additional implementation of the parser.

- Added some Acked-by headers to patches in arm64 arch directories.

v6 updates:

- Changed message printed in 13/14 to omit meaningless "cpu" number. (noted by Dennis Chen and Hanjun Guo)

- New patch 7/14 to print different messages for NUMA disabled case. (noted by Dennis Chen)

- Squashed two patches into 14/14.

- Added Reviewed-by to 4/14

v5 updates:

- Fixed ia64 build failure by gating some unused functions with #if CONFIG_{X86,ARM64}.

- Fixed section mismatch errors for X86 case.

- Removed unneeded #include from some files.

- Tested to build cleanly on ARM64, X86_64, IA64

v4 updates:

- Updated from Hanjun Guo's v3 patches.

- Rebased on top of v16 of device-tree NUMA patches.

- Reordered some of the changes so that we don't introduce code and then change it several times in the patch set. New code is introduced in its final form. Code reused from x86 is first moved with no change, and then a separate patch to make any needed changes.

- code that is used only by ia64, moved to architecture specific files.

v3 updates:
- Deep investigation about the ACPI_DEBUG_PRINT() and remvoe that for acpi/numa.c (patch 2/12)

- Remove the duplicate NULL check for table print (patch 3/12)

- Introduce CONFIG_ACPI_HAS_NUMA_ARCH_FIXUP to remove duplicate dummy function for acpi_numa_arch_fixup()

- Solve the problem that the mapping from logical cpu to numa node is wrong which spotted out by Lorenzo

- cleanups for x86 and move acpi_numa_slit_init() and some other functions to common place, then reduce the duplicate of x86 and arm64 (patch 7-12/12).

- rebased on top of 4.4 and Ganapat's v9 patch set.

David Daney (4):
arm64, numa: Cleanup NUMA disabled messages.
acpi, numa: move bad_srat() and srat_disabled() to
drivers/acpi/numa.c
acpi, numa, srat: Improve SRAT error detection and add messages. ACPI / processor: Add acpi_map_madt_entry().

Hanjun Guo (10):
acpi, numa: Use pr_fmt() instead of printk
acpi, numa: Replace ACPI_DEBUG_PRINT() with pr_debug() acpi, numa: remove duplicate NULL check
acpi, numa: move acpi_numa_slit_init() to drivers/acpi/numa.c arm64, numa: rework numa_add_memblk()
x86, acpi, numa: cleanup acpi_numa_processor_affinity_init() acpi, numa: remove unneeded acpi_numa=1
acpi, numa: Move acpi_numa_memory_affinity_init() to
drivers/acpi/numa.c
arm64, acpi, numa: NUMA support based on SRAT and SLIT acpi, numa: Enable ACPI based NUMA on ARM64

Robert Richter (1):
acpi, numa: Move acpi_numa_arch_fixup() to ia64 only

 arch/arm64/include/asm/acpi.h |   8 ++
 arch/arm64/include/asm/numa.h |   2 +
 arch/arm64/kernel/Makefile    |   1 +
 arch/arm64/kernel/acpi_numa.c | 112 +++++++++++++++++++++
 arch/arm64/kernel/smp.c       |   2 +
 arch/arm64/mm/numa.c          |  28 ++++--
 arch/ia64/include/asm/acpi.h  |   3 +
 arch/ia64/kernel/acpi.c       |   2 +-
 arch/ia64/kernel/setup.c      |   1 +
 arch/x86/include/asm/acpi.h   |   1 -
 arch/x86/mm/numa.c            |   2 +-
 arch/x86/mm/srat.c            | 116 +---------------------
 drivers/acpi/Kconfig          |   4 +-
Quoted 8 lines
 drivers/acpi/numa.c           | 226 ++++++++++++++++++++++++++++++++----------
 drivers/acpi/processor_core.c |  26 ++++-
 drivers/of/of_numa.c          |   4 +-
 include/acpi/acpi_numa.h      |   4 +
 include/acpi/processor.h      |   1 +
 include/linux/acpi.h          |  18 +++-
 19 files changed, 369 insertions(+), 192 deletions(-)
 create mode 100644 arch/arm64/kernel/acpi_numa.c

All [1-15/15] queued up for 4.8, thanks!

#28 lore raw
Quoted 121 lines · Rafael J. Wysocki
Quoted 111 lines · David Daney

From: David Daney <[email protected]>

Rebased to Linus' master branch at commit 1d6da87a3241 ("Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux")

ACPI 5.1 already introduced NUMA support for ARM64, which can get the NUMA domain information from SRAT and SLIT table, so parse those two tables to get mappings from cpu/mem to numa node configuration and system locality.

v7 updates:

- Rebased to resolve one merge conflict.

- New patch 13/15 to enable use of existing MADT parsing code instead of adding an additional implementation of the parser.

- Added some Acked-by headers to patches in arm64 arch directories.

v6 updates:

- Changed message printed in 13/14 to omit meaningless "cpu" number. (noted by Dennis Chen and Hanjun Guo)

- New patch 7/14 to print different messages for NUMA disabled case. (noted by Dennis Chen)

- Squashed two patches into 14/14.

- Added Reviewed-by to 4/14

v5 updates:

- Fixed ia64 build failure by gating some unused functions with #if CONFIG_{X86,ARM64}.

- Fixed section mismatch errors for X86 case.

- Removed unneeded #include from some files.

- Tested to build cleanly on ARM64, X86_64, IA64

v4 updates:

- Updated from Hanjun Guo's v3 patches.

- Rebased on top of v16 of device-tree NUMA patches.

- Reordered some of the changes so that we don't introduce code and then change it several times in the patch set. New code is introduced in its final form. Code reused from x86 is first moved with no change, and then a separate patch to make any needed changes.

- code that is used only by ia64, moved to architecture specific files.

v3 updates:
- Deep investigation about the ACPI_DEBUG_PRINT() and remvoe that for acpi/numa.c (patch 2/12)

- Remove the duplicate NULL check for table print (patch 3/12)

- Introduce CONFIG_ACPI_HAS_NUMA_ARCH_FIXUP to remove duplicate dummy function for acpi_numa_arch_fixup()

- Solve the problem that the mapping from logical cpu to numa node is wrong which spotted out by Lorenzo

- cleanups for x86 and move acpi_numa_slit_init() and some other functions to common place, then reduce the duplicate of x86 and arm64 (patch 7-12/12).

- rebased on top of 4.4 and Ganapat's v9 patch set.

David Daney (4):
arm64, numa: Cleanup NUMA disabled messages.
acpi, numa: move bad_srat() and srat_disabled() to
drivers/acpi/numa.c
acpi, numa, srat: Improve SRAT error detection and add messages. ACPI / processor: Add acpi_map_madt_entry().

Hanjun Guo (10):
acpi, numa: Use pr_fmt() instead of printk
acpi, numa: Replace ACPI_DEBUG_PRINT() with pr_debug() acpi, numa: remove duplicate NULL check
acpi, numa: move acpi_numa_slit_init() to drivers/acpi/numa.c arm64, numa: rework numa_add_memblk()
x86, acpi, numa: cleanup acpi_numa_processor_affinity_init() acpi, numa: remove unneeded acpi_numa=1
acpi, numa: Move acpi_numa_memory_affinity_init() to
drivers/acpi/numa.c
arm64, acpi, numa: NUMA support based on SRAT and SLIT acpi, numa: Enable ACPI based NUMA on ARM64

Robert Richter (1):
acpi, numa: Move acpi_numa_arch_fixup() to ia64 only

 arch/arm64/include/asm/acpi.h |   8 ++
 arch/arm64/include/asm/numa.h |   2 +
 arch/arm64/kernel/Makefile    |   1 +
 arch/arm64/kernel/acpi_numa.c | 112 +++++++++++++++++++++
 arch/arm64/kernel/smp.c       |   2 +
 arch/arm64/mm/numa.c          |  28 ++++--
 arch/ia64/include/asm/acpi.h  |   3 +
 arch/ia64/kernel/acpi.c       |   2 +-
 arch/ia64/kernel/setup.c      |   1 +
 arch/x86/include/asm/acpi.h   |   1 -
 arch/x86/mm/numa.c            |   2 +-
 arch/x86/mm/srat.c            | 116 +---------------------
 drivers/acpi/Kconfig          |   4 +-
Quoted 8 lines
 drivers/acpi/numa.c           | 226 ++++++++++++++++++++++++++++++++----------
 drivers/acpi/processor_core.c |  26 ++++-
 drivers/of/of_numa.c          |   4 +-
 include/acpi/acpi_numa.h      |   4 +
 include/acpi/processor.h      |   1 +
 include/linux/acpi.h          |  18 +++-
 19 files changed, 369 insertions(+), 192 deletions(-)
 create mode 100644 arch/arm64/kernel/acpi_numa.c
Quoted 1 line

All [1-15/15] queued up for 4.8, thanks!

Rafael,

I noticed patch #15 missing in your today's tree, I only found:

d8b47fca8c23 arm64, ACPI, NUMA: NUMA support based on SRAT and SLIT

Is this intended? It still cleanly applies.

Thanks,

-Robert

#29 lore raw
Quoted 124 lines · Robert Richter
Quoted 121 lines · Rafael J. Wysocki
Quoted 111 lines · David Daney

From: David Daney <[email protected]>

Rebased to Linus' master branch at commit 1d6da87a3241 ("Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux")

ACPI 5.1 already introduced NUMA support for ARM64, which can get the NUMA domain information from SRAT and SLIT table, so parse those two tables to get mappings from cpu/mem to numa node configuration and system locality.

v7 updates:

- Rebased to resolve one merge conflict.

- New patch 13/15 to enable use of existing MADT parsing code instead of adding an additional implementation of the parser.

- Added some Acked-by headers to patches in arm64 arch directories.

v6 updates:

- Changed message printed in 13/14 to omit meaningless "cpu" number. (noted by Dennis Chen and Hanjun Guo)

- New patch 7/14 to print different messages for NUMA disabled case. (noted by Dennis Chen)

- Squashed two patches into 14/14.

- Added Reviewed-by to 4/14

v5 updates:

- Fixed ia64 build failure by gating some unused functions with #if CONFIG_{X86,ARM64}.

- Fixed section mismatch errors for X86 case.

- Removed unneeded #include from some files.

- Tested to build cleanly on ARM64, X86_64, IA64

v4 updates:

- Updated from Hanjun Guo's v3 patches.

- Rebased on top of v16 of device-tree NUMA patches.

- Reordered some of the changes so that we don't introduce code and then change it several times in the patch set. New code is introduced in its final form. Code reused from x86 is first moved with no change, and then a separate patch to make any needed changes.

- code that is used only by ia64, moved to architecture specific files.

v3 updates:
- Deep investigation about the ACPI_DEBUG_PRINT() and remvoe that for acpi/numa.c (patch 2/12)

- Remove the duplicate NULL check for table print (patch 3/12)

- Introduce CONFIG_ACPI_HAS_NUMA_ARCH_FIXUP to remove duplicate dummy function for acpi_numa_arch_fixup()

- Solve the problem that the mapping from logical cpu to numa node is wrong which spotted out by Lorenzo

- cleanups for x86 and move acpi_numa_slit_init() and some other functions to common place, then reduce the duplicate of x86 and arm64 (patch 7-12/12).

- rebased on top of 4.4 and Ganapat's v9 patch set.

David Daney (4):
arm64, numa: Cleanup NUMA disabled messages.
acpi, numa: move bad_srat() and srat_disabled() to
drivers/acpi/numa.c
acpi, numa, srat: Improve SRAT error detection and add messages. ACPI / processor: Add acpi_map_madt_entry().

Hanjun Guo (10):
acpi, numa: Use pr_fmt() instead of printk
acpi, numa: Replace ACPI_DEBUG_PRINT() with pr_debug() acpi, numa: remove duplicate NULL check
acpi, numa: move acpi_numa_slit_init() to drivers/acpi/numa.c arm64, numa: rework numa_add_memblk()
x86, acpi, numa: cleanup acpi_numa_processor_affinity_init() acpi, numa: remove unneeded acpi_numa=1
acpi, numa: Move acpi_numa_memory_affinity_init() to
drivers/acpi/numa.c
arm64, acpi, numa: NUMA support based on SRAT and SLIT acpi, numa: Enable ACPI based NUMA on ARM64

Robert Richter (1):
acpi, numa: Move acpi_numa_arch_fixup() to ia64 only

 arch/arm64/include/asm/acpi.h |   8 ++
 arch/arm64/include/asm/numa.h |   2 +
 arch/arm64/kernel/Makefile    |   1 +
 arch/arm64/kernel/acpi_numa.c | 112 +++++++++++++++++++++
 arch/arm64/kernel/smp.c       |   2 +
 arch/arm64/mm/numa.c          |  28 ++++--
 arch/ia64/include/asm/acpi.h  |   3 +
 arch/ia64/kernel/acpi.c       |   2 +-
 arch/ia64/kernel/setup.c      |   1 +
 arch/x86/include/asm/acpi.h   |   1 -
 arch/x86/mm/numa.c            |   2 +-
 arch/x86/mm/srat.c            | 116 +---------------------
 drivers/acpi/Kconfig          |   4 +-
Quoted 8 lines
 drivers/acpi/numa.c           | 226 ++++++++++++++++++++++++++++++++----------
 drivers/acpi/processor_core.c |  26 ++++-
 drivers/of/of_numa.c          |   4 +-
 include/acpi/acpi_numa.h      |   4 +
 include/acpi/processor.h      |   1 +
 include/linux/acpi.h          |  18 +++-
 19 files changed, 369 insertions(+), 192 deletions(-)
 create mode 100644 arch/arm64/kernel/acpi_numa.c
Quoted 1 line

All [1-15/15] queued up for 4.8, thanks!

Quoted 7 lines

Rafael,

I noticed patch #15 missing in your today's tree, I only found:

d8b47fca8c23 arm64, ACPI, NUMA: NUMA support based on SRAT and SLIT

Is this intended? It still cleanly applies.

Ah, just seen Matthias' comment, I guess we need to resend a fixed version.

-Robert

#30 lore raw
Quoted 127 lines · Robert Richter
Quoted 126 lines · Robert Richter
Quoted 121 lines · Rafael J. Wysocki
Quoted 111 lines · David Daney

From: David Daney <[email protected]>

Rebased to Linus' master branch at commit 1d6da87a3241 ("Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux")

ACPI 5.1 already introduced NUMA support for ARM64, which can get the NUMA domain information from SRAT and SLIT table, so parse those two tables to get mappings from cpu/mem to numa node configuration and system locality.

v7 updates:

- Rebased to resolve one merge conflict.

- New patch 13/15 to enable use of existing MADT parsing code instead of adding an additional implementation of the parser.

- Added some Acked-by headers to patches in arm64 arch directories.

v6 updates:

- Changed message printed in 13/14 to omit meaningless "cpu" number. (noted by Dennis Chen and Hanjun Guo)

- New patch 7/14 to print different messages for NUMA disabled case. (noted by Dennis Chen)

- Squashed two patches into 14/14.

- Added Reviewed-by to 4/14

v5 updates:

- Fixed ia64 build failure by gating some unused functions with #if CONFIG_{X86,ARM64}.

- Fixed section mismatch errors for X86 case.

- Removed unneeded #include from some files.

- Tested to build cleanly on ARM64, X86_64, IA64

v4 updates:

- Updated from Hanjun Guo's v3 patches.

- Rebased on top of v16 of device-tree NUMA patches.

- Reordered some of the changes so that we don't introduce code and then change it several times in the patch set. New code is introduced in its final form. Code reused from x86 is first moved with no change, and then a separate patch to make any needed changes.

- code that is used only by ia64, moved to architecture specific files.

v3 updates:
- Deep investigation about the ACPI_DEBUG_PRINT() and remvoe that for acpi/numa.c (patch 2/12)

- Remove the duplicate NULL check for table print (patch 3/12)

- Introduce CONFIG_ACPI_HAS_NUMA_ARCH_FIXUP to remove duplicate dummy function for acpi_numa_arch_fixup()

- Solve the problem that the mapping from logical cpu to numa node is wrong which spotted out by Lorenzo

- cleanups for x86 and move acpi_numa_slit_init() and some other functions to common place, then reduce the duplicate of x86 and arm64 (patch 7-12/12).

- rebased on top of 4.4 and Ganapat's v9 patch set.

David Daney (4):
arm64, numa: Cleanup NUMA disabled messages.
acpi, numa: move bad_srat() and srat_disabled() to
drivers/acpi/numa.c
acpi, numa, srat: Improve SRAT error detection and add messages. ACPI / processor: Add acpi_map_madt_entry().

Hanjun Guo (10):
acpi, numa: Use pr_fmt() instead of printk
acpi, numa: Replace ACPI_DEBUG_PRINT() with pr_debug() acpi, numa: remove duplicate NULL check
acpi, numa: move acpi_numa_slit_init() to drivers/acpi/numa.c arm64, numa: rework numa_add_memblk()
x86, acpi, numa: cleanup acpi_numa_processor_affinity_init() acpi, numa: remove unneeded acpi_numa=1
acpi, numa: Move acpi_numa_memory_affinity_init() to
drivers/acpi/numa.c
arm64, acpi, numa: NUMA support based on SRAT and SLIT acpi, numa: Enable ACPI based NUMA on ARM64

Robert Richter (1):
acpi, numa: Move acpi_numa_arch_fixup() to ia64 only

 arch/arm64/include/asm/acpi.h |   8 ++
 arch/arm64/include/asm/numa.h |   2 +
 arch/arm64/kernel/Makefile    |   1 +
 arch/arm64/kernel/acpi_numa.c | 112 +++++++++++++++++++++
 arch/arm64/kernel/smp.c       |   2 +
 arch/arm64/mm/numa.c          |  28 ++++--
 arch/ia64/include/asm/acpi.h  |   3 +
 arch/ia64/kernel/acpi.c       |   2 +-
 arch/ia64/kernel/setup.c      |   1 +
 arch/x86/include/asm/acpi.h   |   1 -
 arch/x86/mm/numa.c            |   2 +-
 arch/x86/mm/srat.c            | 116 +---------------------
 drivers/acpi/Kconfig          |   4 +-
Quoted 8 lines
 drivers/acpi/numa.c           | 226 ++++++++++++++++++++++++++++++++----------
 drivers/acpi/processor_core.c |  26 ++++-
 drivers/of/of_numa.c          |   4 +-
 include/acpi/acpi_numa.h      |   4 +
 include/acpi/processor.h      |   1 +
 include/linux/acpi.h          |  18 +++-
 19 files changed, 369 insertions(+), 192 deletions(-)
 create mode 100644 arch/arm64/kernel/acpi_numa.c
Quoted 1 line

All [1-15/15] queued up for 4.8, thanks!

Rafael,

Quoted 8 lines
Quoted 5 lines

I noticed patch #15 missing in your today's tree, I only found:

d8b47fca8c23 arm64, ACPI, NUMA: NUMA support based on SRAT and SLIT

Is this intended? It still cleanly applies.

Ah, just seen Matthias' comment, I guess we need to resend a fixed version.

Right.

Sorry about the confusion, I was about to ask for an update patch later today.

Thanks,
Rafael