Page MenuHomeFreeBSD

hwpmc: fix IBS fetch and op
ClosedPublic

Authored by afscoelho_gmail.com on Fri, Sep 25, 1:07 AM.
Tags
None
Referenced Files
F173938150: D60004.id187641.diff
Tue, Sep 29, 12:26 PM
F173919183: D60004.id187637.diff
Tue, Sep 29, 8:50 AM
F173910094: D60004.id187639.diff
Tue, Sep 29, 7:11 AM
F173895309: D60004.id187640.diff
Tue, Sep 29, 4:35 AM
F173879226: D60004.diff
Tue, Sep 29, 2:03 AM
F173813167: D60004.diff
Mon, Sep 28, 3:35 PM
Unknown Object (File)
Mon, Sep 28, 11:09 AM
Unknown Object (File)
Sun, Sep 27, 11:25 PM
Subscribers

Details

Summary

Service each IBS unit with a valid bit set when fetch and op share an NMI. Treat the extra NMI that follows as expected.

Test Plan

Test simultaneous IBS fetch and op sampling repeatedly; verify both streams produce samples and no NMIs are left unhandled.

Diff Detail

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

Event Timeline

Summary: hwpmc: fix IBS fetch and op

Service each IBS unit with a valid bit set when fetch and op share an NMI. Treat the extra NMI that follows as expected.

Test Plan:
Validated on fbsd-dev: three scimark4 fetch+op runs produced about 39k fetch and 322k op samples per run, with zero ignored NMIs.

Reviewers: mhorne, pmc

hwpmc: fix IBS fetch and op

Service each IBS unit with a valid bit set when fetch and op share an NMI. Treat the extra NMI that follows as expected.

Test Plan:
Validated on fbsd-dev: three scimark4 fetch+op runs produced about 39k fetch and 322k op samples per run, with zero ignored NMIs.

Reviewers: mhorne, pmc

afscoelho_gmail.com retitled this revision from Summary: hwpmc: fix IBS fetch and op to hwpmc: fix IBS fetch and op.
afscoelho_gmail.com added a reviewer: mhorne.

Add mhorne as a reviewer.

afscoelho_gmail.com edited the test plan for this revision. (Show Details)

Update the test plan wording.

Sure. I admit that I do not see why this is advantageous one way or the other. In either case two NMIs must be processed, no?

sys/dev/hwpmc/hwpmc_ibs.c
734–740

To me, this expresses the intent more clearly.

The issues is that without this patch we lose op samples. Fetch and op share the same NMI, so when both fire together we get a single NMI with both valid bits set.

Since we now service both units on every NMI, op can fire while the handler is running and get serviced there. Its own NMI still arrives after the handler returns, with nothing left to service. pc_nmi_credit claims that one so it doesn't show up as an unknown NMI and panic the box.

afscoelho_gmail.com added inline comments.
sys/dev/hwpmc/hwpmc_ibs.c
734–740

Yes, that's clearer. One small thing: the extra NMI always comes right after the one that serviced both units, so I think the credit should be cleared on every NMI, even one that only services a single unit. Otherwise a credit that never gets used could eat some unrelated NMI later on. I restructured it along the lines you suggested but kept that behavior.

Hi @mhorne , I submitted the patch with your suggestion, could you take a look? Thanks for your time.

This revision is now accepted and ready to land.Mon, Sep 28, 5:40 PM
This revision was automatically updated to reflect the committed changes.