Page MenuHomeFreeBSD

Fix various issues with commit 28dd6730a5d6, 8cc3815f02be
ClosedPublic

Authored by mhorne on Mon, Jul 19, 8:58 PM.

Details

Summary

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

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

sys/arm64/include/pmc_mdep.h
45–46

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

sys/arm64/include/pmc_mdep.h
45

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)

sys/arm64/include/pmc_mdep.h
45

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.Tue, Jul 20, 2:08 PM
mhorne retitled this revision from Fix various issues with commit 28dd6730a5d6 to Fix various issues with commit 28dd6730a5d6, 8cc3815f02be.Tue, Jul 20, 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.