Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2073)

Issue 91230048: code review 91230048: sync: use atomic load operations in Mutex (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years ago by ruiu
Modified:
9 years, 11 months ago
Visibility:
Public.

Description

sync: use atomic load operations in Mutex Because of the lack of memory model for atomic operations, I cannot say whether or not the previous code was wrong. But I believe that we don't want to mix atomic stores (CAS) and non atomic loads to the same variable.

Patch Set 1 #

Patch Set 2 : diff -r d797b2316601 https://code.google.com/p/go #

Patch Set 3 : diff -r 209bb94bd691 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -2 lines) Patch
M src/pkg/sync/mutex.go View 1 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 10
ruiu
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
10 years ago (2014-05-09 02:31:32 UTC) #1
ruiu
I found bunch of other places in sync package where we do update variables with ...
10 years ago (2014-05-09 03:16:40 UTC) #2
dvyukov
Formally you right that these are data races. However, I am concerned about performance. Please ...
10 years ago (2014-05-09 10:30:06 UTC) #3
ruiu
On Fri, May 9, 2014 at 3:30 AM, <dvyukov@google.com> wrote: > Formally you right that ...
10 years ago (2014-05-11 03:35:12 UTC) #4
dvyukov
On Sun, May 11, 2014 at 4:34 AM, Rui Ueyama <ruiu@google.com> wrote: > On Fri, ...
10 years ago (2014-05-11 07:00:19 UTC) #5
ruiu
On Sat, May 10, 2014 at 11:59 PM, Dmitry Vyukov <dvyukov@google.com> wrote: > On Sun, ...
10 years ago (2014-05-11 20:43:48 UTC) #6
dvyukov
On Mon, May 12, 2014 at 12:43 AM, Rui Ueyama <ruiu@google.com> wrote: > On Sat, ...
10 years ago (2014-05-12 17:10:23 UTC) #7
ruiu
On Mon, May 12, 2014 at 10:10 AM, Dmitry Vyukov <dvyukov@google.com> wrote: > On Mon, ...
10 years ago (2014-05-12 17:48:57 UTC) #8
minux1
On Mon, May 12, 2014 at 1:48 PM, 'Rui Ueyama' via golang-codereviews < golang-codereviews@googlegroups.com> wrote: ...
10 years ago (2014-05-12 18:00:49 UTC) #9
ruiu
10 years ago (2014-05-12 18:15:55 UTC) #10
On Mon, May 12, 2014 at 11:00 AM, minux <minux.ma@gmail.com> wrote:

>
> On Mon, May 12, 2014 at 1:48 PM, 'Rui Ueyama' via golang-codereviews <
> golang-codereviews@googlegroups.com> wrote:
>>
>> Yeah, it's surprising to find that Mutex behaves (at least in theory)
>> wrong on ARM.
>>
>> But it's wrong only on FreeBSD and NetBSD. On Linux, Go uses a
>> kernel-provided CAS function instead of its own, located at a high address
>> (0xffff0fc0) in the user memory space. That kernel function provides memory
>> barrier.
>>
> we also fallback to LDREX/STREX based implementation when running on very
> old linux kernels,
> but probably people aren't using pre 3.1 kernels (that introduced
> __kuser_cmpxchg64, and __kuser_cmpxchg32
> was introduced much earlier).
>
>>
>> Maybe no one is really running Go on FreeBSD or NetBSD on recent
>> multi-core ARM chips? Or the bug happens in extremely rare conditions? I
>> don't know why it haven't been found earlier.
>>
> NetBSD doesn't support ARM SMP, and FreeBSD just enabled support in
> -current 1 month ago,
> so that could explain why we haven't found this bug before.
>
> we don't have SMP builders for FreeBSD, and the issue for supporting
> FreeBSD 11 (-current)
> on ARM is pushed back to Go 1.4, so we can't add a SMP builder for 1.3
> either.
>

That explains it.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b