Page MenuHomeFreeBSD

x86: add cpu_get_pkg_id() and cpu_get_core_id() topology helpers
AbandonedPublic

Authored by afscoelho_gmail.com on Jun 23 2026, 2:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 4, 5:46 AM
Unknown Object (File)
Sat, Aug 1, 1:30 PM
Unknown Object (File)
Sat, Aug 1, 5:40 AM
Unknown Object (File)
Wed, Jul 29, 4:00 AM
Unknown Object (File)
Fri, Jul 24, 2:35 AM
Unknown Object (File)
Sat, Jul 18, 9:08 AM
Unknown Object (File)
Wed, Jul 15, 11:09 PM
Unknown Object (File)
Tue, Jul 14, 7:30 PM
Subscribers

Details

Reviewers
None
Summary

Map logical CPU to physical package (socket) id and physical core id by
shifting per-package and SMT-thread bits out of the APIC id. SMT siblings
share a core id.

Lets drivers for per-socket or per-core hardware bind to real topology,
not NUMA domains or logical CPUs. First consumer: AMD RAPL (package
energy MSRs socket-scoped, per-core energy MSR shared by SMT siblings).

Sponsored by: Advanced Micro Devices (AMD)
MFC after: 2 weeks
Signed-off-by: Andre Silva <andasilv@amd.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 74128
Build 71011: arc lint + arc unit

Event Timeline

Correct stack onto D55603 and add Co-authored-by trailer for ShengYi Hung.

Abandoning: no longer needed. This change added cpu_get_pkg_id()/cpu_get_core_id() topology helpers whose sole consumer was to be the AMD RAPL driver. In the merged hwpmc RAPL class (D58028), the counters are scoped via PMC_CAP_DOMWIDE (one counter per NUMA domain, allocated by pmcstat) rather than by physical package/core topology, so these helpers have no remaining consumer.