Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/x86/mp_x86.c
Show First 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | |||||
static void release_aps(void *dummy); | static void release_aps(void *dummy); | ||||
static void cpustop_handler_post(u_int cpu); | static void cpustop_handler_post(u_int cpu); | ||||
static int hyperthreading_allowed = 1; | static int hyperthreading_allowed = 1; | ||||
SYSCTL_INT(_machdep, OID_AUTO, hyperthreading_allowed, CTLFLAG_RDTUN, | SYSCTL_INT(_machdep, OID_AUTO, hyperthreading_allowed, CTLFLAG_RDTUN, | ||||
&hyperthreading_allowed, 0, "Use Intel HTT logical CPUs"); | &hyperthreading_allowed, 0, "Use Intel HTT logical CPUs"); | ||||
static struct topo_node topo_root; | |||||
static int pkg_id_shift; | static int pkg_id_shift; | ||||
static int node_id_shift; | static int node_id_shift; | ||||
static int core_id_shift; | static int core_id_shift; | ||||
static int disabled_cpus; | static int disabled_cpus; | ||||
struct cache_info { | struct cache_info { | ||||
int id_shift; | int id_shift; | ||||
int present; | int present; | ||||
▲ Show 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | |||||
* Then topology is extrapolated on all packages using an | * Then topology is extrapolated on all packages using an | ||||
* assumption that APIC ID to hardware component ID mapping is | * assumption that APIC ID to hardware component ID mapping is | ||||
* homogenious. | * homogenious. | ||||
* That doesn't necesserily imply that the topology is uniform. | * That doesn't necesserily imply that the topology is uniform. | ||||
*/ | */ | ||||
void | void | ||||
topo_probe(void) | topo_probe(void) | ||||
{ | { | ||||
static int cpu_topo_probed = 0; | |||||
struct x86_topo_layer { | struct x86_topo_layer { | ||||
int type; | int type; | ||||
int subtype; | int subtype; | ||||
int id_shift; | int id_shift; | ||||
} topo_layers[MAX_CACHE_LEVELS + 4]; | } topo_layers[MAX_CACHE_LEVELS + 4]; | ||||
struct topo_node *parent; | struct topo_node *parent; | ||||
struct topo_node *node; | struct topo_node *node; | ||||
int layer; | int layer; | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Assign logical CPU IDs to local APICs. | * Assign logical CPU IDs to local APICs. | ||||
*/ | */ | ||||
void | void | ||||
assign_cpu_ids(void) | assign_cpu_ids(void) | ||||
{ | { | ||||
struct topo_node *node; | struct topo_node *node; | ||||
u_int smt_mask; | u_int smt_mask; | ||||
markj: nthreads would be a better name. "Hyperthreading" is Intel's marketing name. | |||||
Done Inline ActionsIt's not counting all threads, though. Just CPUs that advertise the cpu_hyperthread flag. nhyper matches that name and use. I think nthreads would be less clear. n_logical_threads gets closer but becomes wordy. cem: It's not counting all threads, though. Just CPUs that advertise the `cpu_hyperthread` flag. | |||||
smt_mask = (1u << core_id_shift) - 1; | smt_mask = (1u << core_id_shift) - 1; | ||||
/* | /* | ||||
* Assign CPU IDs to local APIC IDs and disable any CPUs | * Assign CPU IDs to local APIC IDs and disable any CPUs | ||||
* beyond MAXCPU. CPU 0 is always assigned to the BSP. | * beyond MAXCPU. CPU 0 is always assigned to the BSP. | ||||
*/ | */ | ||||
mp_ncpus = 0; | mp_ncpus = 0; | ||||
TOPO_FOREACH(node, &topo_root) { | TOPO_FOREACH(node, &topo_root) { | ||||
▲ Show 20 Lines • Show All 1,149 Lines • Show Last 20 Lines |
nthreads would be a better name. "Hyperthreading" is Intel's marketing name.