2005-04-17 06:20:36 +08:00
|
|
|
#ifndef _ASM_X86_64_TOPOLOGY_H
|
|
|
|
#define _ASM_X86_64_TOPOLOGY_H
|
|
|
|
|
|
|
|
|
2005-06-23 15:08:06 +08:00
|
|
|
#ifdef CONFIG_NUMA
|
2005-04-17 06:20:36 +08: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-23 06:21:34 +08:00
|
|
|
#define node_to_first_cpu(node) (first_cpu(node_to_cpumask[node]))
|
2005-04-17 06:20:36 +08:00
|
|
|
#define node_to_cpumask(node) (node_to_cpumask[node])
|
2007-07-22 05:23:39 +08:00
|
|
|
#define pcibus_to_node(bus) ((struct pci_sysdata *)((bus)->sysdata))->node
|
2005-06-23 15:08:18 +08:00
|
|
|
#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-11-06 00:25:53 +08:00
|
|
|
#define numa_node_id() read_pda(nodenumber)
|
|
|
|
|
2005-04-17 06:20:36 +08: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 16:14:08 +08:00
|
|
|
.child = NULL, \
|
2005-04-17 06:20:36 +08:00
|
|
|
.groups = NULL, \
|
|
|
|
.min_interval = 8, \
|
|
|
|
.max_interval = 32, \
|
|
|
|
.busy_factor = 32, \
|
|
|
|
.imbalance_pct = 125, \
|
2005-06-26 05:57:13 +08:00
|
|
|
.cache_nice_tries = 2, \
|
|
|
|
.busy_idx = 3, \
|
|
|
|
.idle_idx = 2, \
|
2005-06-26 05:57:21 +08:00
|
|
|
.newidle_idx = 0, \
|
2005-06-26 05:57:13 +08:00
|
|
|
.wake_idx = 1, \
|
2005-06-26 05:57:19 +08:00
|
|
|
.forkexec_idx = 1, \
|
2005-04-17 06:20:36 +08:00
|
|
|
.flags = SD_LOAD_BALANCE \
|
2005-06-26 05:57:19 +08:00
|
|
|
| SD_BALANCE_FORK \
|
2005-04-17 06:20:36 +08:00
|
|
|
| SD_BALANCE_EXEC \
|
2006-12-10 18:20:29 +08:00
|
|
|
| SD_SERIALIZE \
|
2005-04-17 06:20:36 +08:00
|
|
|
| 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 19:04:36 +08:00
|
|
|
#ifdef CONFIG_SMP
|
2006-06-26 19:58:17 +08:00
|
|
|
#define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id)
|
|
|
|
#define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id)
|
2007-10-16 16:24:04 +08:00
|
|
|
#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
|
2007-10-16 16:24:05 +08:00
|
|
|
#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
|
2006-06-27 17:54:42 +08: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 19:04:36 +08:00
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm-generic/topology.h>
|
|
|
|
|
2006-03-27 17:15:22 +08:00
|
|
|
extern cpumask_t cpu_coregroup_map(int cpu);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|