Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: on linux/PPC64, usleep computes incorrect tv_nsec parameter #56374

Closed
pmur opened this issue Oct 21, 2022 · 3 comments
Closed

runtime: on linux/PPC64, usleep computes incorrect tv_nsec parameter #56374

pmur opened this issue Oct 21, 2022 · 3 comments
Assignees
Labels
arch-ppc64x compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge

Comments

@pmur
Copy link
Contributor

pmur commented Oct 21, 2022

While investigating high context switch numbers in the runtime, it was discovered the PPC64 implementation of usleep passes incorrect values to the tv_nsec parameter of the nanosleep syscall. It fails to convert the remainder microseconds to nanoseconds. This can be observed with perf stat on simple benchmarks. The high context-switch rate was related to sysmon polling at 1000x the desired rate.

@golang/ppc64

@pmur pmur added arch-ppc64x compiler/runtime Issues related to the Go compiler and/or runtime. labels Oct 21, 2022
@pmur pmur self-assigned this Oct 21, 2022
@gopherbot
Copy link

Change https://go.dev/cl/444735 mentions this issue: runtime: fix usleep on PPC64

@pmur
Copy link
Contributor Author

pmur commented Oct 24, 2022

@gopherbot please consider a backport to 1.18 and 1.19. This is a subtle bug.

@gopherbot
Copy link

Backport issue(s) opened: #56396 (for 1.18), #56397 (for 1.19).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

romaindoumenc pushed a commit to TroutSoftware/go that referenced this issue Nov 3, 2022
The existing implementation fails to convert the remainder
microseconds to nanoseconds. This causes sysmon to consume
much more cpu, and generate lots of context switches.

We can also do a little better here to avoid division by a
constant. I used go to determine the magic numbers.

Fixes golang#56374

Change-Id: I2e37ec218b9027efab6db4634eed1504c0c1b3c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/444735
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
@golang golang locked and limited conversation to collaborators Oct 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-ppc64x compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants