Page MenuHomeFreeBSD

hwpmc: fix performance issues
ClosedPublic

Authored by wma on Sep 20 2021, 11:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 22, 9:00 AM
Unknown Object (File)
Wed, Sep 18, 5:07 AM
Unknown Object (File)
Wed, Sep 18, 12:49 AM
Unknown Object (File)
Tue, Sep 17, 10:22 AM
Unknown Object (File)
Mon, Sep 16, 11:47 PM
Unknown Object (File)
Sun, Sep 15, 9:01 PM
Unknown Object (File)
Tue, Sep 10, 10:52 PM
Unknown Object (File)
Sun, Sep 8, 8:01 PM
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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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
1027–1030

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.