Summary: | ATOMIC_OP_NEEDS_MEMORY_BARRIER doesn't play well with ThreadSanitizer | ||
---|---|---|---|
Product: | cairo | Reporter: | Nathan Froyd <froydnj> |
Component: | general | Assignee: | Chris Wilson <chris> |
Status: | RESOLVED FIXED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | medium | CC: | freedesktop |
Version: | unspecified | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | patch |
Description
Nathan Froyd
2015-05-04 15:38:48 UTC
If you have a patch to migrate over to better compiler intrinsics, please do share! I presume you have modern gcc/clang in mind? I can certainly put together a patch. What's the minimum supported gcc version? You have to assume someone will try compiling on Solaris and complain... Basically do: #if HAS_GCC(5,0) #define COMPILER_HAS_ATOMIC #endif #if COMPILER_HAS_ATOMICS /* Use modern version: even include a lesson on ThreadSanitizer */ #else /* The current file */ #endif Change as required. If the current set of operations are not sufficient, or if there are places in the code not adhering to even the current rules, please do those as follow up patches. They would be good examples of ThreadSantizer at work... Created attachment 115535 [details] [review] patch Here's a first cut. I haven't run this through TSan yet. Any feedback on coding style, naming, etc. would be appreciated. Looks good to me. Something that is missing in that file is that we really should do #if HAVE_CXX11_ATOMIC_PRIMITIVES #elif HAVE_INTEL_ATOMIC_PRIMITIVES #elif /* blah */ #endif Would you also be able to take a look at improving HarfBuzz (and fontconfig, which copied the atomic ops from HarfBuzz; but I can do that part myself): https://bugs.freedesktop.org/show_bug.cgi?id=90305 (In reply to Chris Wilson from comment #5) > Looks good to me. Something that is missing in that file is that we really > should do > > #if HAVE_CXX11_ATOMIC_PRIMITIVES > #elif HAVE_INTEL_ATOMIC_PRIMITIVES > #elif /* blah */ > #endif I could do that as a followup patch. Where do standalone patches like that get sent? A bug in bugzilla, or straight to the mailing list? (In reply to Behdad Esfahbod from comment #6) > Would you also be able to take a look at improving HarfBuzz (and fontconfig, > which copied the atomic ops from HarfBuzz; but I can do that part myself): > > https://bugs.freedesktop.org/show_bug.cgi?id=90305 Sure, I could look at that. I haven't seen any HarfBuzz bits come up when running Firefox through TSan, but it's entirely possible that we only use HarfBuzz on a single thread. Yes, Firefox uses HarfBuzz with no threading primitives and from a single thread. Patches are welcome as bugzilla attachments or github pull requests. FWIW, this patch does fix the races seen with _cario_atomic_{int,ptr}_get. So if y'all are happy with it, I think it's ready to go. Ping. Is there anything I need to do here to move this forward? Looks good to me, and with Chris' ack in #5 I've gone ahead and pushed to trunk: To ssh://git.cairographics.org/git/cairo d1dda5e..5d150ee master -> master Thanks for this contribution Nathan. You're welcomed to post follow up patches as new bugzilla tickets, but I tend to keep a closer eye on the mailing list so if you need speedier action on a ticket you can generally catch my attention there. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.