Brendan wrote:Hi,
You're comparing "number of APIC IDs reserved for the chip/package" to "number of factory configured logical CPUs". For a quad-core CPU with hyper-threading, Intel would reserve 8 APIC IDs and have 8 factory configured logical CPUs. For the same silicon with hyper-threading factory-disabled, the circuits for routing interrupts to APICs (and determining which range of APIC IDs to use for the chip/package in multi-chip situations) is probably exactly the same, and it's too much hassle for Intel to modify it just to make things a little cleaner, so you end up with the same number of APIC IDs reserved for the chip/package and less factory configured logical CPUs.
Still confused... If level 4 EAX[31:26] + 1 is "number of APIC IDs reserved for the chip/package" including possible HT variant then why level 1 EBX[23:16] "number of logical processors per physical processor package" shows 16.
I would expect that if Lynnfield hax maximum 4 cores + HT option I should get
level 1 EBX[23:16] = 8
level 4 EAX[31:26] = 7
and if Lynnfield has maximum 8 cores + HT option I should get
level 1 EBX[23:16] = 16
level 4 EAX[31:26] = 15
In other intel doc the level 4 EAX[31:26] is described as "maximum number of addresable IDs (core_id) that can be used to enumerate differentprocessor cores in a physical package." So it doesn't count if has HT.
then if I would expect that if Lynnfield hax maximum 4 cores + HT option I should get
level 1 EBX[23:16] = 8
level 4 EAX[31:26] = 3
and if Lynnfield has maximum 8 cores + HT option I should get
level 1 EBX[23:16] = 16
level 4 EAX[31:26] = 7
this case match my reading but I don't know about 8-core lynnfileld CPU
Level 11 has two sublevels that changes meaning of EBX[15:0]
ECX=0 for threads and ECX=1 for cores. So I expect that in 1st case
EBX[15:0] is correctly named as "number of factory-configured logical processors" (per core) - returned 1 because I don't have HT. If I have HT I should see 2 here.
In 2nd case it should be called "number of factory-configured cores" (per chip) because it's executed at core level. As it return 4 it seems to be right. I would need to collect CPUID data from some HT enabled CPU to see the difference but unfortunatelly I don't know anybody with such CPU. Within a month one of my friend will upgrade to Sandybridge so I'll got some new data...
Brendan wrote:
For an application/process running on an OS that doesn't support SMP, there's no real reason to care and you probably shouldn't bother doing any of it.
I'm doing just CPU info tool not the OS. I wish it could display accurate info about core count regardless the OS it actually is running. For older CPUs I can recognize if it's P4HT or C2D without HT so I can display cores cound even if e.g. cpu-z display only 1. Of course then I will not try to read DTS from all cores but only one.
Brendan wrote:
I do it exactly as I described above in my 2 part explanation. There's a few details I skipped though - I start all the CPUs running beforehand, and each CPU executes CPUID and does topology detection separately
That's I missed before...
Brendan wrote:
The RSDT/XSDT, the MADT and the SRAT are all relatively easy to understand and parse; and you can ignore all the other ACPI tables for now.
Well it's my task for future to learn read ACPI. In case of no OS services how can I get this data? Is there some BIOS call or do I need to grab it somewhere from physical memory?
Brendan wrote:
Not really. There's 2 problems with MSRs: they're model specific, and none of the MSRs are intended to be used for getting information about CPUs.
Of course they are model specific, I'm handling it to get multiplier, FSB, DTS and other info and it must be separated for different CPU families and vendors. Otherwise improper MSR reading cause crash...
But if there's nothing interesting about cores then I don't care...
Brendan wrote:
The CPUID instruction is an ugly mess - lack of foresight by CPU designers and no cooperation between competing CPU manufacturers has lead to several different ways of doing the same thing (for CPU topology detection and cache detection). Then you throw errata on top of that (e.g. different CPUs reporting wrong information via. CPUID) and it gets even worse.
Unfortunatelly it happen to most of new hardware. IBM was set wide standards of PC that was respected for years but now everyone make his proprietary HW and closed sourced drivers only for windows (with some light exceptions). In last years it seems that AMD supply better docs. One of my fried is working on coreboot and he appreciated what AMD did for them...