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.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 4, 1:06 PM
Unknown Object (File)
Wed, May 1, 9:05 AM
Unknown Object (File)
Mon, Apr 29, 7:03 AM
Unknown Object (File)
Sun, Apr 28, 7:04 PM
Unknown Object (File)
Fri, Apr 26, 12:35 AM
Unknown Object (File)
Thu, Apr 25, 5:53 PM
Unknown Object (File)
Thu, Apr 25, 2:40 PM
Unknown Object (File)
Thu, Apr 25, 2:39 PM
Subscribers
None

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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14582
Build 14716: arc lint + arc unit

Event Timeline

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.

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
This revision was automatically updated to reflect the committed changes.