2005-04-16 18:20:36 -04:00
|
|
|
#ifndef _ASM_X86_64_TOPOLOGY_H
|
|
|
|
#define _ASM_X86_64_TOPOLOGY_H
|
|
|
|
|
|
|
|
|
2005-06-23 03:08:06 -04:00
|
|
|
#ifdef CONFIG_NUMA
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
#include <asm/mpspec.h>
|
|
|
|
#include <asm/bitops.h>
|
|
|
|
|
|
|
|
extern cpumask_t cpu_online_map;
|
|
|
|
|
|
|
|
extern unsigned char cpu_to_node[];
|
|
|
|
extern cpumask_t node_to_cpumask[];
|
|
|
|
|
|
|
|
#ifdef CONFIG_ACPI_NUMA
|
|
|
|
extern int __node_distance(int, int);
|
|
|
|
#define node_distance(a,b) __node_distance(a,b)
|
|
|
|
/* #else fallback version */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define cpu_to_node(cpu) (cpu_to_node[cpu])
|
|
|
|
#define parent_node(node) (node)
|
2005-12-22 17:21:34 -05:00
|
|
|
#define node_to_first_cpu(node) (first_cpu(node_to_cpumask[node]))
|
2005-04-16 18:20:36 -04:00
|
|
|
#define node_to_cpumask(node) (node_to_cpumask[node])
|
2005-09-12 12:49:24 -04:00
|
|
|
#define pcibus_to_node(bus) ((long)(bus->sysdata))
|
2005-06-23 03:08:18 -04:00
|
|
|
#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus));
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2005-11-05 11:25:53 -05:00
|
|
|
#define numa_node_id() read_pda(nodenumber)
|
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
/* sched_domains SD_NODE_INIT for x86_64 machines */
|
|
|
|
#define SD_NODE_INIT (struct sched_domain) { \
|
|
|
|
.span = CPU_MASK_NONE, \
|
|
|
|
.parent = NULL, \
|
2006-10-03 04:14:08 -04:00
|
|
|
.child = NULL, \
|
2005-04-16 18:20:36 -04:00
|
|
|
.groups = NULL, \
|
|
|
|
.min_interval = 8, \
|
|
|
|
.max_interval = 32, \
|
|
|
|
.busy_factor = 32, \
|
|
|
|
.imbalance_pct = 125, \
|
2005-06-25 17:57:13 -04:00
|
|
|
.cache_nice_tries = 2, \
|
|
|
|
.busy_idx = 3, \
|
|
|
|
.idle_idx = 2, \
|
2005-06-25 17:57:21 -04:00
|
|
|
.newidle_idx = 0, \
|
2005-06-25 17:57:13 -04:00
|
|
|
.wake_idx = 1, \
|
2005-06-25 17:57:19 -04:00
|
|
|
.forkexec_idx = 1, \
|
2005-04-16 18:20:36 -04:00
|
|
|
.per_cpu_gain = 100, \
|
|
|
|
.flags = SD_LOAD_BALANCE \
|
2005-06-25 17:57:19 -04:00
|
|
|
| SD_BALANCE_FORK \
|
2005-04-16 18:20:36 -04:00
|
|
|
| SD_BALANCE_EXEC \
|
|
|
|
| SD_WAKE_BALANCE, \
|
|
|
|
.last_balance = jiffies, \
|
|
|
|
.balance_interval = 1, \
|
|
|
|
.nr_balance_failed = 0, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
[PATCH] Export cpu topology in sysfs
The patch implements cpu topology exportation by sysfs.
Items (attributes) are similar to /proc/cpuinfo.
1) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
represent the physical package id of cpu X;
2) /sys/devices/system/cpu/cpuX/topology/core_id:
represent the cpu core id to cpu X;
3) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
represent the thread siblings to cpu X in the same core;
4) /sys/devices/system/cpu/cpuX/topology/core_siblings:
represent the thread siblings to cpu X in the same physical package;
To implement it in an architecture-neutral way, a new source file,
driver/base/topology.c, is to export the 5 attributes.
If one architecture wants to support this feature, it just needs to
implement 4 defines, typically in file include/asm-XXX/topology.h.
The 4 defines are:
#define topology_physical_package_id(cpu)
#define topology_core_id(cpu)
#define topology_thread_siblings(cpu)
#define topology_core_siblings(cpu)
The type of **_id is int.
The type of siblings is cpumask_t.
To be consistent on all architectures, the 4 attributes should have
deafult values if their values are unavailable. Below is the rule.
1) physical_package_id: If cpu has no physical package id, -1 is the
default value.
2) core_id: If cpu doesn't support multi-core, its core id is 0.
3) thread_siblings: Just include itself, if the cpu doesn't support
HT/multi-thread.
4) core_siblings: Just include itself, if the cpu doesn't support
multi-core and HT/Multi-thread.
So be careful when declaring the 4 defines in include/asm-XXX/topology.h.
If an attribute isn't defined on an architecture, it won't be exported.
Thank Nathan, Greg, Andi, Paul and Venki.
The patch provides defines for i386/x86_64/ia64.
Signed-off-by: Zhang, Yanmin <yanmin.zhang@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-03 06:04:36 -05:00
|
|
|
#ifdef CONFIG_SMP
|
2006-06-26 07:58:17 -04:00
|
|
|
#define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id)
|
|
|
|
#define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id)
|
[PATCH] Export cpu topology in sysfs
The patch implements cpu topology exportation by sysfs.
Items (attributes) are similar to /proc/cpuinfo.
1) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
represent the physical package id of cpu X;
2) /sys/devices/system/cpu/cpuX/topology/core_id:
represent the cpu core id to cpu X;
3) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
represent the thread siblings to cpu X in the same core;
4) /sys/devices/system/cpu/cpuX/topology/core_siblings:
represent the thread siblings to cpu X in the same physical package;
To implement it in an architecture-neutral way, a new source file,
driver/base/topology.c, is to export the 5 attributes.
If one architecture wants to support this feature, it just needs to
implement 4 defines, typically in file include/asm-XXX/topology.h.
The 4 defines are:
#define topology_physical_package_id(cpu)
#define topology_core_id(cpu)
#define topology_thread_siblings(cpu)
#define topology_core_siblings(cpu)
The type of **_id is int.
The type of siblings is cpumask_t.
To be consistent on all architectures, the 4 attributes should have
deafult values if their values are unavailable. Below is the rule.
1) physical_package_id: If cpu has no physical package id, -1 is the
default value.
2) core_id: If cpu doesn't support multi-core, its core id is 0.
3) thread_siblings: Just include itself, if the cpu doesn't support
HT/multi-thread.
4) core_siblings: Just include itself, if the cpu doesn't support
multi-core and HT/Multi-thread.
So be careful when declaring the 4 defines in include/asm-XXX/topology.h.
If an attribute isn't defined on an architecture, it won't be exported.
Thank Nathan, Greg, Andi, Paul and Venki.
The patch provides defines for i386/x86_64/ia64.
Signed-off-by: Zhang, Yanmin <yanmin.zhang@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-03 06:04:36 -05:00
|
|
|
#define topology_core_siblings(cpu) (cpu_core_map[cpu])
|
|
|
|
#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
|
2006-06-27 05:54:42 -04:00
|
|
|
#define mc_capable() (boot_cpu_data.x86_max_cores > 1)
|
|
|
|
#define smt_capable() (smp_num_siblings > 1)
|
[PATCH] Export cpu topology in sysfs
The patch implements cpu topology exportation by sysfs.
Items (attributes) are similar to /proc/cpuinfo.
1) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
represent the physical package id of cpu X;
2) /sys/devices/system/cpu/cpuX/topology/core_id:
represent the cpu core id to cpu X;
3) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
represent the thread siblings to cpu X in the same core;
4) /sys/devices/system/cpu/cpuX/topology/core_siblings:
represent the thread siblings to cpu X in the same physical package;
To implement it in an architecture-neutral way, a new source file,
driver/base/topology.c, is to export the 5 attributes.
If one architecture wants to support this feature, it just needs to
implement 4 defines, typically in file include/asm-XXX/topology.h.
The 4 defines are:
#define topology_physical_package_id(cpu)
#define topology_core_id(cpu)
#define topology_thread_siblings(cpu)
#define topology_core_siblings(cpu)
The type of **_id is int.
The type of siblings is cpumask_t.
To be consistent on all architectures, the 4 attributes should have
deafult values if their values are unavailable. Below is the rule.
1) physical_package_id: If cpu has no physical package id, -1 is the
default value.
2) core_id: If cpu doesn't support multi-core, its core id is 0.
3) thread_siblings: Just include itself, if the cpu doesn't support
HT/multi-thread.
4) core_siblings: Just include itself, if the cpu doesn't support
multi-core and HT/Multi-thread.
So be careful when declaring the 4 defines in include/asm-XXX/topology.h.
If an attribute isn't defined on an architecture, it won't be exported.
Thank Nathan, Greg, Andi, Paul and Venki.
The patch provides defines for i386/x86_64/ia64.
Signed-off-by: Zhang, Yanmin <yanmin.zhang@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-03 06:04:36 -05:00
|
|
|
#endif
|
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
#include <asm-generic/topology.h>
|
|
|
|
|
2006-03-27 04:15:22 -05:00
|
|
|
extern cpumask_t cpu_coregroup_map(int cpu);
|
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
#endif
|