OPNsense Forum

English Forums => Hardware and Performance => Topic started by: Ricardo on July 10, 2019, 02:05:20 pm

Title: Hyperthreading is available in 19.1.x?
Post by: Ricardo on July 10, 2019, 02:05:20 pm
Hi all,

is hyperthreading (HTT) available in opnsense 19.1.x? The APU2 I have seems to have HTT capability as per the dmesg CPU feature flags:

CPU: AMD GX-412TC SOC                                (998.15-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0x730f01  Family=0x16  Model=0x30  Stepping=1
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>  -> see at the very end

FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s)

 and sysctl machdep.hyperthreading_allowed: 1 allows it.

Still, I only see 4 physical CPU cores according to:

hw.ncpu: 4

Are there any settings in the OS that prohibit the usage of HTT? Or is this a coreboot BIOS defect?
Title: Re: Hyperthreading is vailable in 19.1.x?
Post by: mimugmail on July 10, 2019, 02:12:44 pm
Isn't this Intel-only .. ?
Title: Re: Hyperthreading is vailable in 19.1.x?
Post by: phoenix on July 10, 2019, 02:51:22 pm
Isn't this Intel-only .. ?
Yes HT Technology is Intel and the equivalent for AMD it is SMT (i.e. multiple threads) but the SOC model above appears to have 4 cores on the chip and that's just physical cores not SMT.
Title: Re: Hyperthreading is vailable in 19.1.x?
Post by: Ricardo on July 11, 2019, 10:27:31 am
Isn't this Intel-only .. ?
Yes HT Technology is Intel and the equivalent for AMD it is SMT (i.e. multiple threads) but the SOC model above appears to have 4 cores on the chip and that's just physical cores not SMT.

I dont know, if HTT is restricted to be present only in intel CPUs or not, but this AMD CPU clearly adcertises that CPU feature flag. If it in fact does not support HTT, it should not advertise such capability.
Title: Re: Hyperthreading is vailable in 19.1.x?
Post by: mimugmail on July 11, 2019, 12:10:43 pm
This has to be checked with the hardware vendor I'd guess
Title: Re: Hyperthreading is vailable in 19.1.x?
Post by: Ricardo on July 11, 2019, 02:46:57 pm
This has to be checked with the hardware vendor I'd guess

Actually, I just checked this strange behavior on my 11 yr old Intel Core 2 Duo machine. No Core 2 duo (or Quad, for the record) ever supported Hyperthreading. Thats for sure. Still, that CPU also reports "HTT" in the dmesg under Freebsd 12.0. But it reports only 2x CPU cores afterwards. So somebody is lying here... either BSD detects it totally wrong, or HTT doesnt mean HyperThreading in the CPU capability flag list.
Title: Re: Hyperthreading is vailable in 19.1.x?
Post by: mimugmail on July 11, 2019, 05:02:08 pm
But for sure, it's not related to OPNsense ...
Title: Re: Hyperthreading is vailable in 19.1.x?
Post by: tillsense on July 11, 2019, 07:54:27 pm
Hi all,

the HTT flag of AMD GX-412TC is multithreading no hyperthreading and no simultaneous multithreading (SMT)! These are 3 different technologies. The APU2 has only 4 real cores.

cheers
till
Title: Re: Hyperthreading is vailable in 19.1.x?
Post by: Ricardo on July 12, 2019, 11:09:55 am
@mimugmail: sorry, but I think it does make sense to raise this topic in the hardware section for opnsense.

@tillsense: What you said, is a little bit unclear to me. I do know what Intel HTT does. I do understand, that HTT is a vendor-branding name for the concept called Symmetric Multithreading, SMT. What I dont really understand, how AMD implemented their own version of SMT.

Does that mean that 1 single core of the GX-412TC can execute 2 threads in parallel, but its not called as Hyperthreading, so the logical CPU count actually equals the physical CPU core count, and the SMT magic is hidden from the OS schedulers eyes?

I am curious whether machdep.hyperthreading_allowed="0" should be set, if HTT is not supported by this CPU, but multithreading is?

Update: according to wikipedia, Jaguar class CPUs (like the GX-412TC) do not feature Clustered MultiThread (CMT), the type of SMT we are speculating as incorrectly marked as HTT capability

Jaguar does not feature clustered multi-thread (CMT), meaning that execution resources are not shared between cores
Source:
https://en.m.wikipedia.org/wiki/Jaguar_(microarchitecture)
Title: Re: Hyperthreading is available in 19.1.x?
Post by: tillsense on July 12, 2019, 08:50:48 pm
Hi all,

there's a good explanation here:

https://stackoverflow.com/questions/14143329/difference-b-w-hyper-threading-and-multithreading

cheers
till
Title: Re: Hyperthreading is available in 19.1.x?
Post by: Ricardo on July 13, 2019, 11:41:47 am
I have read the linked page, but not sure if I understood it fully.

In laymans term,
a) do you think the advertising of CPU feature flag HTT in this specific case is false or correct info?
b) for a 4core CPU should any OS report 4 logical cores or 8?
c) setting sysctl HTT enable/disable should have any effect, or its completely irrelevant, as this CPU is simply a non-HTT architecture?
d) if the OS does not see the SMT parts if this CPU, can the behavior of such CPU be adjusted from OS side, or simply no performance tuning can be set?
Title: Re: Hyperthreading is available in 19.1.x?
Post by: Ricardo on July 17, 2019, 04:17:26 pm
Well, I seem always asking too much...
Title: Re: Hyperthreading is available in 19.1.x?
Post by: mimugmail on July 17, 2019, 05:28:43 pm
You should ask at pcengines forum, there are the experts for this device