* [Patch:001/004]Unify pxm_to_node id ver.3.(generic code)
2006-03-28 10:12 [Patch:000/004]Unify pxm_to_node id ver.3 Yasunori Goto
@ 2006-03-28 10:16 ` Yasunori Goto
2006-03-28 21:07 ` Andrew Morton
2006-03-28 10:17 ` [Patch:002/004]Unify pxm_to_node id ver.3. (for ia64) Yasunori Goto
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Yasunori Goto @ 2006-03-28 10:16 UTC (permalink / raw)
To: Andrew Morton
Cc: Luck, Tony, Andi Kleen, Brown, Len, Linux Kernel ML, ACPI-ML,
linux-ia64, x86-64 Discuss
This is new generic code for pxm_to_node_map and CONFIG_NR_NODES.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
drivers/acpi/numa.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++
include/acpi/acpi_numa.h | 23 ++++++++++++++++++++++
include/linux/acpi.h | 1
mm/Kconfig | 12 +++++++++++
4 files changed, 84 insertions(+)
Index: pxm_ver3/drivers/acpi/numa.c
===================================================================
--- pxm_ver3.orig/drivers/acpi/numa.c 2006-03-28 14:10:02.867761158 +0900
+++ pxm_ver3/drivers/acpi/numa.c 2006-03-28 14:13:30.926352359 +0900
@@ -36,12 +36,60 @@
#define _COMPONENT ACPI_NUMA
ACPI_MODULE_NAME("numa")
+static nodemask_t nodes_found_map = NODE_MASK_NONE;
+#define PXM_INVAL -1
+#define NID_INVAL -1
+
+/* maps to convert between proximity domain and logical node ID */
+int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS]
+ = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL };
+int __cpuinitdata node_to_pxm_map[MAX_NUMNODES]
+ = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
+
extern int __init acpi_table_parse_madt_family(enum acpi_table_id id,
unsigned long madt_size,
int entry_id,
acpi_madt_entry_handler handler,
unsigned int max_entries);
+int __cpuinit pxm_to_node(int pxm)
+{
+ if (pxm < 0)
+ return NID_INVAL;
+ return pxm_to_node_map[pxm];
+}
+
+int __cpuinit node_to_pxm(int node)
+{
+ if (node < 0)
+ return PXM_INVAL;
+ return node_to_pxm_map[node];
+}
+
+int __cpuinit acpi_map_pxm_to_node(int pxm)
+{
+ int node = pxm_to_node_map[pxm];
+
+ if (node < 0){
+ if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
+ return NID_INVAL;
+ node = first_unset_node(nodes_found_map);
+ pxm_to_node_map[pxm] = node;
+ node_to_pxm_map[node] = pxm;
+ node_set(node, nodes_found_map);
+ }
+
+ return node;
+}
+
+void __cpuinit acpi_unmap_pxm_to_node(int node)
+{
+ int pxm = node_to_pxm_map[node];
+ pxm_to_node_map[pxm] = NID_INVAL;
+ node_to_pxm_map[node] = PXM_INVAL;
+ node_clear(node, nodes_found_map);
+}
+
void __init acpi_table_print_srat_entry(acpi_table_entry_header * header)
{
Index: pxm_ver3/include/acpi/acpi_numa.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ pxm_ver3/include/acpi/acpi_numa.h 2006-03-28 14:13:30.927328921 +0900
@@ -0,0 +1,23 @@
+#ifndef __ACPI_NUMA_H
+#define __ACPI_NUMA_H
+
+#ifdef CONFIG_ACPI_NUMA
+#include <linux/kernel.h>
+
+/* Proximity bitmap length */
+#ifdef CONFIG_NR_NODES_CHANGABLE
+#define MAX_PXM_DOMAINS CONFIG_NR_NODES
+#else
+#define MAX_PXM_DOMAINS (256)
+#endif
+
+extern int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS];
+extern int __cpuinitdata node_to_pxm_map[MAX_NUMNODES];
+
+extern int __cpuinit pxm_to_node(int);
+extern int __cpuinit node_to_pxm(int);
+extern int __cpuinit acpi_map_pxm_to_node(int);
+extern void __cpuinit acpi_unmap_pxm_to_node(int);
+
+#endif /* CONFIG_ACPI_NUMA */
+#endif /* __ACP_NUMA_H */
Index: pxm_ver3/include/linux/acpi.h
===================================================================
--- pxm_ver3.orig/include/linux/acpi.h 2006-03-28 14:10:02.867761158 +0900
+++ pxm_ver3/include/linux/acpi.h 2006-03-28 14:24:38.740797303 +0900
@@ -38,6 +38,7 @@
#include <acpi/acpi.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
+#include <acpi/acpi_numa.h>
#include <asm/acpi.h>
Index: pxm_ver3/mm/Kconfig
===================================================================
--- pxm_ver3.orig/mm/Kconfig 2006-03-28 14:24:38.009352000 +0900
+++ pxm_ver3/mm/Kconfig 2006-03-28 14:24:53.320875250 +0900
@@ -91,6 +91,18 @@ config HAVE_MEMORY_PRESENT
depends on ARCH_HAVE_MEMORY_PRESENT || SPARSEMEM
#
+# NR_NODES is to configure NODES_SHIFT
+#
+config NR_NODES
+ int "Maximum number of NODEs (256-1024)"
+ range 256 1024
+ depends on NEED_MULTIPLE_NODES && NR_NODES_CHANGABLE
+ default "256"
+ help
+ This option specifies the maximum number of nodes in your SSI system.
+ If in doubt, use the default.
+
+#
# SPARSEMEM_EXTREME (which is the default) does some bootmem
# allocations when memory_present() is called. If this can not
# be done on your architecture, select this option. However,
--
Yasunori Goto
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [Patch:001/004]Unify pxm_to_node id ver.3.(generic code)
2006-03-28 10:16 ` [Patch:001/004]Unify pxm_to_node id ver.3.(generic code) Yasunori Goto
@ 2006-03-28 21:07 ` Andrew Morton
2006-03-29 1:28 ` Yasunori Goto
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2006-03-28 21:07 UTC (permalink / raw)
To: Yasunori Goto
Cc: tony.luck, ak, len.brown, linux-kernel, linux-acpi, linux-ia64,
discuss
Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>
> +/* Proximity bitmap length */
> +#ifdef CONFIG_NR_NODES_CHANGABLE
> +#define MAX_PXM_DOMAINS CONFIG_NR_NODES
> +#else
> +#define MAX_PXM_DOMAINS (256)
> +#endif
I don't think we need CONFIG_NR_NODES_CHANGABLE (it is spelled
"changeable", btw).
If the architecture wants to support changing of CONFIG_NR_NODES then it
can permit CONFIG_NR_NODES to be changed in its Kconfig implementation.
If the architecture doesn't want to permit changing of CONFIG_NR_NODES
then it should simply hardwire CONFIG_NR_NODES to the chosen value in
its Kconfig.
So all architectures which use acpi_numa must implement CONFIG_NR_NODES.
In fact, it would probably make sense to require that all NUMA-supporting
archtectures implement CONFIG_NR_NODES.
Also, we already have NODES_SHIFT defined in include/asm-*/numnodes.h.
What's the relationship between that and CONFIG_NR_NODES? It seems that we
want to derive NODES_SHIFT from CONFIG_NR_NODES.
Was ia64's CONFIG_IA64_NR_NODES the best choice? Should ia64 instead have
made NODES_SHIFT Kconfigurable, and derived its max-nr_nodes from that?
It's all a bit of a pickle.
I guess for now a suitable approach would be to make all numa-using
architectures define CONFIG_NR_NODES, and to leave that rather
unpleasant-looking code in include/asm-ia64/numnodes.h as it is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Patch:001/004]Unify pxm_to_node id ver.3.(generic code)
2006-03-28 21:07 ` Andrew Morton
@ 2006-03-29 1:28 ` Yasunori Goto
0 siblings, 0 replies; 7+ messages in thread
From: Yasunori Goto @ 2006-03-29 1:28 UTC (permalink / raw)
To: Andrew Morton
Cc: tony.luck, ak, len.brown, linux-kernel, linux-acpi, linux-ia64,
discuss
> Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> >
> > +/* Proximity bitmap length */
> > +#ifdef CONFIG_NR_NODES_CHANGABLE
> > +#define MAX_PXM_DOMAINS CONFIG_NR_NODES
> > +#else
> > +#define MAX_PXM_DOMAINS (256)
> > +#endif
>
> I don't think we need CONFIG_NR_NODES_CHANGABLE (it is spelled
> "changeable", btw).
>
> If the architecture wants to support changing of CONFIG_NR_NODES then it
> can permit CONFIG_NR_NODES to be changed in its Kconfig implementation.
>
> If the architecture doesn't want to permit changing of CONFIG_NR_NODES
> then it should simply hardwire CONFIG_NR_NODES to the chosen value in
> its Kconfig.
>
> So all architectures which use acpi_numa must implement CONFIG_NR_NODES.
>
> In fact, it would probably make sense to require that all NUMA-supporting
> archtectures implement CONFIG_NR_NODES.
>
> Also, we already have NODES_SHIFT defined in include/asm-*/numnodes.h.
> What's the relationship between that and CONFIG_NR_NODES? It seems that we
> want to derive NODES_SHIFT from CONFIG_NR_NODES.
>
> Was ia64's CONFIG_IA64_NR_NODES the best choice? Should ia64 instead have
> made NODES_SHIFT Kconfigurable, and derived its max-nr_nodes from that?
>
> It's all a bit of a pickle.
>
>
> I guess for now a suitable approach would be to make all numa-using
> architectures define CONFIG_NR_NODES, and to leave that rather
> unpleasant-looking code in include/asm-ia64/numnodes.h as it is.
>
Ahhh.
I understand what you wish at last.
I thought relationship between pxm and nid is just acpi-using
architecture's issue.
But, it becomes for all numa-using architecture's issue.
Ok. I'll change it.
Thanks.
--
Yasunori Goto
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Patch:002/004]Unify pxm_to_node id ver.3. (for ia64)
2006-03-28 10:12 [Patch:000/004]Unify pxm_to_node id ver.3 Yasunori Goto
2006-03-28 10:16 ` [Patch:001/004]Unify pxm_to_node id ver.3.(generic code) Yasunori Goto
@ 2006-03-28 10:17 ` Yasunori Goto
2006-03-28 10:17 ` [Patch:003/004]Unify pxm_to_node id ver.3.(for x86-64) Yasunori Goto
2006-03-28 10:17 ` [Patch:004/004]Unify pxm_to_node id ver.3. (for i386) Yasunori Goto
3 siblings, 0 replies; 7+ messages in thread
From: Yasunori Goto @ 2006-03-28 10:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Luck, Tony, Andi Kleen, Brown, Len, Linux Kernel ML, ACPI-ML,
linux-ia64, x86-64 Discuss
This is to use generic pxm_to_node() function instead of
old pxm_to_nid_map for ia64. And change old CONFIG_IA_NR_NODES
to common one.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
arch/ia64/Kconfig | 9 ++-------
arch/ia64/hp/common/sba_iommu.c | 2 +-
arch/ia64/kernel/acpi.c | 24 ++++++++----------------
arch/ia64/pci/pci.c | 2 +-
arch/ia64/sn/kernel/setup.c | 4 ++--
include/asm-ia64/acpi.h | 11 -----------
include/asm-ia64/numnodes.h | 6 +++---
7 files changed, 17 insertions(+), 41 deletions(-)
Index: pxm_ver3/arch/ia64/kernel/acpi.c
===================================================================
--- pxm_ver3.orig/arch/ia64/kernel/acpi.c 2006-03-28 14:24:40.091383224 +0900
+++ pxm_ver3/arch/ia64/kernel/acpi.c 2006-03-28 14:25:34.960523177 +0900
@@ -415,9 +415,6 @@ static int __initdata srat_num_cpus; /*
static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
-/* maps to convert between proximity domain and logical node ID */
-int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
-int __initdata nid_to_pxm_map[MAX_NUMNODES];
static struct acpi_table_slit __initdata *slit_table;
static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa)
@@ -533,22 +530,17 @@ void __init acpi_numa_arch_fixup(void)
* MCD - This can probably be dropped now. No need for pxm ID to node ID
* mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES.
*/
- /* calculate total number of nodes in system from PXM bitmap */
- memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
- memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
nodes_clear(node_online_map);
for (i = 0; i < MAX_PXM_DOMAINS; i++) {
if (pxm_bit_test(i)) {
- int nid = num_online_nodes();
- pxm_to_nid_map[i] = nid;
- nid_to_pxm_map[nid] = i;
+ int nid = acpi_map_pxm_to_node(i);
node_set_online(nid);
}
}
/* set logical node id in memory chunk structure */
for (i = 0; i < num_node_memblks; i++)
- node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];
+ node_memblk[i].nid = pxm_to_node(node_memblk[i].nid);
/* assign memory bank numbers for each chunk on each node */
for_each_online_node(i) {
@@ -562,7 +554,7 @@ void __init acpi_numa_arch_fixup(void)
/* set logical node id in cpu structure */
for (i = 0; i < srat_num_cpus; i++)
- node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
+ node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid);
printk(KERN_INFO "Number of logical nodes in system = %d\n",
num_online_nodes());
@@ -575,11 +567,11 @@ void __init acpi_numa_arch_fixup(void)
for (i = 0; i < slit_table->localities; i++) {
if (!pxm_bit_test(i))
continue;
- node_from = pxm_to_nid_map[i];
+ node_from = pxm_to_node(i);
for (j = 0; j < slit_table->localities; j++) {
if (!pxm_bit_test(j))
continue;
- node_to = pxm_to_nid_map[j];
+ node_to = pxm_to_node(j);
node_distance(node_from, node_to) =
slit_table->entry[i * slit_table->localities + j];
}
@@ -785,9 +777,9 @@ int acpi_map_cpu2node(acpi_handle handle
/*
* Assuming that the container driver would have set the proximity
- * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
+ * domain and would have initialized pxm_to_node(pxm_id) && pxm_flag
*/
- node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
+ node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_node(pxm_id);
node_cpuid[cpu].phys_id = physid;
#endif
@@ -966,7 +958,7 @@ acpi_map_iosapic(acpi_handle handle, u32
if (pxm < 0)
return AE_OK;
- node = pxm_to_nid_map[pxm];
+ node = pxm_to_node(pxm);
if (node >= MAX_NUMNODES || !node_online(node) ||
cpus_empty(node_to_cpumask(node)))
Index: pxm_ver3/arch/ia64/pci/pci.c
===================================================================
--- pxm_ver3.orig/arch/ia64/pci/pci.c 2006-03-28 14:24:40.091383224 +0900
+++ pxm_ver3/arch/ia64/pci/pci.c 2006-03-28 14:25:34.961499739 +0900
@@ -353,7 +353,7 @@ pci_acpi_scan_root(struct acpi_device *d
pxm = acpi_get_pxm(controller->acpi_handle);
#ifdef CONFIG_NUMA
if (pxm >= 0)
- controller->node = pxm_to_nid_map[pxm];
+ controller->node = pxm_to_node(pxm);
#endif
acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
Index: pxm_ver3/arch/ia64/hp/common/sba_iommu.c
===================================================================
--- pxm_ver3.orig/arch/ia64/hp/common/sba_iommu.c 2006-03-28 14:24:40.092359787 +0900
+++ pxm_ver3/arch/ia64/hp/common/sba_iommu.c 2006-03-28 14:25:34.962476302 +0900
@@ -1958,7 +1958,7 @@ sba_map_ioc_to_node(struct ioc *ioc, acp
if (pxm < 0)
return;
- node = pxm_to_nid_map[pxm];
+ node = pxm_to_node(pxm);
if (node >= MAX_NUMNODES || !node_online(node))
return;
Index: pxm_ver3/arch/ia64/sn/kernel/setup.c
===================================================================
--- pxm_ver3.orig/arch/ia64/sn/kernel/setup.c 2006-03-28 14:24:40.092359787 +0900
+++ pxm_ver3/arch/ia64/sn/kernel/setup.c 2006-03-28 14:25:34.963452864 +0900
@@ -139,7 +139,7 @@ static int __init pxm_to_nasid(int pxm)
int i;
int nid;
- nid = pxm_to_nid_map[pxm];
+ nid = pxm_to_node(pxm);
for (i = 0; i < num_node_memblks; i++) {
if (node_memblk[i].nid == nid) {
return NASID_GET(node_memblk[i].start_paddr);
@@ -704,7 +704,7 @@ void __init build_cnode_tables(void)
* cnode == node for all C & M bricks.
*/
for_each_online_node(node) {
- nasid = pxm_to_nasid(nid_to_pxm_map[node]);
+ nasid = pxm_to_nasid(node_to_pxm(node));
sn_cnodeid_to_nasid[node] = nasid;
physical_node_map[nasid] = node;
}
Index: pxm_ver3/include/asm-ia64/acpi.h
===================================================================
--- pxm_ver3.orig/include/asm-ia64/acpi.h 2006-03-28 14:24:40.092359787 +0900
+++ pxm_ver3/include/asm-ia64/acpi.h 2006-03-28 14:25:34.963452864 +0900
@@ -109,17 +109,6 @@ extern unsigned int get_cpei_target_cpu(
extern void prefill_possible_map(void);
extern int additional_cpus;
-#ifdef CONFIG_ACPI_NUMA
-/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/
-#ifdef CONFIG_IA64_NR_NODES
-#define MAX_PXM_DOMAINS CONFIG_IA64_NR_NODES
-#else
-#define MAX_PXM_DOMAINS (256)
-#endif
-extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
-extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
-#endif
-
extern u16 ia64_acpiid_to_sapicid[];
/*
Index: pxm_ver3/arch/ia64/Kconfig
===================================================================
--- pxm_ver3.orig/arch/ia64/Kconfig 2006-03-28 14:27:36.475170126 +0900
+++ pxm_ver3/arch/ia64/Kconfig 2006-03-28 14:32:05.280830896 +0900
@@ -260,14 +260,9 @@ config NR_CPUS
than 64 will cause the use of a CPU mask array, causing a small
performance hit.
-config IA64_NR_NODES
- int "Maximum number of NODEs (256-1024)" if (IA64_SGI_SN2 || IA64_GENERIC)
- range 256 1024
+config NR_NODES_CHANGABLE
+ def_bool y
depends on IA64_SGI_SN2 || IA64_GENERIC
- default "256"
- help
- This option specifies the maximum number of nodes in your SSI system.
- If in doubt, use the default.
config HOTPLUG_CPU
bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
Index: pxm_ver3/include/asm-ia64/numnodes.h
===================================================================
--- pxm_ver3.orig/include/asm-ia64/numnodes.h 2006-03-28 14:27:36.475170126 +0900
+++ pxm_ver3/include/asm-ia64/numnodes.h 2006-03-28 14:33:03.073798938 +0900
@@ -8,11 +8,11 @@
/* Max 32 Nodes */
# define NODES_SHIFT 5
#elif defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC)
-# if CONFIG_IA64_NR_NODES == 256
+# if CONFIG_NR_NODES == 256
# define NODES_SHIFT 8
-# elif CONFIG_IA64_NR_NODES <= 512
+# elif CONFIG_NR_NODES <= 512
# define NODES_SHIFT 9
-# elif CONFIG_IA64_NR_NODES <= 1024
+# elif CONFIG_NR_NODES <= 1024
# define NODES_SHIFT 10
# endif
#endif
--
Yasunori Goto
^ permalink raw reply [flat|nested] 7+ messages in thread* [Patch:003/004]Unify pxm_to_node id ver.3.(for x86-64)
2006-03-28 10:12 [Patch:000/004]Unify pxm_to_node id ver.3 Yasunori Goto
2006-03-28 10:16 ` [Patch:001/004]Unify pxm_to_node id ver.3.(generic code) Yasunori Goto
2006-03-28 10:17 ` [Patch:002/004]Unify pxm_to_node id ver.3. (for ia64) Yasunori Goto
@ 2006-03-28 10:17 ` Yasunori Goto
2006-03-28 10:17 ` [Patch:004/004]Unify pxm_to_node id ver.3. (for i386) Yasunori Goto
3 siblings, 0 replies; 7+ messages in thread
From: Yasunori Goto @ 2006-03-28 10:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Luck, Tony, Andi Kleen, Brown, Len, Linux Kernel ML, ACPI-ML,
linux-ia64, x86-64 Discuss
This is to remove the code of pxm_to_node from x86-64 code.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
arch/x86_64/mm/srat.c | 33 +--------------------------------
include/asm-x86_64/numa.h | 1 -
2 files changed, 1 insertion(+), 33 deletions(-)
Index: pxm_ver3/arch/x86_64/mm/srat.c
===================================================================
--- pxm_ver3.orig/arch/x86_64/mm/srat.c 2006-03-27 12:09:14.000000000 +0900
+++ pxm_ver3/arch/x86_64/mm/srat.c 2006-03-27 14:07:14.000000000 +0900
@@ -22,35 +22,15 @@
static struct acpi_table_slit *acpi_slit;
static nodemask_t nodes_parsed __initdata;
-static nodemask_t nodes_found __initdata;
static struct bootnode nodes[MAX_NUMNODES] __initdata;
-static u8 pxm2node[256] = { [0 ... 255] = 0xff };
/* Too small nodes confuse the VM badly. Usually they result
from BIOS bugs. */
#define NODE_MIN_SIZE (4*1024*1024)
-static int node_to_pxm(int n);
-
-int pxm_to_node(int pxm)
-{
- if ((unsigned)pxm >= 256)
- return -1;
- /* Extend 0xff to (int)-1 */
- return (signed char)pxm2node[pxm];
-}
-
static __init int setup_node(int pxm)
{
- unsigned node = pxm2node[pxm];
- if (node == 0xff) {
- if (nodes_weight(nodes_found) >= MAX_NUMNODES)
- return -1;
- node = first_unset_node(nodes_found);
- node_set(node, nodes_found);
- pxm2node[pxm] = node;
- }
- return pxm2node[pxm];
+ return acpi_map_pxm_to_node(pxm);
}
static __init int conflicting_nodes(unsigned long start, unsigned long end)
@@ -292,17 +272,6 @@ int __init acpi_scan_nodes(unsigned long
return 0;
}
-static int node_to_pxm(int n)
-{
- int i;
- if (pxm2node[n] == n)
- return n;
- for (i = 0; i < 256; i++)
- if (pxm2node[i] == n)
- return i;
- return 0;
-}
-
int __node_distance(int a, int b)
{
int index;
Index: pxm_ver3/include/asm-x86_64/numa.h
===================================================================
--- pxm_ver3.orig/include/asm-x86_64/numa.h 2006-03-27 12:09:17.000000000 +0900
+++ pxm_ver3/include/asm-x86_64/numa.h 2006-03-27 14:05:12.000000000 +0900
@@ -9,7 +9,6 @@ struct bootnode {
};
extern int compute_hash_shift(struct bootnode *nodes, int numnodes);
-extern int pxm_to_node(int nid);
#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
--
Yasunori Goto
^ permalink raw reply [flat|nested] 7+ messages in thread* [Patch:004/004]Unify pxm_to_node id ver.3. (for i386)
2006-03-28 10:12 [Patch:000/004]Unify pxm_to_node id ver.3 Yasunori Goto
` (2 preceding siblings ...)
2006-03-28 10:17 ` [Patch:003/004]Unify pxm_to_node id ver.3.(for x86-64) Yasunori Goto
@ 2006-03-28 10:17 ` Yasunori Goto
3 siblings, 0 replies; 7+ messages in thread
From: Yasunori Goto @ 2006-03-28 10:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Luck, Tony, Andi Kleen, Brown, Len, Linux Kernel ML, ACPI-ML,
linux-ia64, x86-64 Discuss
This is to remove the code of pxm_to_nid_map from i386 code.
And, some of changing Kconfig and dummy function for compile.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
arch/i386/Kconfig | 6 ++++++
arch/i386/kernel/srat.c | 19 ++-----------------
drivers/acpi/Kconfig | 2 +-
include/linux/acpi.h | 8 ++++++++
4 files changed, 17 insertions(+), 18 deletions(-)
Index: pxm_ver3/arch/i386/kernel/srat.c
===================================================================
--- pxm_ver3.orig/arch/i386/kernel/srat.c 2006-01-05 15:43:10.000000000 +0900
+++ pxm_ver3/arch/i386/kernel/srat.c 2006-03-27 14:08:19.000000000 +0900
@@ -39,7 +39,6 @@
#define NODE_ARRAY_OFFSET(x) ((x) % 8) /* 8 bits/char */
#define BMAP_SET(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] |= 1 << NODE_ARRAY_OFFSET(bit))
#define BMAP_TEST(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit)))
-#define MAX_PXM_DOMAINS 256 /* 1 byte and no promises about values */
/* bitmap length; _PXM is at most 255 */
#define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8)
static u8 pxm_bitmap[PXM_BITMAP_LEN]; /* bitmap of proximity domains */
@@ -213,19 +212,11 @@ static __init void node_read_chunk(int n
node_end_pfn[nid] = memory_chunk->end_pfn;
}
-static u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */
-
-int pxm_to_node(int pxm)
-{
- return pxm_to_nid_map[pxm];
-}
-
/* Parse the ACPI Static Resource Affinity Table */
static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
{
u8 *start, *end, *p;
int i, j, nid;
- u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */
start = (u8 *)(&(sratp->reserved) + 1); /* skip header */
p = start;
@@ -235,10 +226,6 @@ static int __init acpi20_parse_srat(stru
memset(node_memory_chunk, 0, sizeof(node_memory_chunk));
memset(zholes_size, 0, sizeof(zholes_size));
- /* -1 in these maps means not available */
- memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
- memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
-
num_memory_chunks = 0;
while (p < end) {
switch (*p) {
@@ -278,9 +265,7 @@ static int __init acpi20_parse_srat(stru
nodes_clear(node_online_map);
for (i = 0; i < MAX_PXM_DOMAINS; i++) {
if (BMAP_TEST(pxm_bitmap, i)) {
- nid = num_online_nodes();
- pxm_to_nid_map[i] = nid;
- nid_to_pxm_map[nid] = i;
+ int nid = acpi_map_pxm_to_node(i);
node_set_online(nid);
}
}
@@ -288,7 +273,7 @@ static int __init acpi20_parse_srat(stru
/* set cnode id in memory chunk structure */
for (i = 0; i < num_memory_chunks; i++)
- node_memory_chunk[i].nid = pxm_to_nid_map[node_memory_chunk[i].pxm];
+ node_memory_chunk[i].nid = pxm_to_node(node_memory_chunk[i].pxm);
printk("pxm bitmap: ");
for (i = 0; i < sizeof(pxm_bitmap); i++) {
Index: pxm_ver3/arch/i386/Kconfig
===================================================================
--- pxm_ver3.orig/arch/i386/Kconfig 2006-03-27 12:09:13.000000000 +0900
+++ pxm_ver3/arch/i386/Kconfig 2006-03-27 14:08:19.000000000 +0900
@@ -144,6 +144,12 @@ config ACPI_SRAT
bool
default y
depends on NUMA && (X86_SUMMIT || X86_GENERICARCH)
+ select ACPI_NUMA
+
+config HAVE_ARCH_PARSE_SRAT
+ bool
+ default y
+ depends on ACPI_SRAT
config X86_SUMMIT_NUMA
bool
Index: pxm_ver3/drivers/acpi/Kconfig
===================================================================
--- pxm_ver3.orig/drivers/acpi/Kconfig 2006-03-27 12:09:14.000000000 +0900
+++ pxm_ver3/drivers/acpi/Kconfig 2006-03-27 14:08:19.000000000 +0900
@@ -162,7 +162,7 @@ config ACPI_THERMAL
config ACPI_NUMA
bool "NUMA support"
depends on NUMA
- depends on (IA64 || X86_64)
+ depends on (X86_32 || IA64 || X86_64)
default y if IA64_GENERIC || IA64_SGI_SN2
config ACPI_ASUS
Index: pxm_ver3/include/linux/acpi.h
===================================================================
--- pxm_ver3.orig/include/linux/acpi.h 2006-03-27 13:56:46.000000000 +0900
+++ pxm_ver3/include/linux/acpi.h 2006-03-27 14:08:19.000000000 +0900
@@ -409,10 +409,18 @@ void acpi_table_print_madt_entry (acpi_t
void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
/* the following four functions are architecture-dependent */
+#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
+#define NR_NODE_MEMBLKS MAX_NUMNODES
+#define acpi_numa_slit_init(slit) do {} while (0)
+#define acpi_numa_processor_affinity_init(pa) do {} while (0)
+#define acpi_numa_memory_affinity_init(ma) do {} while (0)
+#define acpi_numa_arch_fixup() do {} while (0)
+#else
void acpi_numa_slit_init (struct acpi_table_slit *slit);
void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa);
void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma);
void acpi_numa_arch_fixup(void);
+#endif
#ifdef CONFIG_ACPI_HOTPLUG_CPU
/* Arch dependent functions for cpu hotplug support */
--
Yasunori Goto
^ permalink raw reply [flat|nested] 7+ messages in thread