Open swatisehgal opened 3 years ago
Sharing some thoughts as ghw contributor.
Since 2018 the linux kernel exposes a pseudofile (https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu) which reports if smt (aka ht) is enabled globally. OTOH, ghw exposes the ht flag per-processor.
I think this is the key decision here: is (or we should model as) smt a per-processor or per-system setting? IOW, can we have SMT enabled only on some cpu complexes and not in other?
At best of my knowledge, if smt is disabled via BIOS or kernel settings, then the processor will NOT report the "ht" flag, thus the two methods yield equivalent results.
I did a bit of extra research and what we have so far is: we also need to distinguish between firmware settings (aka HT enabled/disabled in BIOS or UEFI) and kernel settings.
/proc/cpuinfo
.So in practice:
Currently there is no API to check if hyperthreading is enabled or disabled on a system. There are ways of figuring out if hyperthreading is enabled on a system or not by something like the following:
OR
Would be nice if there was an API to obtain this information directly from a ghw snapshot.