Page MenuHomeFreeBSD

Fix various issues with commit 28dd6730a5d6, 8cc3815f02be

Authored by mhorne on Jul 19 2021, 8:58 PM.
Referenced Files
Unknown Object (File)
Wed, Jul 3, 8:50 PM
Unknown Object (File)
Tue, Jun 25, 12:58 AM
Unknown Object (File)
Fri, Jun 21, 11:35 PM
Unknown Object (File)
May 22 2024, 7:05 PM
Unknown Object (File)
Apr 26 2024, 1:55 AM
Unknown Object (File)
Apr 26 2024, 1:55 AM
Unknown Object (File)
Apr 26 2024, 1:55 AM
Unknown Object (File)
Apr 25 2024, 7:25 PM



Due to a mis-merge, the committed version never called
pmu_parse_event(), or set pm->pm_ev. However, this field shouldn't be
used to carry the actual pmc event code anyway, as it is expected to
contain the index into the pmu event array (otherwise, it breaks event
name lookup in pmclog_get_event()). Add a new MD field,
pm_md.pm_md_config, to pass the event code to arm64_allocate_pmc().

Additionally, the change made to pmc_md_op_pmcallocate was incorrect, as
this is a union, not a struct. Restore the proper padding.

Test Plan

Verified that the correct event codes are being written to the config registers by enabling the hwpmc ktr(4) tracepoints.

Diff Detail

rG FreeBSD src repository
Lint Not Applicable
Tests Not Applicable

Event Timeline


Assuming there's no issue with using C11 anonymous structs... I found at least one other recent commit doing so.


Is this used by userspace? It's a union, so this would change the size. (The old code seems to assume it's a struct)


Yes, this is visible to userspace. It was my recent change 8cc3815f02be that mistakenly treated it as a struct, so this restores the previous size.

LGTM. The changes are similar to the PPC64 ones, in D31109.

This revision is now accepted and ready to land.Jul 20 2021, 2:08 PM
mhorne retitled this revision from Fix various issues with commit 28dd6730a5d6 to Fix various issues with commit 28dd6730a5d6, 8cc3815f02be.Jul 20 2021, 2:10 PM

Seeing the title change reminded me. It would be useful if you provided at least a tiny bit more context here, even if it is to just mention hwpmc so that git log --oneline is a bit more useful.