3

The following is what I am doing to tell whether a processor does support HT or not, regardless of whether it is enabled or disabled:

# dmidecode -t processor | grep "Hardware Thread" | wc -l

If result is 0, then the processor does not support HT. If result is > 0, then it does.

However, I'm not so sure if this is universally reliable. I've checked this at least with Ubuntu 16.04, 18.04, and SLES 12, with different Intel processors on a few servers (Xeons) and laptops (e.g. Core i5), and works well there. But would it reliably work for any processor (e.g. AMDs, even ARM maybe?) and in all distributions, by just checking whether dmidecode lists that exact text, "Hardware Thread"? Is there a safer way?

From what I can tell, for sure the HT flag listed by lscpu is not at all the way to go, because it gets listed even for a core i5 processor, which does not support HT.

PS. The following posts do float around this topic, but whether Hyperthreading is enabled or not is a different matter: Checking if HyperThreading is enabled or not?, How can I test if Ubuntu activated hyperthreading?

1 Answer 1

4

As you surmise, the ht flag isn’t a reliable indicator: it doesn’t signify hyper-threading support, it indicates “that the physical package is capable of supporting Intel Hyper-Threading Technology and/or multiple cores”.

“Hardware Thread” in the dmidecode output corresponds to a specific flag in the processor characteristics value provided by SMBIOS (see section 7.5.9), and that is supposed to reliably indicate support for hardware threads, not all forms of single-package multi-processing. Thus on platforms with an SMBIOS,

dmidecode -t processor | grep -q "Hardware Thread"

is as reliable an indicator as the underlying SMBIOS information.

Incidentally, you don’t need to use wc:

if dmidecode -t processor | grep -q "Hardware Thread"; then echo HT supported; fi
1
  • Thanks, definitely! Used the wc only because I wanted the status in a variable to check later probably more than once within a script
    – Raulinbonn
    Feb 12, 2020 at 11:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .