Sample Header Ad - 728x90

How to reliably tell from Linux whether the CPU supports Hyperthreading, even if Hyperthreading is disabled?

3 votes
1 answer
836 views
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](https://linux.die.net/man/1/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: https://unix.stackexchange.com/questions/33450/checking-if-hyperthreading-is-enabled-or-not , [How can I test if Ubuntu activated hyperthreading?](https://askubuntu.com/questions/72999/how-can-i-test-if-ubuntu-activated-hyperthreading)
Asked by Raulinbonn (66 rep)
Feb 12, 2020, 09:44 AM
Last activity: Feb 12, 2020, 01:41 PM