Page MenuHomeFreeBSD

Use atomic load and stores to ensure that the compiler doesn't optimize away these loops.
ClosedPublic

Authored by imp on Jan 25 2018, 10:17 PM.

Details

Summary

Use atomic load and stores to ensure that the compiler doesn't optimize away these loops. Change boolean to int to match what atomic API supplies. Remove wmb() since the atomic_store_rel() on status.done ensure the prior writes to status.

Coverity caught this, and kib@ suggested these changes. They supposedly also use fewer cycles.

Test Plan

Booted on two different machines.

Diff Detail

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

imp created this revision.Jan 25 2018, 10:17 PM
imp retitled this revision from Use atomic load and stores to ensure that the compiler doesn't optimize away these loops. Change boolean to int to match what atomic API supplies. Remove wmb() since the atomic_store_rel() on status.done ensure the prior writes to status. to Use atomic load and stores to ensure that the compiler doesn't optimize away these loops..Jan 25 2018, 10:19 PM
imp edited the summary of this revision. (Show Details)
imp added reviewers: kib, scottl, jimharris.
kib accepted this revision.Jan 25 2018, 10:27 PM

This also fixes a bug that rmb() was missed between read of status.done and accessing the controller data.

This revision is now accepted and ready to land.Jan 25 2018, 10:27 PM
scottl accepted this revision.Jan 25 2018, 10:37 PM
imp edited the test plan for this revision. (Show Details)Jan 25 2018, 10:43 PM
jimharris accepted this revision.Jan 27 2018, 4:56 PM
This revision was automatically updated to reflect the committed changes.