Laaca

Czech republic, 25.01.2021, 00:28 |
Detection on processor cores and hyperthreading (Announce) |
Hi! I have done some experimenting with the CPU topology detection.
Please try this utility whether it reports correct number on physical and logical (hyperthreaded) cores of your processor.
(The detection routine is a bit simplified but it should not hurt...) --- DOS-u-akbar! |
roytam
25.01.2021, 06:51
@ Laaca
|
Detection on processor cores and hyperthreading |
> Hi! I have done some experimenting with the CPU topology detection.
> Please try this utility
> whether it reports correct number on physical and logical (hyperthreaded)
> cores of your processor.
> (The detection routine is a bit simplified but it should not hurt...)
for reference:
https://wiki.osdev.org/Detecting_CPU_Topology_(80x86) |
RayeR

CZ, 25.01.2021, 13:55
@ Laaca
|
Detection on processor cores and hyperthreading |
What method described on OSdev you use? In my CPUID I use CPUID way, too scared to mess with ACPI ;) I'll post results later. --- DOS gives me freedom to unlimited HW access. |
Laaca

Czech republic, 25.01.2021, 15:35
@ RayeR
|
Detection on processor cores and hyperthreading |
> What method described on OSdev you use? In my CPUID I use CPUID way, too
> scared to mess with ACPI ;) I'll post results later.
I use the ACPI scan. You have to parse RSDP -> RSDT -> MADT and parse the processor-ACPI records.
It detects all logical cores and it is not so difficult.
The problem is to distinquish whether the reported core is physical core or virtual core from hyperthreading.
The proper approach is to take the ACPI-ID from each reported core (byte value) and parse individual bits. Because 7-2 bits (or 7-1 bits) identifies the physical core and low 0 bit (or 0-1 bits) identifies the hyperthreaded core.
To get the information whether the right division for physical/hyperthreaded bits is 5-3 or 6-2 or 7-1 you should use the CPUID instruction.
I do not use the CPUID but rely on the recomended (or mandatory?) order how the cores should be reported from ACPI. --- DOS-u-akbar! |
RayeR

CZ, 25.01.2021, 17:08
@ Laaca
|
Detection on processor cores and hyperthreading |
And how about systems with disabled ACPI or preACPI? You should also use MPS as fallback. On some new MBs the MPS was removed... --- DOS gives me freedom to unlimited HW access. |
RayeR

CZ, 25.01.2021, 17:09
@ RayeR
|
Detection on processor cores and hyperthreading |
> And how about systems with disabled ACPI or preACPI? You should also use
> MPS as fallback. On some new MBs the MPS was removed...
BTW do you really mean ACPI ID or APIC ID? There may be confusion with those abbrevs... --- DOS gives me freedom to unlimited HW access. |
Laaca

Czech republic, 25.01.2021, 18:36
@ RayeR
|
Detection on processor cores and hyperthreading |
> > And how about systems with disabled ACPI or preACPI? You should also use
> > MPS as fallback. On some new MBs the MPS was removed...
> BTW do you really mean ACPI ID or APIC ID? There may be confusion with
> those abbrevs...
Yes, you are right. My mistake. I meant APIC_processor_ID
On preACPI systems or with disabled ACPI my utility reports - "No ACPI information - one core processor?".
For my purposes is this behaviour OK.
My Pentium 4 machine has hyperthreading technology which can be set in BIOS to be ON or OFF.
What is interresting - if I set OFF - the processor is in the ACPI/MADT table still visible but the "Flags" field is set to 0 (not ON and not capable to be ON). Such entries shall the OSes (and applications) remove from their processor cores list. --- DOS-u-akbar! |
RayeR

CZ, 26.01.2021, 03:00
@ Laaca
|
Detection on processor cores and hyperthreading |
My test results:
core i7-7820HQ (4/8)
Physical processor cores: 4
Logical processor cores: 8
core i7-2600K (4/8, HT disabled in BIOS)
Physical processor cores: 4
Logical processor cores: 4
I don't know how should ACPI behave when core/HT is disabled. --- DOS gives me freedom to unlimited HW access. |