Intel IA-32 Manuale Utente

Pagina di 636
7-38 Vol. 3A
MULTIPLE-PROCESSOR MANAGEMENT
7.10.3
Algorithm for Three-Level Mappings of APIC_ID
Software can gather the initial APIC_IDs for each logical processor supported by the operating
system at runtime
4
 and extract identifiers corresponding to the three levels of sharing topology
(package, core, and SMT). The algorithms below focus on a non-clustered MP system for
simplicity. They do not assume initial APIC_IDs are contiguous or that all logical processors on
the platform are enabled.
Intel supports multi-threading systems where all physical processors report identical values in
CPUID.1:EBX[23:16]), CPUID.4:EAX[31:26], and CPUID.4:EAX[25:14]. The algorithms
below assume the target system has symmetry across physical package boundaries with respect
to the number of logical processors per package, number of cores per package, and cache
topology within a package.
The extraction algorithm (for three-level mappings of an initial APIC_ID) uses the following
support routines (Example 7-1):
1.
Detect capability for hardware multi-threading support in the processor.
2.
Identify the maximum number of logical processors in a physical processor package. This
is used to determine the topological relationship between logical processors and the
physical package.
3.
Identify the maximum number of processor cores in a physical processor package. This is
used to determine the topological relationship between processor cores and the physical
package.
4.
Extract the initial APIC ID for the logical processor where the current thread is executing.
5.
Calculate a mask from the maximum count that the bit field can represent.
6.
Use full 8-bit ID and mask to extract sub-field IDs.
Example 7-1
Support Routines for Detecting Hardware Multi-Threading and 
Identifying the Relationships Between Package, Core and Logical 
Processors
1.
Detect support for Hardware Multi-Threading Support in a processor.
//  Returns a non-zero value if CPUID reports the presence of hardware multi-threading 
//  support in the physical package where the current logical processor is located. 
//  This does not guarrantee BIOS or OS will enable all logical processors in the physical 
//  package and make them available to applications. 
//  Returns zero if hardware multi-threading is not present. 
#define HWMT_BIT 0x10000000
4. As noted in Section 7.7 and Section 7.10.2, the number of logical processors supported by the OS at
runtime may be less than the total number logical processors available in the platform hardware.