Closed Bug 873799 Opened 13 years ago Closed 13 years ago

I think we need an additional barrier before __sync_lock_test_and_set in Atomics.h

Categories

(Core :: MFBT, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: justin.lebar+bug, Unassigned)

References

Details

Attachments

(1 file)

__sync_lock_test_and_set is only an acquire barrier. I think we need another barrier. But you tell me if this is wrong. Jeff, let me know if you're not ok with Nathan reviewing these patches.
Attached patch Patch, v1Splinter Review
Attachment #751403 - Flags: review?(nfroyd)
This was brought up on bug 732043 comment 55, and responded to in bug 732043 comment 60. I'm not sure I grok this quite fully enough to say anything one way or the other here, fully confidently, but it's totally fine with me playing it safe. :-)
...which is to say, the fix sort of makes sense if I squint, but I might not actually be squinting fully correctly here, so I take that with a bit of a grain of salt.
I don't grok this well enough to say with confidence, either. I'm happy to defer to froydnj. But at the very least, a comment would be nice.
(I also feel like sacrificing perf for strict correctness here is probably the right trade-off, but again, I'm not so comfortable with all this.)
Comment on attachment 751403 [details] [diff] [review] Patch, v1 Review of attachment 751403 [details] [diff] [review]: ----------------------------------------------------------------- It doesn't matter one way or the other to me; I can see arguments both directions. If we start replacing PR_ATOMIC_SET and people start yelling about performance, I guess we can revisit this. ::: mfbt/Atomics.h @@ +375,5 @@ > + > + // __sync_lock_test_and_set is an "acquire" barrier, so loads and stores > + // can't be moved above it (into the space between the beforeStore() and > + // the __sync_lock_test_and_set). > + It makes more sense to me to move this comment prior to the call to beforeStore, something like: // Since __sync_lock_test_and_set is only an acquire barrier, we need this // barrier to ensure that loads and stores don't get moved after the call to it.
Comment on attachment 751403 [details] [diff] [review] Patch, v1 Review of attachment 751403 [details] [diff] [review]: ----------------------------------------------------------------- Here, let's actually r+ that.
Attachment #751403 - Flags: review?(nfroyd) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: