cmd/gc: instrument arrays properly in race detector.
The previous implementation would only record access to
the address of the array but the memory access to the whole
memory range must be recorded instead.
Now go test -race runtime/race complains: === RUN TestRace [...] RaceFailingSliceStruct . RaceFailingAppendSliceStruct . [...] ...
12 years, 3 months ago
(2013-03-27 22:01:42 UTC)
#2
Now go test -race runtime/race complains:
=== RUN TestRace
[...]
RaceFailingSliceStruct .
RaceFailingAppendSliceStruct .
[...]
Passed 266 of 269 tests (98.88%, 0+, 3-)
5 expected failures (2 has not fail)
--- FAIL: TestRace (12.45 seconds)
FAIL
exit status 1
FAIL runtime/race 12.474s
But I am pretty positive that these tests still fail, something looks wrong.
Rémy.
On 2013/03/27 22:01:42, remyoudompheng wrote: > Now go test -race runtime/race complains: > > === ...
12 years, 3 months ago
(2013-03-28 11:11:45 UTC)
#3
On 2013/03/27 22:01:42, remyoudompheng wrote:
> Now go test -race runtime/race complains:
>
> === RUN TestRace
> [...]
> RaceFailingSliceStruct .
> RaceFailingAppendSliceStruct .
> [...]
> Passed 266 of 269 tests (98.88%, 0+, 3-)
> 5 expected failures (2 has not fail)
> --- FAIL: TestRace (12.45 seconds)
> FAIL
> exit status 1
> FAIL runtime/race 12.474s
>
> But I am pretty positive that these tests still fail, something looks wrong.
In clean tree with this CL, I see:
Passed 264 of 269 tests (98.14%, 0+, 5-)
5 expected failures (0 has not fail)
On 2013/03/28 11:11:45, dvyukov wrote: > On 2013/03/27 22:01:42, remyoudompheng wrote: > > Now go ...
12 years, 3 months ago
(2013-03-28 18:58:30 UTC)
#5
On 2013/03/28 11:11:45, dvyukov wrote:
> On 2013/03/27 22:01:42, remyoudompheng wrote:
> > Now go test -race runtime/race complains:
> >
> > === RUN TestRace
> > [...]
> > RaceFailingSliceStruct .
> > RaceFailingAppendSliceStruct .
> > [...]
> > Passed 266 of 269 tests (98.88%, 0+, 3-)
> > 5 expected failures (2 has not fail)
> > --- FAIL: TestRace (12.45 seconds)
> > FAIL
> > exit status 1
> > FAIL runtime/race 12.474s
> >
> > But I am pretty positive that these tests still fail, something looks wrong.
>
> In clean tree with this CL, I see:
>
> Passed 264 of 269 tests (98.14%, 0+, 5-)
> 5 expected failures (0 has not fail)
Ah, I got confused because race_tes.go runs "go" regardless of what GOROOT may
be, so it is not necessarily testing what I think it does.
Does it LGTY with my remark? https://codereview.appspot.com/8053044/diff/5001/src/cmd/gc/racewalk.c File src/cmd/gc/racewalk.c (right): https://codereview.appspot.com/8053044/diff/5001/src/cmd/gc/racewalk.c#newcode471 src/cmd/gc/racewalk.c:471: if(callinstr(&f, init, wr, ...
12 years, 3 months ago
(2013-03-28 19:03:34 UTC)
#6
Does it LGTY with my remark?
https://codereview.appspot.com/8053044/diff/5001/src/cmd/gc/racewalk.c
File src/cmd/gc/racewalk.c (right):
https://codereview.appspot.com/8053044/diff/5001/src/cmd/gc/racewalk.c#newcod...
src/cmd/gc/racewalk.c:471: if(callinstr(&f, init, wr, 0)) {
On 2013/03/28 11:27:20, dvyukov wrote:
> Now I am thinking, since we pass &f to callinstr(), can't it change f?..
> I can't come up with a counter-example and function calls should be generally
> moved away by previous passes. But I've added that 'hascalls' logic because
> there were precedents.
>
> Please add a check that f is not changed. This bug would be painful to debug.
I don't understand, why does it matter that f can change? typecheck can also
change f. But on the next loop iteration the value of f is discarded so we don't
care. Do we ?
I suggest a completely different approach now. I may revert to the previous patchste if ...
12 years, 3 months ago
(2013-03-28 22:52:16 UTC)
#9
I suggest a completely different approach now. I may revert to the previous
patchste if needed.
The new test, TestRaceNestedArrayCopy, makes the previous patch go out of memory
even when just using Point32k instead of Point1M.
https://codereview.appspot.com/8053044/diff/23001/src/pkg/runtime/race/testda...
File src/pkg/runtime/race/testdata/mop_test.go (right):
https://codereview.appspot.com/8053044/diff/23001/src/pkg/runtime/race/testda...
src/pkg/runtime/race/testdata/mop_test.go:510: func TestRaceNestedArrayCopy(t
*testing.T) {
This example is ridiculous but similar things may happen in real life. I'm not
sure we want the compiler to generate 1 million instructions just because a
[1<<20]struct{a, b int} was accessed.
I need some time to review this. Yes, it's quite radical. I need to do ...
12 years, 3 months ago
(2013-03-29 06:45:03 UTC)
#10
I need some time to review this.
Yes, it's quite radical. I need to do more extensive testing if we are going to
push it before Go1.1.
FYI, for C when you do memcpy(p1, p2, 1<<30), ThreadSanitizer handles only
beginning of the array, because it's a way too expensive to process whole array.
And if there is a race, high chances it's either on the beginning or on each
element. Note that TSan internal shadow memory is 4x larger than user memory, so
1GB it needs to touch 4GB of memory.
It's good if the range accesses are handled completely in runtime, because then
I can implement similar logic.
It's bad that for struct {uint64; bool; bool}, we need to process 16 memory
accesses instead of 3.
On 2013/06/09 16:58:56, dvyukov wrote: > LGTM, but please wait until I update the race ...
12 years, 1 month ago
(2013-06-09 17:01:38 UTC)
#14
On 2013/06/09 16:58:56, dvyukov wrote:
> LGTM, but please wait until I update the race runtime to better handle range
> accesses (https://codereview.appspot.com/10082043/)
Yes, for some reason I had to rebuild a linux/amd64 syso with your patches for
it to work.
On 2013/06/09 17:04:33, remyoudompheng wrote: > On 2013/06/08 15:18:24, r wrote: > > please write ...
12 years, 1 month ago
(2013-06-09 17:07:34 UTC)
#16
On 2013/06/09 17:04:33, remyoudompheng wrote:
> On 2013/06/08 15:18:24, r wrote:
> > please write a more thorough CL description. i had no idea what
> 'instrumentation
> > of arrays' would refer to.
>
> Done.
Btw, does it handle struct initialization?
x := &X{...}
Issue 8053044: code review 8053044: cmd/gc: instrument arrays properly in race detector.
(Closed)
Created 12 years, 3 months ago by remyoudompheng
Modified 12 years ago
Reviewers:
Base URL:
Comments: 4