Page MenuHomeFreeBSD

Fix various issues with commit 28dd6730a5d6, 8cc3815f02be
ClosedPublic

Authored by mhorne on Jul 19 2021, 8:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 4, 11:33 PM
Unknown Object (File)
Tue, Oct 22, 8:29 AM
Unknown Object (File)
Mon, Oct 14, 8:41 PM
Unknown Object (File)
Mon, Oct 14, 8:09 PM
Unknown Object (File)
Oct 3 2024, 12:21 PM
Unknown Object (File)
Oct 2 2024, 5:51 AM
Unknown Object (File)
Sep 23 2024, 2:30 AM
Unknown Object (File)
Sep 22 2024, 8:50 AM
Subscribers

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
rG FreeBSD src repository
Lint
Lint Not Applicable
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
46

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
46

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.