-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: procyield doesn't use yield instruction on ARM, unlike ARM64 #16663
Comments
/cc @cherrymui |
add @minux, who might know the original idea. |
YIELD is only available in ARMv6K and above.
Yet another reason for dropping ARMv6/v5 support in #17082.
|
@minux, based on my reading of the ARM spec, it sounds like CPUs that don't support YIELD will just interpret it as a NOP. If so, it would be harmless to add to procyield. |
Taking another look at this, ARMv7 skirts around clearly stating that YIELD is a NOP on earlier architectures, but I'm pretty sure it is. Based on the instruction encoding, on ARMv5 it will be interpreted as an MSR instruction with
If I'm following the pseudo-code correctly, the ultimate effect of this will be CPSR = CPSR. In other words, a NOP. |
CL https://golang.org/cl/45250 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
go version
)?Master
go env
)?ARM
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
code inspection:
go/src/runtime/asm_arm.s
Line 971 in 690de51
I have not had a problem with this myself, just happened to notice it.
Use of the
YIELD
instruction, which exists on ARMv6K and newer per http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/Cjafcggi.html Presumably, this would need some kind of architecture gating, because Go supports ARMv5 and ARMv6: https://github.com/golang/go/wiki/GoArmBusy-wait with no
YIELD
, unlike the ARM64 version:go/src/runtime/asm_arm64.s
Line 473 in 690de51
Note that it could be the case that the ARM64 version is in error, since
runtime.procyield
takes a loop count and (according to the linked ARM documentation)YIELD
may cause the thread to be suspended.The text was updated successfully, but these errors were encountered: