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