Closed
Bug 1158871
Opened 9 years ago
Closed 9 years ago
TSan: various data races in cairo (_atomic_fetch, _cairo_surface_allocate_unique_id, etc.)
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: froydnj, Assigned: lsalzman)
References
(Blocks 1 open bug)
Details
(Whiteboard: [tsan])
Attachments
(1 file)
10.63 KB,
patch
|
jrmuizel
:
review+
ted
:
review+
|
Details | Diff | Splinter Review |
TSan reports a number of races all related to cairo's atomics support, specifically, this bit: http://mxr.mozilla.org/mozilla-central/source/gfx/cairo/cairo/src/cairo-atomic-private.h#62 While we do define things appropriately to make cairo use atomic operations in some places, cairo has this secondary ATOMIC_OP_NEEDS_MEMORY_BARRIER check for whether loads need memory barriers prior to the actual load being performed. ATOMIC_OP_NEEDS_MEMORY_BARRIER is set by cairo's configure, specifically: http://cgit.freedesktop.org/cairo/tree/build/aclocal.cairo.m4#n203 This hunk seems suspicious to me, as I would have assumed that ARM needs memory barriers since its ordering properties are not as strong as x86. In any event, even *with* ATOMIC_OP_NEEDS_MEMORY_BARRIER defined, TSan will still be unhappy with the code as-is, because TSan believes the load in: __sync_synchronize (); return *x; is still unordered. TSan really wants to see the load come from a compiler intrinsic, something like: return __atomic_load_n(x, __ATOMIC_SEQ_CST); for recent GCC/Clang. There is, unfortunately, no equivalently efficient construct with the __sync* family of builtins. One would have to do something like: return __sync_fetch_and_add(x, 0); I don't know what our policy on patching our local version of cairo is, how willing upstream would be to making ATOMIC_OP_NEEDS_MEMORY_BARRIER go away or fixing the loads under ATOMIC_OP_NEEDS_MEMORY_BARRIER to be observable to TSan.
Updated•9 years ago
|
Assignee: nobody → lsalzman
Comment 1•9 years ago
|
||
It would be great if you could file an upstream bug about this issue.
Reporter | ||
Comment 2•9 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #1) > It would be great if you could file an upstream bug about this issue. Is that comment directed at me or at Lee?
Flags: needinfo?(jmuizelaar)
Comment 3•9 years ago
|
||
(In reply to Nathan Froyd [:froydnj] [:nfroyd] from comment #2) > (In reply to Jeff Muizelaar [:jrmuizel] from comment #1) > > It would be great if you could file an upstream bug about this issue. > > Is that comment directed at me or at Lee? It was directed at you.
Flags: needinfo?(jmuizelaar)
Reporter | ||
Comment 4•9 years ago
|
||
Looking a little closer, the _freed_pool_get thing is actually its own bug; I'm going to file a new one for that.
Summary: TSan: various data races in cairo (_atomic_fetch, _freed_pool_get, _cairo_surface_allocate_unique_id, etc.) → TSan: various data races in cairo (_atomic_fetch, _cairo_surface_allocate_unique_id, etc.)
Reporter | ||
Comment 5•9 years ago
|
||
I wrote a patch for upstream, we'll see if it gets committed, and then I guess we can backport?
Comment 6•9 years ago
|
||
(In reply to Nathan Froyd [:froydnj] [:nfroyd] from comment #5) > I wrote a patch for upstream, we'll see if it gets committed, and then I > guess we can backport? Yes.
Reporter | ||
Comment 7•9 years ago
|
||
The upstream patch has been committed...so now we add it to the ever-growing number of patches in gfx/cairo/, document it in the README, apply the patch, and done?
Flags: needinfo?(jmuizelaar)
Comment 8•9 years ago
|
||
(In reply to Nathan Froyd [:froydnj] [:nfroyd] from comment #7) > The upstream patch has been committed...so now we add it to the ever-growing > number of patches in gfx/cairo/, document it in the README, apply the patch, > and done? Yep.
Flags: needinfo?(jmuizelaar)
Reporter | ||
Comment 9•9 years ago
|
||
Jeff for the cairo part, Ted for the moz.build change.
Attachment #8616004 -
Flags: review?(ted)
Attachment #8616004 -
Flags: review?(jmuizelaar)
Comment 10•9 years ago
|
||
Comment on attachment 8616004 [details] [diff] [review] use new-style __atomic_* primitives in cairo Review of attachment 8616004 [details] [diff] [review]: ----------------------------------------------------------------- I think you could have skipped build peer review for this, but no big deal.
Attachment #8616004 -
Flags: review?(ted) → review+
Updated•9 years ago
|
Attachment #8616004 -
Flags: review?(jmuizelaar) → review+
https://hg.mozilla.org/mozilla-central/rev/73d75d149938
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•