Intel 253668-032US Webcam User Manual


 
Vol. 3 8-61
MULTIPLE-PROCESSOR MANAGEMENT
example also depicts a technique to construct a mask to represent the logical
processors that reside in the same core.
In Example 8-21, the numerical ID value can be obtained from the value extracted
with the mask by shifting it right by shift count. Algorithms below do not shift the
value. The assumption is that the SubID values can be compared for equivalence
without the need to shift.
Example 8-21. Pseudo Code Depicting Three-level Extraction Algorithm
For Each local_APIC_ID{
// Calculate SMT_MASK, the bit mask pattern to extract SMT_ID,
// SMT_MASK is determined using topology enumertaion parameters
// from CPUID leaf 0BH (Example 8-19);
// otherwise, SMT_MASK is determined using CPUID leaf 01H and leaf 04H (Example 8-20).
// This algorithm assumes there is symmetry across core boundary, i.e. each core within a
// package has the same number of logical processors
// SMT_ID always starts from bit 0, corresponding to the right-most bit-field
SMT_ID = APIC_ID & SMT_MASK;
// Extract CORE_ID:
// CORE_MASK is determined in Example 8-19 or Example 8-20
CORE_ID = (APIC_ID & CORE_MASK) ;
// Extract PACKAGE_ID:
// Assume single cluster.
// Shift out the mask width for maximum logical processors per package
// PACKAGE_MASK is determined in Example 8-19 or Example 8-20
PACKAGE_ID = (APIC_ID & PACKAGE_MASK) ;
}
Example 8-22. Compute the Number of Packages, Cores, and Processor Relationships in a MP
System
a) Assemble lists of PACKAGE_ID, CORE_ID, and SMT_ID of each enabled logical processors
//The BIOS and/or OS may limit the number of logical processors available to applications
// after system boot. The below algorithm will compute topology for the processors visible
// to the thread that is computing it.
// Extract the 3-levels of IDs on every processor
// SystemAffinity is a bitmask of all the processors started by the OS. Use OS specific APIs to
// obtain it.
// ThreadAffinityMask is used to affinitize the topology enumeration thread to each processor