-
Notifications
You must be signed in to change notification settings - Fork 29.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
s390: v8tests.cctest/test-platform/StackAlignment in v8 tests #7659
Comments
Looks like the test is checking stack alignment requirement is met. I could not reproduce it on our systems. |
Compiler issue, maybe? The test executes this on s390x: __asm__ __volatile__("stg 15, %0" : "=g"(sp_addr)); Perhaps it solves the constraint in a way that emits wrong/illegal code? @mhdawson If you can get a disassembly of the GetStackPointer() function, that might be helpful. |
Managed to reproduce this on a local system. @bnoordhuis was on the right track.
We crashed on the STG, which ended up generating the wrong memory reference... -450104 doesn't look right at all. Need to dig into how the compiler expanded the sp_addr in the inlined asm. GCC compiler level:
|
Looking at the object file, we do see a reloc entry for the stg to reference sp_addr. Except, it's uncertain how you can manage to reference the static without a proper base register... it's as if the compiler has confused stg's memory operand as a relative offset instead.
Interestingly, compiling with GCC 4.8.3, we get a slightly different sequence with an extra
|
Would changing the constraint from =g to =r suffice as a workaround for now? Untested: diff --git a/deps/v8/test/cctest/test-platform.cc b/deps/v8/test/cctest/test-platform.cc
index 6012fd4..abcb475 100644
--- a/deps/v8/test/cctest/test-platform.cc
+++ b/deps/v8/test/cctest/test-platform.cc
@@ -25,7 +25,7 @@ void GetStackPointer(const v8::FunctionCallbackInfo<v8::Value>& args) {
#elif V8_HOST_ARCH_MIPS64
__asm__ __volatile__("sd $sp, %0" : "=g"(sp_addr));
#elif defined(__s390x__) || defined(_ARCH_S390X)
- __asm__ __volatile__("stg 15, %0" : "=g"(sp_addr));
+ __asm__ __volatile__("stg 15, %0" : "=r"(sp_addr));
#elif defined(__s390__) || defined(_ARCH_S390)
__asm__ __volatile__("st 15, %0" : "=g"(sp_addr));
#elif defined(__PPC64__) || defined(_ARCH_PPC64) |
I believe what we want instead is =m, to force the sp_addr to be a memory operand. |
Sorry, was swamped today with other stuff. I've confirmed that =m constraint does resolve the issue. In this case, it's the more proper choice, given the specific assembly instruction (stg) we are trying to use. We don't have to rely on the compiler to try to work out which of the operand variants to treat the 'general' constraint. I'd like to make the change to this into V8 as well, and will float it back over once it's committed there. |
V8 CL .. pending approval: https://codereview.chromium.org/2158523002/ |
Original commit message: S390:Update inline asm constraint in test-platform The GetStackPointer() routine in test-platform uses an inline assembly code to store the current stack pointer value into a static variable sp_addr. The existing asm code for S390 uses an ST/STG instruction, with the memory operand associated with the general ('=g') constraint to sp_addr. On GCC 4.8.5, the GCC compiler got confused and treated sp_addr as an integer operand instead of memory operand, resulting in a store being emitted that writes to an invalid meory location. Given the specific store instructions being inlined here, we should restict the sp_addr operand to explicitly be a memory operand using '=m' instead of '=g'. [email protected],[email protected],[email protected],[email protected] BUG= Review-Url: https://codereview.chromium.org/2158523002 Cr-Commit-Position: refs/heads/master@{nodejs#37809} Fixes: nodejs#7659
Original commit message: S390:Update inline asm constraint in test-platform The GetStackPointer() routine in test-platform uses an inline assembly code to store the current stack pointer value into a static variable sp_addr. The existing asm code for S390 uses an ST/STG instruction, with the memory operand associated with the general ('=g') constraint to sp_addr. On GCC 4.8.5, the GCC compiler got confused and treated sp_addr as an integer operand instead of memory operand, resulting in a store being emitted that writes to an invalid meory location. Given the specific store instructions being inlined here, we should restict the sp_addr operand to explicitly be a memory operand using '=m' instead of '=g'. [email protected],[email protected],[email protected],[email protected] BUG= Review-Url: https://codereview.chromium.org/2158523002 Cr-Commit-Position: refs/heads/master@{nodejs#37809} Fixes: nodejs#7659 PR-URL: nodejs#7771 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Ali Ijaz Sheikh <[email protected]>
Original commit message: S390:Update inline asm constraint in test-platform The GetStackPointer() routine in test-platform uses an inline assembly code to store the current stack pointer value into a static variable sp_addr. The existing asm code for S390 uses an ST/STG instruction, with the memory operand associated with the general ('=g') constraint to sp_addr. On GCC 4.8.5, the GCC compiler got confused and treated sp_addr as an integer operand instead of memory operand, resulting in a store being emitted that writes to an invalid meory location. Given the specific store instructions being inlined here, we should restict the sp_addr operand to explicitly be a memory operand using '=m' instead of '=g'. [email protected],[email protected],[email protected],[email protected] BUG= Review-Url: https://codereview.chromium.org/2158523002 Cr-Commit-Position: refs/heads/master@{nodejs#37809} Fixes: nodejs#7659 PR-URL: nodejs#7771 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Ali Ijaz Sheikh <[email protected]>
Just added s390 to the v8 tests we run nightly. Shows failure in these tests:
https://ci.nodejs.org/job/node-test-commit-v8-linux/nodes=rhel72-s390x,v8test=v8test/196/
We don't see these failures in the google sim runs for 390 nor do we see them in our internal builds on real hardware for 5.1
The text was updated successfully, but these errors were encountered: