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
F173255362: D57758.id180340.diff
Thu, Sep 24, 6:09 PM
Unknown Object (File)
Mon, Sep 14, 12:25 AM
Unknown Object (File)
Fri, Sep 11, 3:12 AM
Unknown Object (File)
Thu, Sep 10, 6:32 PM
Unknown Object (File)
Wed, Sep 9, 8:43 PM
Unknown Object (File)
Wed, Sep 9, 8:43 PM
Unknown Object (File)
Tue, Sep 8, 2:26 AM
Unknown Object (File)
Tue, Sep 8, 2:23 AM
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.