Page MenuHomeFreeBSD

sys: hwpmc PMU group/multiplex ABI additions
AcceptedPublic

Authored by raghavendra.kt_amd.com on Thu, Jun 18, 7:05 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 7, 5:53 AM
Unknown Object (File)
Tue, Jul 7, 12:11 AM
Unknown Object (File)
Mon, Jul 6, 6:32 AM
Unknown Object (File)
Sun, Jul 5, 8:58 PM
Unknown Object (File)
Sat, Jul 4, 7:25 AM
Unknown Object (File)
Thu, Jul 2, 4:40 AM
Unknown Object (File)
Thu, Jul 2, 4:33 AM
Unknown Object (File)
Thu, Jul 2, 4:33 AM
Subscribers
None

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

Event Timeline

imp added inline comments.
sys/sys/pmc.h
391

So is this new Vxx API then?

This revision is now accepted and ready to land.Wed, Jun 24, 11:42 PM
sys/sys/pmc.h
391

So is this new Vxx API then?

Thank you for the review. Yes.

@raghavendra.kt_amd.com

I'm assuming we are going to multiplex the counters based on the sample 'rate'?

@raghavendra.kt_amd.com

I'm assuming we are going to multiplex the counters based on the sample 'rate'?

Thank you for your reviews and support Ali. Sorry for late reply. It took long time before I could get system wide core counting work.

To answer the question: In this patch series, private core counters' grouping and multiplexing works. Sampling event support is yet to be added.

I do have a systemwide event counting working at "https://github.com/AMDESE/freebsd-src/tree/amdese/feature/pmc/grouping_mux_upstream_v0".

I will clean it up and submit along with your review comments added in other patches and resubmit. ( I hope git-arc supports top up patch)