Can't have all threads (HT) from the CPU

I'm testing this board D525mw (https://ark.intel.com/products/48952/Intel-Desktop-Board-D525MW) along sysctl to try understanding SMP and HT in FreeBSD. This motherboard has 2 cores and 4 threads per core.

If I set loader.conf
Code:
machdep.hyperthreading_allowed=1
kern.smp.disabled=1
lscpu returns:
Total CPU(s): 1
But I expected 4 total CPUs.

If I set
Code:
machdep.hyperthreading_allowed=0
kern.smp.disabled=0
lscpu returns:
Total CPU(s): 2
This is what I expected as result, OK.

But if I set
Code:
machdep.hyperthreading_allowed=1
kern.smp.disabled=0
lscpu returns:
Total CPU(s): 4
But I expected to see "Total CPU(s): 8"


What's really happening? System is not using SMP sometimes despite my command? Or it's using SMP but limiting HT to 2 threads per core?
There's any general limitation of total number of threads in FreeBSD or hardware specific limitations?

It's difficult to state what's really happening because system (at least on the interface) doesn't differentiate what are the threads or the cores in the output.

Thanks!
 
kern.smp.disabled=1 will limit you to single active core, regardless of what set for machdep.hyperthreading_allowed.

Also you can use sysctl hw.ncpu to see the number of active CPUs.
 
I'm testing this board D525mw
... which has an Intel D525 atom CPU, same thing I have at home ...

This motherboard has 2 cores and 4 threads per core.
No. The motherboard has one socket (one physical chip), which in turn has two cores. Each core has 2 hardware threads using hyperthreading, for a total of 4 threads total.

It's difficult to state what's really happening because system (at least on the interface) doesn't differentiate what are the threads or the cores in the output.
That is actually really easy to find out after booting, by looking at dmesg (or equivalently /var/log/messages). Here is a sample from my machine at home (exact same CPU chip, except in a JetWay board):
Code:
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.2-RELEASE-p4 #0: Thu Sep 27 07:46:01 UTC 2018
    root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386
FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM 6.0.0)
VT(vga): resolution 640x480
CPU: Intel(R) Atom(TM) CPU D525   @ 1.80GHz (1800.02-MHz 686-class CPU)
  Origin="GenuineIntel"  Id=0x106ca  Family=0x6  Model=0x1c  Stepping=10
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x40e31d<SSE3,DTES64,MON,DS_CPL,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE>
  AMD Features=0x20100000<NX,LM>
  AMD Features2=0x1<LAHF>
  TSC: P-state invariant, performance statistics
real memory  = 4294967296 (4096 MB)
avail memory = 3122774016 (2978 MB)
Event timer "LAPIC" quality 100
ACPI APIC Table: <021512 APIC1353>
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 hardware threads
Since to my knowledge, this CPU does not do speculative execution, a lot of the recent security vulnerabilities do not apply to it, although some do.
 
Back
Top