<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/go-git.git/src/runtime, branch dev.cmdgo</title>
<subtitle>github.com: golang/go
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/'/>
<entry>
<title>all: replace runtime SSE2 detection with GO386 setting</title>
<updated>2021-08-23T21:22:58+00:00</updated>
<author>
<name>Martin Möhrmann</name>
<email>martin@golang.org</email>
</author>
<published>2021-08-23T09:34:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=8157960d7f4a89807c71b3427a0363a23fd43ca9'/>
<id>8157960d7f4a89807c71b3427a0363a23fd43ca9</id>
<content type='text'>
When GO386=sse2 we can assume sse2 to be present without
a runtime check. If GO386=softfloat is set we can avoid
the usage of SSE2 even if detected.

This might cause a memcpy, memclr and bytealg slowdown of Go
binaries compiled with softfloat on machines that support
SSE2. Such setups are rare and should use GO386=sse2 instead
if performance matters.

On targets that support SSE2 we avoid the runtime overhead of
dynamic cpu feature dispatch.

The removal of runtime sse2 checks also allows to simplify
internal/cpu further by removing handling of the required
feature option as a followup after this CL.

Change-Id: I90a853a8853a405cb665497c6d1a86556947ba17
Reviewed-on: https://go-review.googlesource.com/c/go/+/344350
Trust: Martin Möhrmann &lt;martin@golang.org&gt;
Run-TryBot: Martin Möhrmann &lt;martin@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When GO386=sse2 we can assume sse2 to be present without
a runtime check. If GO386=softfloat is set we can avoid
the usage of SSE2 even if detected.

This might cause a memcpy, memclr and bytealg slowdown of Go
binaries compiled with softfloat on machines that support
SSE2. Such setups are rare and should use GO386=sse2 instead
if performance matters.

On targets that support SSE2 we avoid the runtime overhead of
dynamic cpu feature dispatch.

The removal of runtime sse2 checks also allows to simplify
internal/cpu further by removing handling of the required
feature option as a followup after this CL.

Change-Id: I90a853a8853a405cb665497c6d1a86556947ba17
Reviewed-on: https://go-review.googlesource.com/c/go/+/344350
Trust: Martin Möhrmann &lt;martin@golang.org&gt;
Run-TryBot: Martin Möhrmann &lt;martin@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: use RDTSCP for instruction stream serialized read of TSC</title>
<updated>2021-08-23T20:32:04+00:00</updated>
<author>
<name>Martin Möhrmann</name>
<email>martin@golang.org</email>
</author>
<published>2021-08-23T11:53:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=22540abf76a693bc9e4c550203d8ccbaa60c12e2'/>
<id>22540abf76a693bc9e4c550203d8ccbaa60c12e2</id>
<content type='text'>
To measure all instructions having been completed before reading
the time stamp counter with RDTSC an instruction sequence that
has instruction stream serializing properties which guarantee
waiting until all previous instructions have been executed is
needed. This does not necessary mean to wait for all stores to
be globally visible.

This CL aims to remove vendor specific logic for determining the
instruction sequence with CPU feature flag checks that are
CPU vendor independent.

For intel LFENCE has the wanted properties at least
since it was introduced together with SSE2 support.

On AMD instruction stream serializing LFENCE is supported by setting
an MSR C001_1029[1]=1 on AMD family 10h/12h/14h/15h/16h/17h processors.
AMD family 0Fh/11h processors support LFENCE as serializing always.
AMD plans support for this MSR and access to this bit for all future processors.
Source: https://developer.amd.com/wp-content/resources/Managing-Speculation-on-AMD-Processors.pdf

Reading the MSR to determine LFENCE properties is not always possible
or reliable (hypervisors). The Linux kernel is relying on serializing
LFENCE on AMD CPUs since a commit in July 2019: https://lkml.org/lkml/2019/7/22/295
and the MSR C001_1029 to enable serialization has been set by default
with the Spectre v1 mitigations.

Using an MFENCE on AMD is waiting on previous instructions having been executed
but in addition also flushes store buffers.

To align the serialization properties without runtime detection
of CPU manufacturers we can use the newer RDTSCP instruction which
waits until all previous instructions have been executed.

RDTSCP is available on Intel since around 2008 and on AMD CPUs since
around 2006. Support for RDTSCP can be checked independently
of manufacturer by checking CPUID bits.

Using RDTSCP is the default in Linux to read TSC in program order
when the instruction is available.
https://github.com/torvalds/linux/blob/e22ce8eb631bdc47a4a4ea7ecf4e4ba499db4f93/arch/x86/include/asm/msr.h#L231

Change-Id: Ifa841843b9abb2816f8f0754a163ebf01385306d
Reviewed-on: https://go-review.googlesource.com/c/go/+/344429
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
Trust: Martin Möhrmann &lt;martin@golang.org&gt;
Run-TryBot: Martin Möhrmann &lt;martin@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To measure all instructions having been completed before reading
the time stamp counter with RDTSC an instruction sequence that
has instruction stream serializing properties which guarantee
waiting until all previous instructions have been executed is
needed. This does not necessary mean to wait for all stores to
be globally visible.

This CL aims to remove vendor specific logic for determining the
instruction sequence with CPU feature flag checks that are
CPU vendor independent.

For intel LFENCE has the wanted properties at least
since it was introduced together with SSE2 support.

On AMD instruction stream serializing LFENCE is supported by setting
an MSR C001_1029[1]=1 on AMD family 10h/12h/14h/15h/16h/17h processors.
AMD family 0Fh/11h processors support LFENCE as serializing always.
AMD plans support for this MSR and access to this bit for all future processors.
Source: https://developer.amd.com/wp-content/resources/Managing-Speculation-on-AMD-Processors.pdf

Reading the MSR to determine LFENCE properties is not always possible
or reliable (hypervisors). The Linux kernel is relying on serializing
LFENCE on AMD CPUs since a commit in July 2019: https://lkml.org/lkml/2019/7/22/295
and the MSR C001_1029 to enable serialization has been set by default
with the Spectre v1 mitigations.

Using an MFENCE on AMD is waiting on previous instructions having been executed
but in addition also flushes store buffers.

To align the serialization properties without runtime detection
of CPU manufacturers we can use the newer RDTSCP instruction which
waits until all previous instructions have been executed.

RDTSCP is available on Intel since around 2008 and on AMD CPUs since
around 2006. Support for RDTSCP can be checked independently
of manufacturer by checking CPUID bits.

Using RDTSCP is the default in Linux to read TSC in program order
when the instruction is available.
https://github.com/torvalds/linux/blob/e22ce8eb631bdc47a4a4ea7ecf4e4ba499db4f93/arch/x86/include/asm/msr.h#L231

Change-Id: Ifa841843b9abb2816f8f0754a163ebf01385306d
Reviewed-on: https://go-review.googlesource.com/c/go/+/344429
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
Trust: Martin Möhrmann &lt;martin@golang.org&gt;
Run-TryBot: Martin Möhrmann &lt;martin@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: remove unused cpu architecture feature variables from binaries</title>
<updated>2021-08-23T11:23:58+00:00</updated>
<author>
<name>Martin Möhrmann</name>
<email>martin@golang.org</email>
</author>
<published>2020-10-24T03:54:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=c1a14781eca85e9c705c782aa2071a5f9c23c09e'/>
<id>c1a14781eca85e9c705c782aa2071a5f9c23c09e</id>
<content type='text'>
On amd64 this reduces go binary sizes by 176 bytes due to not referencing
internal/cpu.ARM64 and internal/cpu.ARM.

Change-Id: I8e4f31e2b1939b05eec2148b44d7cff7e0aeb30e
Reviewed-on: https://go-review.googlesource.com/c/go/+/344329
Trust: Martin Möhrmann &lt;martin@golang.org&gt;
Run-TryBot: Martin Möhrmann &lt;martin@golang.org&gt;
Reviewed-by: Tobias Klauser &lt;tobias.klauser@gmail.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On amd64 this reduces go binary sizes by 176 bytes due to not referencing
internal/cpu.ARM64 and internal/cpu.ARM.

Change-Id: I8e4f31e2b1939b05eec2148b44d7cff7e0aeb30e
Reviewed-on: https://go-review.googlesource.com/c/go/+/344329
Trust: Martin Möhrmann &lt;martin@golang.org&gt;
Run-TryBot: Martin Möhrmann &lt;martin@golang.org&gt;
Reviewed-by: Tobias Klauser &lt;tobias.klauser@gmail.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: use asmcgocall_no_g when calling sigprocmask on openbsd</title>
<updated>2021-08-22T13:54:24+00:00</updated>
<author>
<name>Joel Sing</name>
<email>joel@sing.id.au</email>
</author>
<published>2021-05-30T14:18:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=6416bde023d897dcedc6d53bf0bf58821962f435'/>
<id>6416bde023d897dcedc6d53bf0bf58821962f435</id>
<content type='text'>
sigprocmask is called from sigsave, which is called from needm. As such,
sigprocmask has to be able to run with no g. For some reason we do not
currently trip this on current libc platforms, but we do hit it on
openbsd/mips64 with external linking.

Updates #36435

Change-Id: I4dfae924245c5f68cc012755d6485939014898a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/334879
Trust: Joel Sing &lt;joel@sing.id.au&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
sigprocmask is called from sigsave, which is called from needm. As such,
sigprocmask has to be able to run with no g. For some reason we do not
currently trip this on current libc platforms, but we do hit it on
openbsd/mips64 with external linking.

Updates #36435

Change-Id: I4dfae924245c5f68cc012755d6485939014898a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/334879
Trust: Joel Sing &lt;joel@sing.id.au&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: fix buckHashSize duplication</title>
<updated>2021-08-22T13:11:50+00:00</updated>
<author>
<name>Dmitry Vyukov</name>
<email>dvyukov@google.com</email>
</author>
<published>2020-12-12T15:46:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=96d816c5740f7576ed0f6346f70958ce9ef1e3b4'/>
<id>96d816c5740f7576ed0f6346f70958ce9ef1e3b4</id>
<content type='text'>
We have a constant for 179999, don't duplicate it.

Change-Id: Iefb9c4746f6dda2e08b42e3c978963198469ee8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/277375
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
Run-TryBot: Keith Randall &lt;khr@golang.org&gt;
Run-TryBot: Michael Pratt &lt;mpratt@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Trust: Michael Pratt &lt;mpratt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have a constant for 179999, don't duplicate it.

Change-Id: Iefb9c4746f6dda2e08b42e3c978963198469ee8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/277375
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
Run-TryBot: Keith Randall &lt;khr@golang.org&gt;
Run-TryBot: Michael Pratt &lt;mpratt@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Trust: Michael Pratt &lt;mpratt@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>syscall: add SyscallN</title>
<updated>2021-08-19T17:30:19+00:00</updated>
<author>
<name>Changkun Ou</name>
<email>hi@changkun.de</email>
</author>
<published>2021-07-22T15:50:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=0e598e7da42aea47b6b9d52c4292f202368d2f19'/>
<id>0e598e7da42aea47b6b9d52c4292f202368d2f19</id>
<content type='text'>
This CL adds a new syscall.SyscallN API.

The proposal discussion also suggests the API should not only for
Windows but other platforms. However, the existing API set already
contain differences between platforms, hence the CL only implements
the Windows platform.

Moreover, although the API offers variadic parameters, the permitted
parameters remains up to a limit, which is selected as 42, and arguably
large enough.

Fixes #46552

Change-Id: I66b49988a304d9fc178c7cd5de46d0b75e167a4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/336550
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Matthew Dempsky &lt;mdempsky@google.com&gt;
Trust: Matthew Dempsky &lt;mdempsky@google.com&gt;
Trust: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This CL adds a new syscall.SyscallN API.

The proposal discussion also suggests the API should not only for
Windows but other platforms. However, the existing API set already
contain differences between platforms, hence the CL only implements
the Windows platform.

Moreover, although the API offers variadic parameters, the permitted
parameters remains up to a limit, which is selected as 42, and arguably
large enough.

Fixes #46552

Change-Id: I66b49988a304d9fc178c7cd5de46d0b75e167a4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/336550
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Matthew Dempsky &lt;mdempsky@google.com&gt;
Trust: Matthew Dempsky &lt;mdempsky@google.com&gt;
Trust: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: use RDCYCLE for cputicks on riscv64</title>
<updated>2021-08-18T02:08:09+00:00</updated>
<author>
<name>Meng Zhuo</name>
<email>mzh@golangcn.org</email>
</author>
<published>2021-07-06T07:17:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=946e2543f878929752da9d16575dd5e96ac78532'/>
<id>946e2543f878929752da9d16575dd5e96ac78532</id>
<content type='text'>
Use RDCYCLE instruction instead of RDTIME emulation

Change-Id: Id7b3de42a36d2d1b163c39cc79870eee7c840ad5
Reviewed-on: https://go-review.googlesource.com/c/go/+/332954
Trust: Meng Zhuo &lt;mzh@golangcn.org&gt;
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use RDCYCLE instruction instead of RDTIME emulation

Change-Id: Id7b3de42a36d2d1b163c39cc79870eee7c840ad5
Reviewed-on: https://go-review.googlesource.com/c/go/+/332954
Trust: Meng Zhuo &lt;mzh@golangcn.org&gt;
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>all: fix typos</title>
<updated>2021-08-17T13:54:10+00:00</updated>
<author>
<name>Yasuhiro Matsumoto</name>
<email>mattn.jp@gmail.com</email>
</author>
<published>2021-07-23T13:28:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=4012fea822763ef3aa66dd949fa95b9f8d89450a'/>
<id>4012fea822763ef3aa66dd949fa95b9f8d89450a</id>
<content type='text'>
Change-Id: I83180c472db8795803c1b9be3a33f35959e4dcc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/336889
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
Reviewed-by: Austin Clements &lt;austin@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I83180c472db8795803c1b9be3a33f35959e4dcc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/336889
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
Reviewed-by: Austin Clements &lt;austin@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: accept restartable sequence pcdata values in isAsyncSafePoint</title>
<updated>2021-08-16T23:32:14+00:00</updated>
<author>
<name>Cherry Mui</name>
<email>cherryyz@google.com</email>
</author>
<published>2021-08-04T23:41:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=8ff16c19909e5aecf51c6b993cba36ea51791f34'/>
<id>8ff16c19909e5aecf51c6b993cba36ea51791f34</id>
<content type='text'>
If the pcdata value indicates a restartable sequence, it is okay
to asynchronously preempt (and resume at the restart PC). Accept
it in isAsyncSafePoint.

Fixes #47530.

Change-Id: I419225717c8eee5812f3235338262da5895aad0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/340011
Trust: Cherry Mui &lt;cherryyz@google.com&gt;
Run-TryBot: Cherry Mui &lt;cherryyz@google.com&gt;
Reviewed-by: Joel Sing &lt;joel@sing.id.au&gt;
Reviewed-by: Austin Clements &lt;austin@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the pcdata value indicates a restartable sequence, it is okay
to asynchronously preempt (and resume at the restart PC). Accept
it in isAsyncSafePoint.

Fixes #47530.

Change-Id: I419225717c8eee5812f3235338262da5895aad0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/340011
Trust: Cherry Mui &lt;cherryyz@google.com&gt;
Run-TryBot: Cherry Mui &lt;cherryyz@google.com&gt;
Reviewed-by: Joel Sing &lt;joel@sing.id.au&gt;
Reviewed-by: Austin Clements &lt;austin@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>runtime: skip sysmon workaround on NetBSD &gt;= 9.2</title>
<updated>2021-08-16T21:24:44+00:00</updated>
<author>
<name>Tobias Klauser</name>
<email>tklauser@distanz.ch</email>
</author>
<published>2021-06-03T14:57:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=6406227d71d2de0bec944bfc1a6aaed90dbf9d0d'/>
<id>6406227d71d2de0bec944bfc1a6aaed90dbf9d0d</id>
<content type='text'>
Detect the NetBSD version in osinit and only enable the workaround for
the kernel bug identified in #42515 for NetBSD versions older than 9.2.

For #42515
For #46495

Change-Id: I808846c7f8e47e5f7cc0a2f869246f4bd90d8e22
Reviewed-on: https://go-review.googlesource.com/c/go/+/324472
Trust: Tobias Klauser &lt;tobias.klauser@gmail.com&gt;
Trust: Benny Siegert &lt;bsiegert@gmail.com&gt;
Run-TryBot: Tobias Klauser &lt;tobias.klauser@gmail.com&gt;
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Detect the NetBSD version in osinit and only enable the workaround for
the kernel bug identified in #42515 for NetBSD versions older than 9.2.

For #42515
For #46495

Change-Id: I808846c7f8e47e5f7cc0a2f869246f4bd90d8e22
Reviewed-on: https://go-review.googlesource.com/c/go/+/324472
Trust: Tobias Klauser &lt;tobias.klauser@gmail.com&gt;
Trust: Benny Siegert &lt;bsiegert@gmail.com&gt;
Run-TryBot: Tobias Klauser &lt;tobias.klauser@gmail.com&gt;
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
