Page MenuHomeFreeBSD

hwpmc: fix performance issues
ClosedPublic

Authored by wma on Sep 20 2021, 11:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 8, 6:34 AM
Unknown Object (File)
Wed, Feb 19, 1:04 PM
Unknown Object (File)
Mon, Feb 17, 1:31 AM
Unknown Object (File)
Feb 1 2025, 1:33 PM
Unknown Object (File)
Feb 1 2025, 1:26 PM
Unknown Object (File)
Feb 1 2025, 1:25 PM
Unknown Object (File)
Jan 23 2025, 7:17 AM
Unknown Object (File)
Jan 21 2025, 3:30 AM
Subscribers
None

Details

Summary

Avoid using atomics as it_wait is guarded by td_lock.

Report threshold calculation is done only if at least one PMC hook
is installed

  • there will be another patch with pmc.soft(3) update

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

wma requested review of this revision.Sep 20 2021, 11:13 AM
wma created this revision.

You should always modify the conter, but only do branch on stuff depending on PMC_HOOK_INSTALLED_ANY

sys/kern/kern_intr.c
1026

the point was to avoid needing to read intr_hwpmc_waiting_report_threshold if hwpmc is not loaded. So this should be:

it->it_waiting++; 
if (PMC_HOOK_INSTALLED_ANY()) {
        if (it->it_waiting >= intr_hwpmc_waiting_report_threshold) {
                PMC_SOFT_CALL_INTR_HLPR(waiting, frame);
        }
}.

or so

OK, so if I got your point, you meant

  • avoid unnecessary branching (if frame != null ...) by having PMC_HOOK_INSTALLED_ANY condition on the top of them, which should hint the core not to execute speculatively anything which us underneath;
  • access intr_hwpmc_waiting_report_threshold cacheline only if at least one hook is loaded;

right?

This revision was not accepted when it landed; it landed in state Needs Review.Sep 23 2021, 5:18 AM
This revision was automatically updated to reflect the committed changes.