<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/go-git.git/src/runtime/testdata/testprogcgo, branch dev.debug</title>
<subtitle>github.com: golang/go
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/'/>
<entry>
<title>runtime: get more info for TestCgoSignalDeadlock failures</title>
<updated>2017-06-27T00:34:53+00:00</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2017-06-26T23:11:33+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=93870aeee980aadf6f67b778734f25419de55a7d'/>
<id>93870aeee980aadf6f67b778734f25419de55a7d</id>
<content type='text'>
Updates #18598

Change-Id: I13c60124714cf9d1537efa0a7dd1e6a0fed9ae5b
Reviewed-on: https://go-review.googlesource.com/46723
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Updates #18598

Change-Id: I13c60124714cf9d1537efa0a7dd1e6a0fed9ae5b
Reviewed-on: https://go-review.googlesource.com/46723
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: don't run TestCgoNumGoroutine on Windows or Plan 9</title>
<updated>2017-06-14T17:28:02+00:00</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2017-06-14T17:17:29+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=03a4a5c98885245a99d67b684acacff4f7b2326e'/>
<id>03a4a5c98885245a99d67b684acacff4f7b2326e</id>
<content type='text'>
The test requires pthreads.

Fixes #20666.

Change-Id: Icb2400250a80cdad6680cd1ef6c18ef7343d5e29
Reviewed-on: https://go-review.googlesource.com/45701
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The test requires pthreads.

Fixes #20666.

Change-Id: Icb2400250a80cdad6680cd1ef6c18ef7343d5e29
Reviewed-on: https://go-review.googlesource.com/45701
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: mark extra M's G as dead when not in use</title>
<updated>2017-06-07T02:13:51+00:00</updated>
<author>
<name>Austin Clements</name>
<email>austin@google.com</email>
</author>
<published>2017-06-06T22:37:59+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=4e7067cde4a602e3a301500baac6cfbdebcffd97'/>
<id>4e7067cde4a602e3a301500baac6cfbdebcffd97</id>
<content type='text'>
Currently the extra Ms created for cgo callbacks have a corresponding
G that's kept in syscall state with only a call to goexit on its
stack. This leads to confusing output from runtime.NumGoroutines and
in tracebacks:

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
	.../src/runtime/asm_amd64.s:2197 +0x1

Fix this by putting this goroutine into state _Gdead when it's not in
use instead of _Gsyscall. To keep the goroutine counts correct, we
also add one to sched.ngsys while the goroutine is in _Gdead. The
effect of this is as if the goroutine simply doesn't exist when it's
not in use.

Fixes #16631.
Fixes #16714.

Change-Id: Ieae08a2febd4b3d00bef5c23fd6ca88fb2bb0087
Reviewed-on: https://go-review.googlesource.com/45030
Run-TryBot: Austin Clements &lt;austin@google.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently the extra Ms created for cgo callbacks have a corresponding
G that's kept in syscall state with only a call to goexit on its
stack. This leads to confusing output from runtime.NumGoroutines and
in tracebacks:

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
	.../src/runtime/asm_amd64.s:2197 +0x1

Fix this by putting this goroutine into state _Gdead when it's not in
use instead of _Gsyscall. To keep the goroutine counts correct, we
also add one to sched.ngsys while the goroutine is in _Gdead. The
effect of this is as if the goroutine simply doesn't exist when it's
not in use.

Fixes #16631.
Fixes #16714.

Change-Id: Ieae08a2febd4b3d00bef5c23fd6ca88fb2bb0087
Reviewed-on: https://go-review.googlesource.com/45030
Run-TryBot: Austin Clements &lt;austin@google.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: add explicit (void) in C to avoid GCC 7 problem</title>
<updated>2017-01-30T19:27:49+00:00</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2017-01-30T17:43:25+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=09496599520d73171550987b138d85ae1fb13b76'/>
<id>09496599520d73171550987b138d85ae1fb13b76</id>
<content type='text'>
This avoids errors like
    ./traceback.go:80:2: call of non-function C.f1

I filed https://gcc.gnu.org/PR79289 for the GCC problem. I think this
is a bug in GCC, and it may be fixed before the final GCC 7 release.
This CL is correct either way.

Fixes #18855.

Change-Id: I0785a7b7c5b1d0ca87b454b5eca9079f390fcbd4
Reviewed-on: https://go-review.googlesource.com/35919
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: David Crawshaw &lt;crawshaw@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This avoids errors like
    ./traceback.go:80:2: call of non-function C.f1

I filed https://gcc.gnu.org/PR79289 for the GCC problem. I think this
is a bug in GCC, and it may be fixed before the final GCC 7 release.
This CL is correct either way.

Fixes #18855.

Change-Id: I0785a7b7c5b1d0ca87b454b5eca9079f390fcbd4
Reviewed-on: https://go-review.googlesource.com/35919
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: David Crawshaw &lt;crawshaw@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>all: make copyright headers consistent with one space after period</title>
<updated>2016-11-04T20:46:25+00:00</updated>
<author>
<name>Michael Munday</name>
<email>munday@ca.ibm.com</email>
</author>
<published>2016-11-04T20:30:12+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=cfd89164bb6af2d1a660b75ded8c0801372924e2'/>
<id>cfd89164bb6af2d1a660b75ded8c0801372924e2</id>
<content type='text'>
Continuation of CL 20111.

Change-Id: Ie2f62237e6ec316989c021de9b267cc9d6ee6676
Reviewed-on: https://go-review.googlesource.com/32830
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Continuation of CL 20111.

Change-Id: Ie2f62237e6ec316989c021de9b267cc9d6ee6676
Reviewed-on: https://go-review.googlesource.com/32830
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: record current PC for SIGPROF on non-Go thread</title>
<updated>2016-10-11T12:56:15+00:00</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2016-10-04T14:11:55+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=d03e8b226cd11692ca9505a815af559ce7989700'/>
<id>d03e8b226cd11692ca9505a815af559ce7989700</id>
<content type='text'>
If we get a SIGPROF on a non-Go thread, and the program has not called
runtime.SetCgoTraceback so we have no way to collect a stack trace, then
record a profile that is just the PC where the signal occurred. That
will at least point the user to the right area.

Retrieving the PC from the sigctxt in a signal handler on a non-G thread
required marking a number of trivial sigctxt methods as nosplit, and,
for extra safety, nowritebarrierrec.

The test shows that the existing test CgoPprofThread test does not test
the stack trace, just the profile signal. Leaving that for later.

Change-Id: I8f8f3ff09ac099fc9d9df94b5a9d210ffc20c4ab
Reviewed-on: https://go-review.googlesource.com/30252
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we get a SIGPROF on a non-Go thread, and the program has not called
runtime.SetCgoTraceback so we have no way to collect a stack trace, then
record a profile that is just the PC where the signal occurred. That
will at least point the user to the right area.

Retrieving the PC from the sigctxt in a signal handler on a non-G thread
required marking a number of trivial sigctxt methods as nosplit, and,
for extra safety, nowritebarrierrec.

The test shows that the existing test CgoPprofThread test does not test
the stack trace, just the profile signal. Leaving that for later.

Change-Id: I8f8f3ff09ac099fc9d9df94b5a9d210ffc20c4ab
Reviewed-on: https://go-review.googlesource.com/30252
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: add threadprof tag for test that starts busy thread</title>
<updated>2016-10-06T01:23:09+00:00</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2016-10-05T14:31:11+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=e5421e21effb5b1db4e565babbddffeb4103d40e'/>
<id>e5421e21effb5b1db4e565babbddffeb4103d40e</id>
<content type='text'>
The CgoExternalThreadSIGPROF test starts a thread at constructor time
that does a busy loop. That can throw off some other tests. So only
build that code if testprogcgo is built with the tag threadprof, and
adjust the tests that use that code to pass that build tag.

This revealed that the CgoPprofThread test was not testing what it
should have, as it never actually started the cpuHog thread. It was
passing because of the busy loop thread. Fix it to start the thread as
intended.

Change-Id: I087a9e4fc734a86be16a287456441afac5676beb
Reviewed-on: https://go-review.googlesource.com/30362
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The CgoExternalThreadSIGPROF test starts a thread at constructor time
that does a busy loop. That can throw off some other tests. So only
build that code if testprogcgo is built with the tag threadprof, and
adjust the tests that use that code to pass that build tag.

This revealed that the CgoPprofThread test was not testing what it
should have, as it never actually started the cpuHog thread. It was
passing because of the busy loop thread. Fix it to start the thread as
intended.

Change-Id: I087a9e4fc734a86be16a287456441afac5676beb
Reviewed-on: https://go-review.googlesource.com/30362
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime/testdata/testprogcgo: add explicit return value to signalThread</title>
<updated>2016-10-05T15:36:00+00:00</updated>
<author>
<name>Michael Munday</name>
<email>munday@ca.ibm.com</email>
</author>
<published>2016-10-05T15:24:07+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=f15f1ff46f94c70b55903963a32dfccdcbe1efe5'/>
<id>f15f1ff46f94c70b55903963a32dfccdcbe1efe5</id>
<content type='text'>
Should fix the clang builder.

Change-Id: I3ee34581b6a7ec902420de72a8a08a2426997782
Reviewed-on: https://go-review.googlesource.com/30363
Run-TryBot: Michael Munday &lt;munday@ca.ibm.com&gt;
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Should fix the clang builder.

Change-Id: I3ee34581b6a7ec902420de72a8a08a2426997782
Reviewed-on: https://go-review.googlesource.com/30363
Run-TryBot: Michael Munday &lt;munday@ca.ibm.com&gt;
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: don't call cgocallback from signal handler</title>
<updated>2016-10-05T13:21:49+00:00</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2016-10-03T23:58:34+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=6c13a1db2ebe146fec7cc7261146ca0e8420f011'/>
<id>6c13a1db2ebe146fec7cc7261146ca0e8420f011</id>
<content type='text'>
Calling cgocallback from a signal handler can fail when using the race
detector. Calling cgocallback will lead to a call to newextram which
will call oneNewExtraM which will call racegostart. The racegostart
function will set up some race detector data structures, and doing that
will sometimes call the C memory allocator. If we are running the signal
handler from a signal that interrupted the C memory allocator, we will
crash or hang.

Instead, change the signal handler code to call needm and dropm. The
needm function will grab allocated m and g structures and initialize the
g to use the current stack--the signal stack. That is all we need to
safely call code that allocates memory and checks whether it needs to
split the stack. This may temporarily leave us with no m available to
run a cgo callback, but that is OK in this case since the code we call
will quickly either crash or call dropm to return the m.

Implementing this required changing some of the setSignalstackSP
functions to avoid a write barrier. These functions never need a write
barrier but in some cases generated one anyhow because on some systems
the ss_sp field is a pointer.

Change-Id: I3893f47c3a66278f85eab7f94c1ab11d4f3be133
Reviewed-on: https://go-review.googlesource.com/30218
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Calling cgocallback from a signal handler can fail when using the race
detector. Calling cgocallback will lead to a call to newextram which
will call oneNewExtraM which will call racegostart. The racegostart
function will set up some race detector data structures, and doing that
will sometimes call the C memory allocator. If we are running the signal
handler from a signal that interrupted the C memory allocator, we will
crash or hang.

Instead, change the signal handler code to call needm and dropm. The
needm function will grab allocated m and g structures and initialize the
g to use the current stack--the signal stack. That is all we need to
safely call code that allocates memory and checks whether it needs to
split the stack. This may temporarily leave us with no m available to
run a cgo callback, but that is OK in this case since the code we call
will quickly either crash or call dropm to return the m.

Implementing this required changing some of the setSignalstackSP
functions to avoid a write barrier. These functions never need a write
barrier but in some cases generated one anyhow because on some systems
the ss_sp field is a pointer.

Change-Id: I3893f47c3a66278f85eab7f94c1ab11d4f3be133
Reviewed-on: https://go-review.googlesource.com/30218
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: use sched_yield instead of pthread_yield</title>
<updated>2016-09-23T04:32:38+00:00</updated>
<author>
<name>David Crawshaw</name>
<email>crawshaw@golang.org</email>
</author>
<published>2016-09-23T04:02:38+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=ed915ad421e61c3158ccae4bfbbcfbc796514ee2'/>
<id>ed915ad421e61c3158ccae4bfbbcfbc796514ee2</id>
<content type='text'>
Attempt to fix the linux-amd64-clang builder, which broke
with CL 29472.

Turns out pthread_yield is a non-portable Linux function, and
should have #define _GNU_SOURCE before #include &lt;pthread.h&gt;.
GCC doesn't complain about this, but Clang does:

	./raceprof.go:44:3: warning: implicit declaration of function 'pthread_yield' is invalid in C99 [-Wimplicit-function-declaration]

(Though the error, while explicable, certainly could be clearer.)

There is a portable POSIX equivalent, sched_yield, so this
CL uses it instead.

Change-Id: I58ca7a3f73a2b3697712fdb02e72a8027c391169
Reviewed-on: https://go-review.googlesource.com/29675
Run-TryBot: David Crawshaw &lt;crawshaw@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Attempt to fix the linux-amd64-clang builder, which broke
with CL 29472.

Turns out pthread_yield is a non-portable Linux function, and
should have #define _GNU_SOURCE before #include &lt;pthread.h&gt;.
GCC doesn't complain about this, but Clang does:

	./raceprof.go:44:3: warning: implicit declaration of function 'pthread_yield' is invalid in C99 [-Wimplicit-function-declaration]

(Though the error, while explicable, certainly could be clearer.)

There is a portable POSIX equivalent, sched_yield, so this
CL uses it instead.

Change-Id: I58ca7a3f73a2b3697712fdb02e72a8027c391169
Reviewed-on: https://go-review.googlesource.com/29675
Run-TryBot: David Crawshaw &lt;crawshaw@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
