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?