Page MenuHomeFreeBSD

hwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE
ClosedPublic

Authored by mhorne on Jun 1 2021, 4:20 PM.

Details

Summary

Relax the validation added in 24b2f4ea4922 slightly, to allow for raw
event codes obtained from the pmu-events table.

Diff Detail

Repository
rG 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

mhorne requested review of this revision.Jun 1 2021, 4:20 PM
ray added inline comments.
sys/dev/hwpmc/hwpmc_arm64.c
185

I'm not 100% sure, but maybe better to fix requester?

Is there a way to tell if a raw event or event code has been asked for on the syscall boundary? In current architecture the event space is 16bit so we can tell the difference, however we shouldn't assume this will never change.

sys/dev/hwpmc/hwpmc_arm64.c
187

If we are allowing raw events here could we allow the full 16 bit event space? (10 bit in Armv8.0)

Is there a way to tell if a raw event or event code has been asked for on the syscall boundary? In current architecture the event space is 16bit so we can tell the difference, however we shouldn't assume this will never change.

There is no way to tell precisely with the current scheme, but I see two ways we might detect this. We can add a new flag, PMC_F_EVENTCODE_RAW and always apply this for pmu-events allocations, or we can add a field to pmc_md_op_pmcallocate for the raw event code. There seems to be more precedent for the latter.

Provide an MD field, pm_has_raw_event, to inform when the event code is raw.

This revision is now accepted and ready to land.Jun 23 2021, 9:28 PM