0

System 1: Notebook

Detect the installed CPU:

$ cat /proc/cpuinfo | grep "model name" | head -1
model name  : Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz

The data sheet says:

  • no. of Cores 2
  • no. of Threads 4

Detect Cores and Threads:

$ sudo dmidecode -t processor | grep -E '(Core Count|Thread Count)'
Core Count: 2
Thread Count: 4

Conclusion: The core count and thread count fits with the datasheet.

System 2: Desktop PC

Detect the installed CPU:

$ cat /proc/cpuinfo | grep "model name" | head -1
model name  : Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz

The data sheet says:

  • no. of Cores 4
  • no. of Threads 8

Detect Cores and Threads:

$ sudo dmidecode -t processor | grep -E '(Core Count|Thread Count)'
Core Count: 4
Thread Count: 2

Conclusion: The core count and thread count does not fit with the datasheet.

Questions

  • How to read the Intel datasheets and the output of dmidecode?
  • How many cores do I have?
  • How many thread is each core having?
  • How many thread is the whole system having?

[Edit] Update 1

Desktop PC

$ lscpu | grep -i -E  "^CPU\(s\):|core|socket"
CPU(s):                8
Thread(s) per core:    2
Core(s) per socket:    4
Socket(s):             1

Reading from bottom to top:

  • I have 1 socket with 4 cors, each with 2 threads => 8 threads on total (CPUs)

Conclusion: The core count and thread count fits with the datasheet.

Notebook

$lscpu | grep -i -E  "^CPU\(s\):|core|socket"
CPU(s):                4
Thread(s) per core:    2
Core(s) per socket:    2
Socket(s):             1

Reading from bottom to top:

  • I have 1 socket with 2 cors, each with 2 threads => 4 threads in total (CPUs)

Conclusion: The core count and thread count fits with the datasheet.

[EDIT] Update 2

$ sudo dmidecode -t processor
# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x0041, DMI type 4, 42 bytes
Processor Information
    Socket Designation: SOCKET 0
    Type: Central Processor
    Family: Core i7
    Manufacturer: Intel
    ID: C3 06 03 00 FF FB EB BF
    Signature: Type 0, Family 6, Model 60, Stepping 3
    Flags:
        FPU (Floating-point unit on-chip)
        VME (Virtual mode extension)
        DE (Debugging extension)
        PSE (Page size extension)
        TSC (Time stamp counter)
        MSR (Model specific registers)
        PAE (Physical address extension)
        MCE (Machine check exception)
        CX8 (CMPXCHG8 instruction supported)
        APIC (On-chip APIC hardware supported)
        SEP (Fast system call)
        MTRR (Memory type range registers)
        PGE (Page global enable)
        MCA (Machine check architecture)
        CMOV (Conditional move instruction supported)
        PAT (Page attribute table)
        PSE-36 (36-bit page size extension)
        CLFSH (CLFLUSH instruction supported)
        DS (Debug store)
        ACPI (ACPI supported)
        MMX (MMX technology supported)
        FXSR (FXSAVE and FXSTOR instructions supported)
        SSE (Streaming SIMD extensions)
        SSE2 (Streaming SIMD extensions 2)
        SS (Self-snoop)
        HTT (Multi-threading)
        TM (Thermal monitor supported)
        PBE (Pending break enabled)
    Version: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
    Voltage: 1.1 V
    External Clock: 100 MHz
    Max Speed: 7000 MHz
    Current Speed: 3700 MHz
    Status: Populated, Enabled
    Upgrade: Other
    L1 Cache Handle: 0x0004
    L2 Cache Handle: 0x0005
    L3 Cache Handle: 0x0006
    Serial Number: Not Specified
    Asset Tag: Fill By OEM
    Part Number: Fill By OEM
    Core Count: 4
    Core Enabled: 1
    Thread Count: 2
    Characteristics:
        64-bit capable
Dennis
  • 128
  • 7
  • 1
    Always refer to the datasheet - I had the same CPU (the K version, sometimes I overclock cpu in the spare time) and you have 4 cores and 8 threads, 100% guaranteed. - Usually, each core have 2 threads. I did not know `dmidecode` before today :/ – aPugLife Feb 28 '18 at 09:56
  • Perhaps this link helps you.. ? http://fibrevillage.com/sysadmin/155-how-to-tell-if-cpu-hyperthreading-enabled-on-linux – aPugLife Feb 28 '18 at 09:57
  • Can you show the full `dmidecode` output (no grep) from the host where the mismatch occurs? Maybe there's something in there that explains it. – Håkan Lindqvist Feb 28 '18 at 10:05
  • @Nihvel: Follwing the link, now I used `lscpu | grep -i -E "^CPU\(s\):|core|socket"` to detect the sockets/cores/threads, which works well (See my Update 1) – Dennis Feb 28 '18 at 11:01
  • @HåkanLindqvist: See my Update 2. Since it works with `lscpu`, is seems that `dmidecode` is broken. – Dennis Feb 28 '18 at 11:02
  • @Dennis I'd **guess** it calculates the thread count based on `Core Enabled: 1`. Not sure why enabled would be 1 in the first place, though? – Håkan Lindqvist Feb 28 '18 at 11:05
  • @Dennis Is it correct that only 1 core is enabled? – Håkan Lindqvist Feb 28 '18 at 11:06
  • Oh yes, it shows **Core Enabled: 1**. The link from @nihvel says: *Note: on old machine, dmidecode may not give you CPU detail info such as Core Count, Thread Count etc.* Maybe it is related to this? `cpuinfo` shows, that all cores are enabled. Also `htop` shows 8 threads. – Dennis Feb 28 '18 at 11:22

2 Answers2

0
  • Always refer to the datasheet
  • I had the same CPU (the K version, sometimes I overclock cpu in the spare time) and you have 4 cores and 8 threads, 100% guaranteed.
  • Usually, each core have 2 threads.
  • I did not know dmidecode before today :/

This is what I wrote you as a comment under your question. I also shared a link with you and I'm glad you solved it with the instructions in that page.

This is the link: http://fibrevillage.com/sysadmin/155-how-to-tell-if-cpu-hyperthreading-enabled-on-linux

I read that

Note: on old machine, dmidecode may not give you CPU detail info such as Core Count, Thread Count etc..

but the 4770 is not that old, it is still a great CPU.

Anyway, there are other solutions and I'm happy one of them worked for you!

In the specific: lscpu | grep -i -E "^CPU\(s\):|core|socket"

I take no credit for this, of course! I believe it is just better to write the answer and close it, if you believe you solved!

aPugLife
  • 287
  • 4
  • 13
0

First of all, HTT enabled means that there are two threads per core.

Now, regarding the dmidecode output, something is up as it lists 4 cores, 2 threads output as you initially quoted.

Your full dmidecode output however hints at something that could make sense.

Core Count: 4
Core Enabled: 1
Thread Count: 2

Now, why does it say that only 1 core is enabled? I see two main options:

  • only one core is enabled (the most obvious cause)
    Maybe verify that all cores are actually enabled (UEFI/BIOS Setup setting), but the results from other tools suggests that the cores are enabled.
  • something is wrong in your system's DMI data

The dmidecode output is, as the name of the tool suggests, based on reading system DMI data and decoding it. Hence, it's quite likely that faulty data is not caused by the dmidecode tool itself but by your system's DMI / SMBIOS tables containing incorrect values.

As for the datasheet, it can be trusted regarding the capabilities of the chip itself but that may be answering a slightly different question than what is available in your environment (as there are configuration options that can enable/disable some of the functionality).

Håkan Lindqvist
  • 33,741
  • 5
  • 65
  • 90