Page MenuHomeFreeBSD

sys: hwpmc PMU group/multiplex ABI additions
Needs ReviewPublic

Authored by raghavendra.kt_amd.com on Thu, Jun 18, 7:05 AM.

Details

Summary

Add the userland-visible additions that the hwpmc PMU group/multiplex
work needs:

  • PMC_OP_PMCGROUPCREATE / PMCGROUPADD / PMCGROUPCOMMIT / PMCGROUPRELEASE are appended to enum pmc_ops.
  • PMC_F_GROUP_DEFER, PMC_F_GROUP_MUX, PMC_F_SCALED extend the pmc_op_pmcallocate / pmc_op_pmcrw flag space. PMC_F_GROUP_DEFER is placed at 0x40 because bit 0 (PMC_PP_ENABLE_MSR_ACCESS) is compared against pm->pm_flags by the existing attach path and would otherwise produce spurious EPERM.
  • pmc_op_pmcgroup{create,add,commit,release} and a stable per-owner PMC_HANDLE_DEFERRED_{BASE,MAX} range used by the kernel to give each deferred-group PMC a user-facing id (struct pmc::pm_handle) that survives the assigner rewriting pm_id with a real hardware row.
  • pm_runtime / pm_enabledtime fields are added to pmc_op_pmcrw for scaled reads.
  • struct pmc_process gains pp_pmu_groups (every committed group currently bound to the process), pp_pmu_rot_thread (the per-pp rotation kthread), pp_pmu_rot_cursor (round-robin start position for the next rotation tick), and pp_pmu_rot_* time-slice fields used by the rotation runtime added in patch 0002.

The two PMU-layer aggregates referenced from struct pmc and
struct pmc_process are forward-declared here as the opaque typedefs
pmu_event_t and pmu_group_t (full definitions live in
sys/dev/hwpmc/hwpmc_pmu.h, patch 0002); struct pmc::pm_pmu and
struct pmc_process::pp_pmu_rot_cursor use those typedef spellings.
The forward declarations sit under #ifdef _KERNEL so the userland ABI
is untouched.

PMC_VERSION_API_MINOR is bumped. Strictly additive: existing user
binaries continue to work.
Sponsored by: AMD
Signed-off-by: Raghavendra K T <raghavendra.kt@amd.com>

Diff Detail

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