Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Issue 111873003: Use Atomic in IsProfilerTimingEnabled (Closed)

Created:
7 years ago by qsr
Modified:
7 years ago
CC:
chromium-reviews, erikwright+watch_chromium.org, glider+watch_chromium.org, timurrrr+watch_chromium.org, bruening+watch_chromium.org
Visibility:
Public.

Description

Use Atomic in IsProfilerTimingEnabled Using atomics with NoBarrier doesn't change the performance, and prevent tsan warnings. R=glider@chromium.org,mark@chromium.org BUG=327722 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=240385

Patch Set 1 #

Total comments: 2

Patch Set 2 : Follow reviw #

Unified diffs Side-by-side diffs Delta from patch set Stats (+18 lines, -16 lines) Patch
M base/tracked_objects.cc View 1 2 chunks +18 lines, -13 lines 0 comments Download
M tools/valgrind/tsan_v2/suppressions.txt View 1 chunk +0 lines, -3 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
qsr
7 years ago (2013-12-11 18:41:06 UTC) #1
Alexander Potapenko
LGTM with a nit. https://codereview.chromium.org/111873003/diff/1/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/111873003/diff/1/base/tracked_objects.cc#newcode75 base/tracked_objects.cc:75: base::subtle::Release_Store(&timing_enabled, current_timing_enabled); This can be ...
7 years ago (2013-12-12 09:43:14 UTC) #2
qsr
+kcc
7 years ago (2013-12-12 09:58:11 UTC) #3
qsr
https://codereview.chromium.org/111873003/diff/1/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/111873003/diff/1/base/tracked_objects.cc#newcode75 base/tracked_objects.cc:75: base::subtle::Release_Store(&timing_enabled, current_timing_enabled); On 2013/12/12 09:43:14, Alexander Potapenko wrote: > ...
7 years ago (2013-12-12 10:06:20 UTC) #4
qsr
-kcc (OoO), +dvyukov@ Dmitriy, would you mind taking a look and check that this is ...
7 years ago (2013-12-12 10:27:01 UTC) #5
Dmitry Vyukov
LGTM
7 years ago (2013-12-12 10:59:16 UTC) #6
Mark Mentovai
LGTM. To clarify: the real difference here is that the static variable is manipulated through ...
7 years ago (2013-12-12 13:51:05 UTC) #7
qsr
On 2013/12/12 13:51:05, Mark Mentovai wrote: > LGTM. > > To clarify: the real difference ...
7 years ago (2013-12-12 13:54:37 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/qsr@chromium.org/111873003/20001
7 years ago (2013-12-12 13:55:16 UTC) #9
Mark Mentovai
qsr wrote: > Not exactly from what I understood. Using an atomic will prevent the ...
7 years ago (2013-12-12 14:04:27 UTC) #10
qsr
On 2013/12/12 14:04:27, Mark Mentovai wrote: > qsr wrote: > > Not exactly from what ...
7 years ago (2013-12-12 14:09:15 UTC) #11
Alexander Potapenko
Mark, for #if defined(THREAD_SANITIZER) we just use a different implementation of atomic functions, which notify ...
7 years ago (2013-12-12 15:26:49 UTC) #12
Mark Mentovai
“volatile ≠ atomic,” that’s kind of what I was getting at… So the non-tsan object ...
7 years ago (2013-12-12 16:17:06 UTC) #13
Alexander Potapenko
On 2013/12/12 16:17:06, Mark Mentovai wrote: > “volatile ≠ atomic,” that’s kind of what I ...
7 years ago (2013-12-12 17:53:59 UTC) #14
commit-bot: I haz the power
Change committed as 240385
7 years ago (2013-12-12 19:29:13 UTC) #15
dvyukov
7 years ago (2013-12-13 06:53:44 UTC) #16
On Thu, Dec 12, 2013 at 8:17 PM,  <mark@chromium.org> wrote:
> “volatile ≠ atomic,” that’s kind of what I was getting at…
>
> So the non-tsan object code winds up approximately equivalent to what it
> would
> be if you hadn’t used atomicops in this case, and having to use atomicops is
> simply a crutch to placate tsan.
>
> Like I said, I’m fine with whatever signal tsan wants to use to determine
> whether an operation is safe or not (volatile or otherwise). It does seems
> kind
> of bogus to have barked “the code is incorrect!” to Ben when your solution,
> for
> the non-tsan environment, is practically identical to what he had written in
> the
> first place.


There is a significant difference.
Don't confuse interface and implementation details. If ENOMEM happens
to be 42 right now on your machine, it's not a reason to use 42 in
source code saying that it's bogus to require changing code to
practically identical (while it is indeed completely identical).
Atomic functions not only help tsan and other tools to understand
code. They equally help developers to correctly read the code and
understand the intention. If our platforms or compilers will change
(which happens roughly every 2 weeks), it will be trivially simple to
update only the implementation of atomic functions (as compared to
reviewing and fixing 100'000'000 lines of code).
Program against interface.

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698