CVSROOT: /cvs Module name: src Changes by: d...@cvs.openbsd.org 2020/03/16 21:09:04
Modified files: sys/arch/amd64/amd64: identcpu.c Log message: rework amd (not intel) smt/core/package detection. the previous code relied on newer cpus having properly filled in values for som e new cpuid fields, but these are definitely not filled in properly if you're running in a certain type of virtual machine, which meant a lot of cores were misidentified as threads. this new code follows what most other operating systems seem to do. they read the "initial local apic id", which is globally unique in a system, and cut it up into the package, core, and smt values. the line between a package and the cores/threads inside a package is determined by the "ApicIdSize". once the package is masked off, the remaining core/thread ids is divided up by the ThreadsPerCore value. the latter defaults to 1, unless we're on a newer (eg, zen) chip that provides a higher value. this seems to work well across a variety of machines of different vintages. thanks to mark patruck, hrvoje popovski, and sthen@ for a lot of testing. ok sthen@