aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/netpoll_aix.go
AgeCommit message (Collapse)Author
2024-03-25runtime: migrate internal/atomic to internal/runtimeAndy Pan
For #65355 Change-Id: I65dd090fb99de9b231af2112c5ccb0eb635db2be Reviewed-on: https://go-review.googlesource.com/c/go/+/560155 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ibrahim Bazoka <ibrahimbazoka729@gmail.com> Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
2023-07-20runtime: adjust netpollWaiters after goroutines are readyIan Lance Taylor
The runtime was adjusting netpollWaiters before the waiting goroutines were marked as ready. This could cause the scheduler to report a deadlock because there were no goroutines ready to run. Keeping netpollWaiters non-zero ensures that at least one goroutine will call netpoll(-1) from findRunnable. This does mean that if a program has network activity for a while and then never has it again, and also has no timers, then we can leave an M stranded in a call to netpoll from which it will never return. At least this won't be a common case. And it's not new; this has been a potential problem for some time. Fixes #61454 Change-Id: I17c7f891c2bb1262fda12c6929664e64686463c8 Reviewed-on: https://go-review.googlesource.com/c/go/+/511455 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-04-18runtime: add and use pollDesc fd sequence fieldIan Lance Taylor
It is possible for a netpoll file to be closed and for the pollDesc to be reused while a netpoll is running. This normally only causes spurious wakeups, but if there is an error on the old file then the new file can be incorrectly marked as having an error. Fix this problem on most systems by introducing an fd sequence field and using that as a tag in a taggedPointer. The taggedPointer is stored in epoll or kqueue or whatever is being used. If the taggedPointer returned by the kernel has a tag that does not match the fd sequence field, the notification is for a closed file, and we can ignore it. We check the tag stored in the pollDesc, and we also check the tag stored in the pollDesc.atomicInfo. This approach does not work on 32-bit systems where the kernel only provides a 32-bit field to hold a user value. On those systems we continue to use the older method without the sequence protection. This is not ideal, but it is not an issue on Linux because the kernel provides a 64-bit field, and it is not an issue on Windows because there are no poller errors on Windows. It is potentially an issue on *BSD systems, but on those systems we already call fstat in newFile in os/file_unix.go to avoid adding non-pollable files to kqueue. So we currently don't know of any cases that will fail. Fixes #59545 Change-Id: I9a61e20dc39b4266a7a2978fc16446567fe683ac Reviewed-on: https://go-review.googlesource.com/c/go/+/484837 Auto-Submit: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Orlando Labao <orlando.labao43@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Bypass: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Bypass: Ian Lance Taylor <iant@golang.org>
2022-08-17runtime: convert aix netpollWakeSig to atomic typeCuong Manh Le
Updates #53821 Change-Id: Ic073871ed2638ca22e6cb057dd8297f27582e78f Reviewed-on: https://go-review.googlesource.com/c/go/+/423877 Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2022-08-09runtime: refine code reducing indents in netpollBreak()Andy Pan
Change-Id: I2d1528910cb3660344c7a664d6f32306defe75d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/419321 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Pratt <mpratt@google.com>
2022-04-05all: separate doc comment from //go: directivesRuss Cox
A future change to gofmt will rewrite // Doc comment. //go:foo to // Doc comment. // //go:foo Apply that change preemptively to all comments (not necessarily just doc comments). For #51082. Change-Id: Iffe0285418d1e79d34526af3520b415a12203ca9 Reviewed-on: https://go-review.googlesource.com/c/go/+/384260 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-01-14runtime: fix net poll racesRuss Cox
The netpoll code was written long ago, when the only multiprocessors that Go ran on were x86. It assumed that an atomic store would trigger a full memory barrier and then used that barrier to order otherwise racy access to a handful of fields, including pollDesc.closing. On ARM64, this code has finally failed, because the atomic store is on a value completely unrelated to any of the racily-accessed fields, and the ARMv8 hardware, unlike x86, is clever enough not to do a full memory barrier for a simple atomic store. We are seeing a constant background rate of trybot failures where the net/http tests deadlock - a netpollblock has clearly happened after the pollDesc has begun to close. The code that does the racy reads is netpollcheckerr, which needs to be able to run without acquiring a lock. This CL fixes the race, without introducing unnecessary inefficiency or deadlock, by arranging for every updater of the relevant fields to publish a summary as a single atomic uint32, and then having netpollcheckerr use a single atomic load to fetch the relevant bits and then proceed as before. Fixes #45211 (until proven otherwise!). Change-Id: Ib6788c8da4d00b7bda84d55ca3fdffb5a64c1a0a Reviewed-on: https://go-review.googlesource.com/c/go/+/378234 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Trust: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-10runtime: replace the type of netpollWakeSig from a uintptr to a uint32Andy Pan
There's no need for netpollWakeSig to use a uintptr type, a uint32 is enough. Relevant CL: CL 212737 Change-Id: Ide24478b217a02bad62f7e000a9680c26a8c5366 Reviewed-on: https://go-review.googlesource.com/c/go/+/227798 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-28runtime: avoid racing on pendingUpdates in AIX netpollBreakIan Lance Taylor
Instead of calling netpollwakeup, just do the write in netpollBreak. Use the same signaling we now use in other netpollBreak instances. Change-Id: I53a65c22862ecc8484aee91d0e1ffb21a9e62d8c Reviewed-on: https://go-review.googlesource.com/c/go/+/226199 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-03-28Revert "runtime: lock mtxpoll in AIX netpollBreak"Ian Lance Taylor
This reverts CL 225618. This is causing TestNetpollBreak to fail on AIX more often than not. Change-Id: Ia3c24041ead4b320202f7f5b17a6b286f639a689 Reviewed-on: https://go-review.googlesource.com/c/go/+/226198 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-27runtime: lock mtxpoll in AIX netpollBreakIan Lance Taylor
netpollBreak calls netpollwakeup, and netpollwakeup expects the mtxpoll lock to be held, so that it has exclusive access to pendingUpdates. Not acquiring the lock was a mistake in CL 171824. Fortunately it rarely matters in practice. Change-Id: I32962ec2575c846ef3d6a91a4d821b2ff02d983c Reviewed-on: https://go-review.googlesource.com/c/go/+/225618 Reviewed-by: Michael Knyszek <mknyszek@google.com>
2020-03-23runtime: correct the system-call name of kevent in commentAndy Pan
Change-Id: Ib1f4a6f7e36d28eff39f597df5c4703bf62654a4 GitHub-Last-Rev: 15ea1b9fa846737bd5d30b7b98d8933f9992e5c7 GitHub-Pull-Request: golang/go#37994 Reviewed-on: https://go-review.googlesource.com/c/go/+/224590 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-30runtime: fix netpollBreak for AIXClément Chigot
Change-Id: I2629711ce02d935130fb2aab29f9028b62ba9fe6 Reviewed-on: https://go-review.googlesource.com/c/go/+/204318 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-21runtime: add netpollBreakIan Lance Taylor
The new netpollBreak function can be used to interrupt a blocking netpoll. This function is not currently used; it will be used by later CLs. Updates #27707 Change-Id: I5cb936609ba13c3c127ea1368a49194fc58c9f4d Reviewed-on: https://go-review.googlesource.com/c/go/+/171824 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-20runtime: define nonblockingPipeIan Lance Taylor
This requires defining pipe, pipe2, and setNonblock for various platforms. The new function is currently only used on AIX. It will be used by later CLs in this series. Updates #27707 Change-Id: Id2f987b66b4c66a3ef40c22484ff1d14f58e9b31 Reviewed-on: https://go-review.googlesource.com/c/go/+/171822 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-15runtime: change netpoll to take an amount of time to blockIan Lance Taylor
This new facility will be used by future CLs in this series. Change the only blocking call to netpoll to do the right thing when netpoll returns an empty list. Updates #6239 Updates #27707 Change-Id: I58b3c2903eda61a3698b1a4729ed0e81382bb1ed Reviewed-on: https://go-review.googlesource.com/c/go/+/171821 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-04-12runtime: remove debug prints in netpoll_aix.goClément Chigot
Change-Id: I80cca386de23cde39ab4ed3be9878374dc7607ec Reviewed-on: https://go-review.googlesource.com/c/go/+/171721 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-19runtime, internal/poll: report only critical event scanning errorMikio Hara
This change makes the runtime-integrated network poller report only critical event scanning errors. In the previous attempt, CL 166497, we treated any combination of error events as event scanning errors and it caused false positives in event waiters because platform-dependent event notification mechanisms allow event originators to use various combination of events. To avoid false positives, this change makes the poller treat an individual error event as a critical event scanning error by the convention of event notification mechanism implementations. Updates #30624. Fixes #30817. Fixes #30840. Change-Id: I906c9e83864527ff73f636fd02bab854d54684ea Reviewed-on: https://go-review.googlesource.com/c/go/+/167777 Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-13runtime, internal/poll, net: report event scanning error on read eventMikio Hara
This change makes it possible the runtime-integrated network poller and APIs in the package internal/poll to report an event scanning error on a read event. The latest Go releases open up the way of the manipulation of the poller for users. On the other hand, it starts misleading users into believing that the poller accepts any user-configured file or socket perfectly because of not reporting any error on event scanning, as mentioned in issue 30426. The initial implementation of the poller was designed for just well-configured, validated sockets produced by the package net. However, the assumption is now obsolete. Fixes #30624. Benchmark results on linux/amd64: benchmark old ns/op new ns/op delta BenchmarkTCP4OneShot-4 24649 23979 -2.72% BenchmarkTCP4OneShotTimeout-4 25742 24411 -5.17% BenchmarkTCP4Persistent-4 5139 5222 +1.62% BenchmarkTCP4PersistentTimeout-4 4919 4892 -0.55% BenchmarkTCP6OneShot-4 21182 20767 -1.96% BenchmarkTCP6OneShotTimeout-4 23364 22305 -4.53% BenchmarkTCP6Persistent-4 4351 4366 +0.34% BenchmarkTCP6PersistentTimeout-4 4227 4255 +0.66% BenchmarkTCP4ConcurrentReadWrite-4 2309 1839 -20.36% BenchmarkTCP6ConcurrentReadWrite-4 2180 1791 -17.84% benchmark old allocs new allocs delta BenchmarkTCP4OneShot-4 26 26 +0.00% BenchmarkTCP4OneShotTimeout-4 26 26 +0.00% BenchmarkTCP4Persistent-4 0 0 +0.00% BenchmarkTCP4PersistentTimeout-4 0 0 +0.00% BenchmarkTCP6OneShot-4 26 26 +0.00% BenchmarkTCP6OneShotTimeout-4 26 26 +0.00% BenchmarkTCP6Persistent-4 0 0 +0.00% BenchmarkTCP6PersistentTimeout-4 0 0 +0.00% BenchmarkTCP4ConcurrentReadWrite-4 0 0 +0.00% BenchmarkTCP6ConcurrentReadWrite-4 0 0 +0.00% benchmark old bytes new bytes delta BenchmarkTCP4OneShot-4 2000 2000 +0.00% BenchmarkTCP4OneShotTimeout-4 2000 2000 +0.00% BenchmarkTCP4Persistent-4 0 0 +0.00% BenchmarkTCP4PersistentTimeout-4 0 0 +0.00% BenchmarkTCP6OneShot-4 2144 2144 +0.00% BenchmarkTCP6OneShotTimeout-4 2144 2145 +0.05% BenchmarkTCP6Persistent-4 0 0 +0.00% BenchmarkTCP6PersistentTimeout-4 0 0 +0.00% BenchmarkTCP4ConcurrentReadWrite-4 0 0 +0.00% BenchmarkTCP6ConcurrentReadWrite-4 0 0 +0.00% Change-Id: Iab60e504dff5639e688dc5420d852f336508c0af Reviewed-on: https://go-review.googlesource.com/c/go/+/166497 Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-03runtime: add AIX operating systemClément Chigot
This commit adds AIX operating system to runtime package for ppc64 architecture. Only new files and minor changes are in this commit. Others modifications in files like asm_ppc64.s will be in separate commits. Updates: #25893 Change-Id: I9c5e073f5f3debb43b004ad1167694a5afd31cfd Reviewed-on: https://go-review.googlesource.com/c/138716 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>