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)
Thu, Mar 28, 2:56 AM
Unknown Object (File)
Feb 24 2024, 9:06 PM
Unknown Object (File)
Dec 20 2023, 3:06 AM
Unknown Object (File)
Nov 19 2023, 1:23 PM
Unknown Object (File)
Nov 13 2023, 8:21 PM
Unknown Object (File)
Sep 28 2023, 5:56 AM
Unknown Object (File)
Sep 3 2023, 6:05 PM
Unknown Object (File)
Aug 25 2023, 11:33 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.