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

Issue 2569763004: [sensors](Linux) Fix tsan data race in sensor reader (Closed)

Created:
4 years ago by maksims (do not use this acc)
Modified:
4 years ago
CC:
chromium-reviews, wanming.lin, shalamov, Mikhail
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[sensors](Linux) Fix tsan data race in sensor reader This CL fixes a tsan data race, which is caused by calling StopFetchingData from different threads. It must not be allowed. Use the same thread by using a PostTask. BUG=673760 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_tsan_rel_ng Committed: https://crrev.com/d52b2f15ba4712b9dc4a2d08a45aa3210999dc8f Cr-Commit-Position: refs/heads/master@{#439798}

Patch Set 1 #

Total comments: 3

Patch Set 2 : change threading model. SensorReader now belongs to a polling thread #

Total comments: 1

Patch Set 3 : modify code comments #

Total comments: 11

Patch Set 4 : use callbacks with binded messageloop and fix comments #

Patch Set 5 : don't use pointer for timer #

Total comments: 2

Patch Set 6 : don't use BindToCurrentLoop, but rather pass a task runner and callbacks #

Total comments: 5

Patch Set 7 : pass weak_ptr and task_runner #

Patch Set 8 : rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -69 lines) Patch
M build/sanitizers/tsan_suppressions.cc View 1 2 3 4 5 1 chunk +0 lines, -3 lines 0 comments Download
M device/generic_sensor/platform_sensor_linux.h View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M device/generic_sensor/platform_sensor_linux.cc View 1 2 3 4 5 6 2 chunks +15 lines, -8 lines 0 comments Download
M device/generic_sensor/platform_sensor_provider_linux.h View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M device/generic_sensor/platform_sensor_provider_linux.cc View 1 2 3 2 chunks +4 lines, -1 line 0 comments Download
M device/generic_sensor/platform_sensor_reader_linux.h View 1 2 3 4 5 6 7 2 chunks +22 lines, -14 lines 0 comments Download
M device/generic_sensor/platform_sensor_reader_linux.cc View 1 2 3 4 5 6 3 chunks +40 lines, -42 lines 0 comments Download

Messages

Total messages: 70 (46 generated)
maksims (do not use this acc)
please review
4 years ago (2016-12-13 18:10:15 UTC) #5
gab
https://codereview.chromium.org/2569763004/diff/1/device/generic_sensor/platform_sensor_reader_linux.cc File device/generic_sensor/platform_sensor_reader_linux.cc (right): https://codereview.chromium.org/2569763004/diff/1/device/generic_sensor/platform_sensor_reader_linux.cc#newcode125 device/generic_sensor/platform_sensor_reader_linux.cc:125: weak_factory_.GetWeakPtr())); WeakPtr is also not thread-safe (can't obtain it ...
4 years ago (2016-12-13 18:12:45 UTC) #8
maksims (do not use this acc)
https://codereview.chromium.org/2569763004/diff/1/device/generic_sensor/platform_sensor_reader_linux.cc File device/generic_sensor/platform_sensor_reader_linux.cc (right): https://codereview.chromium.org/2569763004/diff/1/device/generic_sensor/platform_sensor_reader_linux.cc#newcode125 device/generic_sensor/platform_sensor_reader_linux.cc:125: weak_factory_.GetWeakPtr())); On 2016/12/13 18:12:45, gab wrote: > WeakPtr is ...
4 years ago (2016-12-13 18:18:19 UTC) #9
gab
https://codereview.chromium.org/2569763004/diff/1/device/generic_sensor/platform_sensor_reader_linux.cc File device/generic_sensor/platform_sensor_reader_linux.cc (right): https://codereview.chromium.org/2569763004/diff/1/device/generic_sensor/platform_sensor_reader_linux.cc#newcode125 device/generic_sensor/platform_sensor_reader_linux.cc:125: weak_factory_.GetWeakPtr())); On 2016/12/13 18:18:19, maksims wrote: > On 2016/12/13 ...
4 years ago (2016-12-13 18:23:02 UTC) #10
Reilly Grant (use Gerrit)
On 2016/12/13 18:23:02, gab wrote: > https://codereview.chromium.org/2569763004/diff/1/device/generic_sensor/platform_sensor_reader_linux.cc > File device/generic_sensor/platform_sensor_reader_linux.cc (right): > > https://codereview.chromium.org/2569763004/diff/1/device/generic_sensor/platform_sensor_reader_linux.cc#newcode125 > ...
4 years ago (2016-12-13 19:27:15 UTC) #13
maksims (do not use this acc)
Please review
4 years ago (2016-12-14 09:53:17 UTC) #16
gab
Top-level review. Is any of this thread-affine? If not, prefer SequencedTaskRunner which still provides thread-safety ...
4 years ago (2016-12-14 14:52:21 UTC) #24
maksims (do not use this acc)
On 2016/12/14 14:52:21, gab wrote: > Top-level review. > > Is any of this thread-affine? ...
4 years ago (2016-12-14 17:35:43 UTC) #25
gab
On 2016/12/14 17:35:43, maksims wrote: > On 2016/12/14 14:52:21, gab wrote: > > Top-level review. ...
4 years ago (2016-12-14 17:49:27 UTC) #26
maksims (do not use this acc)
Reilly, can you comment please?
4 years ago (2016-12-14 18:30:24 UTC) #29
Reilly Grant (use Gerrit)
https://codereview.chromium.org/2569763004/diff/60001/device/generic_sensor/platform_sensor_provider_linux.cc File device/generic_sensor/platform_sensor_provider_linux.cc (right): https://codereview.chromium.org/2569763004/diff/60001/device/generic_sensor/platform_sensor_provider_linux.cc#newcode171 device/generic_sensor/platform_sensor_provider_linux.cc:171: base::Unretained(this), type)); It doesn't seem necessary to pass this ...
4 years ago (2016-12-14 18:56:08 UTC) #30
Mikhail
https://codereview.chromium.org/2569763004/diff/60001/device/generic_sensor/platform_sensor_provider_linux.cc File device/generic_sensor/platform_sensor_provider_linux.cc (right): https://codereview.chromium.org/2569763004/diff/60001/device/generic_sensor/platform_sensor_provider_linux.cc#newcode60 device/generic_sensor/platform_sensor_provider_linux.cc:60: base::Bind(SensorReader::Create, sensor_device, Let's delegate SensorReader creation to the sensor ...
4 years ago (2016-12-15 10:57:48 UTC) #33
gab
FYI, suppressed this TSAN failure for now in https://codereview.chromium.org/2579003002/ given it was the last blocker ...
4 years ago (2016-12-15 12:02:49 UTC) #35
maksims (do not use this acc)
On 2016/12/15 12:02:49, gab wrote: > FYI, suppressed this TSAN failure for now in > ...
4 years ago (2016-12-15 18:37:31 UTC) #42
Reilly Grant (use Gerrit)
https://codereview.chromium.org/2569763004/diff/100001/device/generic_sensor/platform_sensor_linux.cc File device/generic_sensor/platform_sensor_linux.cc (right): https://codereview.chromium.org/2569763004/diff/100001/device/generic_sensor/platform_sensor_linux.cc#newcode45 device/generic_sensor/platform_sensor_linux.cc:45: sensor_device, task_runner_, update_reading_cb, notify_read_error_cb); Since these callbacks are bound ...
4 years ago (2016-12-15 18:51:31 UTC) #43
gab
On 2016/12/15 18:37:31, maksims wrote: > On 2016/12/15 12:02:49, gab wrote: > > FYI, suppressed ...
4 years ago (2016-12-15 19:30:35 UTC) #44
maksims (do not use this acc)
https://codereview.chromium.org/2569763004/diff/60001/device/generic_sensor/platform_sensor_provider_linux.cc File device/generic_sensor/platform_sensor_provider_linux.cc (right): https://codereview.chromium.org/2569763004/diff/60001/device/generic_sensor/platform_sensor_provider_linux.cc#newcode60 device/generic_sensor/platform_sensor_provider_linux.cc:60: base::Bind(SensorReader::Create, sensor_device, On 2016/12/15 10:57:48, Mikhail wrote: > Let's ...
4 years ago (2016-12-16 08:39:22 UTC) #50
Reilly Grant (use Gerrit)
https://codereview.chromium.org/2569763004/diff/140001/device/generic_sensor/platform_sensor_linux.cc File device/generic_sensor/platform_sensor_linux.cc (right): https://codereview.chromium.org/2569763004/diff/140001/device/generic_sensor/platform_sensor_linux.cc#newcode42 device/generic_sensor/platform_sensor_linux.cc:42: sensor_device, task_runner_, update_reading_cb, notify_read_error_cb); Now you've negated the benefit ...
4 years ago (2016-12-16 21:34:42 UTC) #53
maksims (do not use this acc)
Please review https://codereview.chromium.org/2569763004/diff/140001/device/generic_sensor/platform_sensor_linux.cc File device/generic_sensor/platform_sensor_linux.cc (right): https://codereview.chromium.org/2569763004/diff/140001/device/generic_sensor/platform_sensor_linux.cc#newcode42 device/generic_sensor/platform_sensor_linux.cc:42: sensor_device, task_runner_, update_reading_cb, notify_read_error_cb); On 2016/12/16 21:34:42, ...
4 years ago (2016-12-19 09:46:23 UTC) #57
Reilly Grant (use Gerrit)
lgtm
4 years ago (2016-12-19 20:42:04 UTC) #61
gab
On 2016/12/19 20:42:04, Reilly Grant wrote: > lgtm lgtm for build/sanitizers/tsan_suppressions.cc and r-s lgtm for ...
4 years ago (2016-12-19 21:02:16 UTC) #62
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2569763004/220001
4 years ago (2016-12-20 12:29:32 UTC) #65
commit-bot: I haz the power
Committed patchset #8 (id:220001)
4 years ago (2016-12-20 14:38:25 UTC) #68
commit-bot: I haz the power
4 years ago (2016-12-20 14:40:10 UTC) #70
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/d52b2f15ba4712b9dc4a2d08a45aa3210999dc8f
Cr-Commit-Position: refs/heads/master@{#439798}

Powered by Google App Engine
This is Rietveld 408576698