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

Issue 1463683002: Switch wtf/SpinLock to std::atomic (Closed)

Created:
5 years, 1 month ago by jschuh
Modified:
5 years ago
CC:
Mads Ager (chromium), blink-reviews, blink-reviews-wtf_chromium.org, chromium-reviews, kouhei+heap_chromium.org, Mikhail, oilpan-reviews, dvyukov
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Switch wtf/SpinLock to std::atomic Tsan identified a racy read in the existing spin lock loop. Tsan is correct in the absolute sense, even though the read is safe in practice. However, the architectures we support might change, or the behavior of the compiler might change, so the the best fix is to just use the proper std::atomic type, because that is guaranteed to always be safe. And the compiled code should be effectively unchanged. BUG=556469 NOTRY=True Committed: https://crrev.com/5e58730d6fe40ef7cead75954ef5b1c05dea6d4b Cr-Commit-Position: refs/heads/master@{#363347} Committed: https://crrev.com/36d01b428979aafa764c28eccc4d73a5e30f112f Cr-Commit-Position: refs/heads/master@{#363353}

Patch Set 1 #

Patch Set 2 : nits #

Patch Set 3 : clang fix #

Patch Set 4 : clang fix #

Patch Set 5 : actually fix static initializers #

Patch Set 6 : sync fixes #

Patch Set 7 : sync again #

Total comments: 14

Patch Set 8 : actioned feedback #

Patch Set 9 : iwyu fix #

Patch Set 10 : asan iwyu #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -88 lines) Patch
M third_party/WebKit/Source/web/tests/SpinLockTest.cpp View 1 2 5 2 chunks +2 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/wtf/AddressSpaceRandomization.cpp View 4 3 chunks +2 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/wtf/ContainerAnnotations.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/PartitionAlloc.h View 1 2 3 4 5 6 7 4 chunks +16 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/wtf/PartitionAlloc.cpp View 1 2 3 4 5 9 chunks +31 lines, -35 lines 0 comments Download
M third_party/WebKit/Source/wtf/Partitions.h View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/wtf/Partitions.cpp View 4 4 chunks +3 lines, -7 lines 1 comment Download
M third_party/WebKit/Source/wtf/SpinLock.h View 1 2 3 4 5 6 7 1 chunk +34 lines, -22 lines 0 comments Download
M third_party/WebKit/Source/wtf/SpinLock.cpp View 1 2 3 4 5 6 7 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 73 (29 generated)
jschuh
Turns out it was easy enough to just switch to std::atomic. So, this silences tsan ...
5 years ago (2015-12-02 19:52:46 UTC) #3
haraken
I think this change makes sense. Elliott, yutak: Are you fine with using std::atomic in ...
5 years ago (2015-12-03 00:10:39 UTC) #5
esprehn
I'd rather we took the code in WebKit, they replaced lots of this stuff recently. ...
5 years ago (2015-12-03 01:36:31 UTC) #6
esprehn
I'd rather we took the code in WebKit, they replaced lots of this stuff recently. ...
5 years ago (2015-12-03 01:36:32 UTC) #7
haraken
On 2015/12/03 01:36:32, esprehn wrote: > I'd rather we took the code in WebKit, they ...
5 years ago (2015-12-03 02:26:47 UTC) #8
jschuh
Nope. WebKit ripped out their crazy hand-coded atomics and just wrap std::atomic now. Also, I ...
5 years ago (2015-12-03 04:52:27 UTC) #9
haraken
On 2015/12/03 04:52:27, jschuh (very slow) wrote: > Nope. WebKit ripped out their crazy hand-coded ...
5 years ago (2015-12-03 04:56:03 UTC) #10
jschuh
On 2015/12/03 04:56:03, haraken wrote: > On 2015/12/03 04:52:27, jschuh (very slow) wrote: > > ...
5 years ago (2015-12-03 05:01:51 UTC) #11
esprehn
WebKit removed SpinLock, they use their own Lock now instead. This patch is just updating ...
5 years ago (2015-12-03 05:18:47 UTC) #12
jschuh
On 2015/12/03 05:18:47, esprehn wrote: > WebKit removed SpinLock, they use their own Lock now ...
5 years ago (2015-12-03 06:19:17 UTC) #13
Yuta Kitamura
On 2015/12/03 06:19:17, jschuh (very slow) wrote: > So, the problem is that these locks ...
5 years ago (2015-12-03 06:40:45 UTC) #14
jschuh
On 2015/12/03 06:40:45, Yuta Kitamura wrote: > On 2015/12/03 06:19:17, jschuh (very slow) wrote: > ...
5 years ago (2015-12-03 17:37:46 UTC) #15
esprehn
In blink we prefer change descriptions that say why you're doing something, so you don't ...
5 years ago (2015-12-03 19:02:50 UTC) #16
jschuh
On 2015/12/03 19:02:50, esprehn wrote: > In blink we prefer change descriptions that say why ...
5 years ago (2015-12-03 19:19:20 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1463683002/100002 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1463683002/100002
5 years ago (2015-12-03 19:22:18 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: chromeos_daisy_chromium_compile_only_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_daisy_chromium_compile_only_ng/builds/65392) chromeos_x86-generic_chromium_compile_only_ng on tryserver.chromium.linux (JOB_FAILED, ...
5 years ago (2015-12-03 19:42:44 UTC) #22
jschuh
Oops, still need sign off from haraken.
5 years ago (2015-12-03 19:54:49 UTC) #23
haraken
LGTM, though you need to address some compile issues in bots.
5 years ago (2015-12-03 23:26:59 UTC) #24
Yuta Kitamura
LGTM as well. https://codereview.chromium.org/1463683002/diff/130001/third_party/WebKit/Source/wtf/SpinLock.h File third_party/WebKit/Source/wtf/SpinLock.h (right): https://codereview.chromium.org/1463683002/diff/130001/third_party/WebKit/Source/wtf/SpinLock.h#newcode68 third_party/WebKit/Source/wtf/SpinLock.h:68: WTF_EXPORT void SlowLock(); Follow Blink's naming ...
5 years ago (2015-12-04 03:36:28 UTC) #25
Alexander Potapenko
When the memory ordering is not specified, std::atomic operations default to memory_order_seq_cst, which is way ...
5 years ago (2015-12-04 12:17:34 UTC) #26
jschuh
https://codereview.chromium.org/1463683002/diff/130001/third_party/WebKit/Source/wtf/PartitionAlloc.h File third_party/WebKit/Source/wtf/PartitionAlloc.h (right): https://codereview.chromium.org/1463683002/diff/130001/third_party/WebKit/Source/wtf/PartitionAlloc.h#newcode791 third_party/WebKit/Source/wtf/PartitionAlloc.h:791: SpinLock::Guard guard(root->lock); On 2015/12/04 12:17:34, Alexander Potapenko wrote: > ...
5 years ago (2015-12-04 20:45:14 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1463683002/170001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1463683002/170001
5 years ago (2015-12-04 20:46:57 UTC) #31
commit-bot: I haz the power
Try jobs failed on following builders: chromeos_x86-generic_chromium_compile_only_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_x86-generic_chromium_compile_only_ng/builds/66002)
5 years ago (2015-12-04 21:14:02 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1463683002/190001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1463683002/190001
5 years ago (2015-12-05 00:56:58 UTC) #36
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_ng on tryserver.chromium.win (JOB_TIMED_OUT, no build URL) win_chromium_compile_dbg_ng on ...
5 years ago (2015-12-05 03:01:01 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1463683002/190001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1463683002/190001
5 years ago (2015-12-05 03:07:12 UTC) #40
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_ng on tryserver.chromium.win (JOB_TIMED_OUT, no build URL) win_chromium_compile_dbg_ng on ...
5 years ago (2015-12-05 05:10:20 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1463683002/190001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1463683002/190001
5 years ago (2015-12-05 06:36:01 UTC) #44
Alexander Potapenko
On 2015/12/05 06:36:01, commit-bot: I haz the power wrote: > CQ is trying da patch. ...
5 years ago (2015-12-05 06:54:19 UTC) #45
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_ng on tryserver.chromium.win (JOB_TIMED_OUT, no build URL) win_chromium_compile_dbg_ng on ...
5 years ago (2015-12-05 08:38:12 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1463683002/190001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1463683002/190001
5 years ago (2015-12-05 19:36:57 UTC) #49
jschuh
On 2015/12/05 06:54:19, Alexander Potapenko wrote: > On 2015/12/05 06:36:01, commit-bot: I haz the power ...
5 years ago (2015-12-05 21:28:08 UTC) #50
jschuh
The Windows bots haven't responded for over a day and I already verified the patch ...
5 years ago (2015-12-05 21:29:59 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1463683002/190001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1463683002/190001
5 years ago (2015-12-05 21:33:06 UTC) #55
commit-bot: I haz the power
Committed patchset #9 (id:190001)
5 years ago (2015-12-05 21:41:11 UTC) #57
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/5e58730d6fe40ef7cead75954ef5b1c05dea6d4b Cr-Commit-Position: refs/heads/master@{#363347}
5 years ago (2015-12-05 21:42:13 UTC) #59
jschuh
A revert of this CL (patchset #9 id:190001) has been created in https://codereview.chromium.org/1502023002/ by jschuh@chromium.org. ...
5 years ago (2015-12-05 22:49:13 UTC) #60
jschuh
On 2015/12/05 22:49:13, jschuh (very slow) wrote: > A revert of this CL (patchset #9 ...
5 years ago (2015-12-05 23:07:55 UTC) #61
jschuh
On 2015/12/05 23:07:55, jschuh (very slow) wrote: > On 2015/12/05 22:49:13, jschuh (very slow) wrote: ...
5 years ago (2015-12-05 23:26:40 UTC) #62
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1463683002/210001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1463683002/210001
5 years ago (2015-12-06 03:48:19 UTC) #66
commit-bot: I haz the power
Committed patchset #10 (id:210001)
5 years ago (2015-12-06 04:27:59 UTC) #68
commit-bot: I haz the power
Patchset 10 (id:??) landed as https://crrev.com/36d01b428979aafa764c28eccc4d73a5e30f112f Cr-Commit-Position: refs/heads/master@{#363353}
5 years ago (2015-12-06 04:28:46 UTC) #70
Primiano Tucci (use gerrit)
Static initializer :-/ https://codereview.chromium.org/1463683002/diff/210001/third_party/WebKit/Source/wtf/Partitions.cpp File third_party/WebKit/Source/wtf/Partitions.cpp (right): https://codereview.chromium.org/1463683002/diff/210001/third_party/WebKit/Source/wtf/Partitions.cpp#newcode42 third_party/WebKit/Source/wtf/Partitions.cpp:42: SpinLock Partitions::s_initializationLock; This is now a ...
5 years ago (2015-12-07 10:11:57 UTC) #72
sof
5 years ago (2015-12-07 10:13:24 UTC) #73
Message was sent while issue was closed.
On 2015/12/07 10:11:57, Primiano Tucci wrote:
> Static initializer :-/
> 
>
https://codereview.chromium.org/1463683002/diff/210001/third_party/WebKit/Sou...
> File third_party/WebKit/Source/wtf/Partitions.cpp (right):
> 
>
https://codereview.chromium.org/1463683002/diff/210001/third_party/WebKit/Sou...
> third_party/WebKit/Source/wtf/Partitions.cpp:42: SpinLock
> Partitions::s_initializationLock;
> This is now a static initializer, some bots are unhappy.
> See:
>
http://build.chromium.org/p/chromium.fyi/builders/CrWinClang/builds/4693/step...
> 
> FAILED: ninja -t msvc -e environment.x86 --
> "..\..\third_party/llvm-build/Release+Asserts/bin/clang-cl" -m32 /nologo
> /showIncludes /FC @obj\third_party\WebKit\Source\wtf\wtf.Partitions.obj.rsp /c
> ..\..\third_party\WebKit\Source\wtf\Partitions.cpp
> /Foobj\third_party\WebKit\Source\wtf\wtf.Partitions.obj
> /Fdobj\third_party\WebKit\Source\wtf\wtf.cc.pdb 
> ..\..\third_party\WebKit\Source\wtf\Partitions.cpp(42,22) :  error:
declaration
> requires a global constructor [-Werror,-Wglobal-constructors]
> SpinLock Partitions::s_initializationLock;
>                      ^~~~~~~~~~~~~~~~~~~~

Issue tracked by https://code.google.com/p/chromium/issues/detail?id=566751

Powered by Google App Engine
This is Rietveld 408576698