Commit b3dc1acc authored by Erich Focht's avatar Erich Focht Committed by David Mosberger

[PATCH] ia64: 2.5.44 NUMA fixups

Dear David,

please find attached two patches for the latest 2.5.44-ia64. They fix
some problems and simplify things a bit.

remove_nodeid-2.5.44.patch:
This comes from Kimi. In 2.5.44 we suddenly had two definitions for
numa_node_id(), one was IA64 specific (local_cpu_data->nodeid) while
the other one is now platform independent:
__cpu_to_node(smp_processor_id()). After some discussions we decided
to remove the nodeid from the local_cpu_data and keep the definition of
all other platforms. With using the cpu_to_node_map[] we are also
faster when doing multiple lookups, as all node ids come in a single
cache line (which is not bounced around, as it's content is only
read).


ia64_topology_fixup-2.5.44.patch:
I'm following here the latest fixup for i386 from Matthew Dobson. The
__node_to_cpu_mask() macro now accesses an array which is initialized
after the ACPI CPU discovery. It also simplifies
__node_to_first_cpu(). A compiler warning has been fixed, too.


Please apply these to your kernel tree.
parent a376ed89
......@@ -647,7 +647,6 @@ cpu_init (void)
cpu_info = cpu_data + ((char *) &__get_cpu_var(cpu_info) - __per_cpu_start);
#ifdef CONFIG_NUMA
cpu_info->node_data = get_node_data_ptr();
cpu_info->nodeid = boot_get_local_nodeid();
#endif
/*
......
......@@ -430,30 +430,39 @@ smp_build_cpu_map (void)
#ifdef CONFIG_NUMA
char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
/* on which node is each logical CPU (one cacheline even for 64 CPUs) */
volatile char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
/* which logical CPUs are on which nodes */
volatile unsigned long node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
/*
* Build cpu to node mapping.
* Build cpu to node mapping and initialize the per node cpu masks.
*/
void __init
build_cpu_to_node_map (void)
{
int cpu, i;
int cpu, i, node;
for(node=0; node<MAX_NUMNODES; node++)
node_to_cpu_mask[node] = 0;
for(cpu = 0; cpu < NR_CPUS; ++cpu) {
/*
* All Itanium NUMA platforms I know use ACPI, so maybe we
* can drop this ifdef completely. [EF]
*/
#ifdef CONFIG_ACPI_NUMA
node = -1;
for (i = 0; i < NR_CPUS; ++i)
if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
cpu_to_node_map[cpu] = node_cpuid[i].nid;
node = node_cpuid[i].nid;
break;
}
#else
# error Fixme: Dunno how to build CPU-to-node map.
#endif
cpu_to_node_map[cpu] = node;
if (node >= 0)
node_to_cpu_mask[node] |= (1UL << cpu);
}
}
......
......@@ -21,7 +21,9 @@
# define NR_MEMBLKS (NR_NODES * 8)
#endif
extern char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
#include <linux/cache.h>
extern volatile char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
extern volatile unsigned long node_to_cpu_mask[NR_NODES] __cacheline_aligned;
/* Stuff below this line could be architecture independent */
......
......@@ -179,7 +179,6 @@ struct cpuinfo_ia64 {
#endif
#ifdef CONFIG_NUMA
struct ia64_node_data *node_data;
int nodeid;
#endif
};
......@@ -192,10 +191,6 @@ DECLARE_PER_CPU(struct cpuinfo_ia64, cpu_info);
#define local_cpu_data (&__get_cpu_var(cpu_info))
#define cpu_data(cpu) (&per_cpu(cpu_info, cpu))
#ifdef CONFIG_NUMA
#define numa_node_id() (local_cpu_data->nodeid)
#endif
extern void identify_cpu (struct cpuinfo_ia64 *);
extern void print_cpu_info (struct cpuinfo_ia64 *);
......
......@@ -15,12 +15,22 @@
#include <asm/acpi.h>
#include <asm/numa.h>
#include <asm/smp.h>
/* Returns the number of the node containing CPU 'cpu' */
#ifdef CONFIG_NUMA
#define __cpu_to_node(cpu) cpu_to_node_map[cpu]
/*
* Returns the number of the node containing CPU 'cpu'
*/
#define __cpu_to_node(cpu) (int)(cpu_to_node_map[cpu])
/*
* Returns a bitmask of CPUs on Node 'node'.
*/
#define __node_to_cpu_mask(node) (node_to_cpu_mask[node])
#else
#define __cpu_to_node(cpu) (0)
#define __node_to_cpu_mask(node) (phys_cpu_present_map)
#endif
/*
......@@ -41,34 +51,8 @@
/*
* Returns the number of the first CPU on Node 'node'.
* Slow in the current implementation.
* Who needs this?
*/
/* #define __node_to_first_cpu(node) pool_cpus[pool_ptr[node]] */
static inline int __node_to_first_cpu(int node)
{
int i;
for (i=0; i<NR_CPUS; i++)
if (__cpu_to_node(i)==node)
return i;
BUG(); /* couldn't find a cpu on given node */
return -1;
}
/*
* Returns a bitmask of CPUs on Node 'node'.
*/
static inline unsigned long __node_to_cpu_mask(int node)
{
int cpu;
unsigned long mask = 0UL;
for(cpu=0; cpu<NR_CPUS; cpu++)
if (__cpu_to_node(cpu) == node)
mask |= 1UL << cpu;
return mask;
}
#define __node_to_first_cpu(node) (__ffs(__node_to_cpu_mask(node)))
/*
* Returns the number of the first MemBlk on Node 'node'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment