-
Notifications
You must be signed in to change notification settings - Fork 18k
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
syscall: EpollEvent struct incorrect for ppc64/ppc64le #15135
Comments
Try adding: diff --git a/src/syscall/types_linux.go b/src/syscall/types_linux.go
index 9bccfca..3a105a4 100644
--- a/src/syscall/types_linux.go
+++ b/src/syscall/types_linux.go
@@ -117,6 +117,9 @@ struct my_epoll_event {
// alignment requirements of EABI
int32_t padFd;
#endif
+#ifdef __powerpc64__
+ int32_t _pad;
+#endif
int32_t fd;
int32_t pad;
}; And then regenerating it, then send a CL with both changes. |
OK, this is what I tried, but didn't know I had to do something Also, this fixes the size but doesn't it matter that the members of the In runtime/defs_linux_ppc64le.go it looks right: type epollevent struct { On 04/05/2016 01:41 PM, Brad Fitzpatrick wrote:
|
Probably. Or whatever it says at the top of the file.
It's a C union. Can't do much better. Users can manipulate the two 32-bit fields as needed, using unsafe if necessary. It's consistent with what we do elsewhere. |
I created this CL https://go-review.googlesource.com/#/c/21582/ I just realized I still need to add the ppc64 change.... will do that now. |
Okay, we really need to figure out why the auto-generation isn't working then. Hand-editing the z* files is just asking for pain later. |
CL https://golang.org/cl/21582 mentions this issue. |
If I just run mkall.sh like this: GOOS=linux GOARCH=ppc64le ./mkall.sh from the syscall directory then there are changes made to these files:
Instead if I use -n to show me the commands, I think I only need this one: GOARCH=ppc64le go tool cgo -godefs types_linux.go |go run mkpost.go >ztypes_linux_ppc64le.go But if I run that one alone it adds more changes than just to the epoll struct and removes the build tag. I see that the mkpost.go change was recent so I tried without that and got a lot more changes to the file. Would I get different changes to these files if I ran this on different distros? |
I think so. I saw quite a few changes moving between RHEL 7 and Ubuntu 16.04. In particular I think the names of the padding fields has a habit of changing and there may be constants added/removed/changed.
I don't think you should see any fewer changes because of mkpost.go. It should only do 'gofmt' on ppc64. It would be nice to add the build tag generation to it. I think these been added manually: https://go-review.googlesource.com/#/c/10113/ |
Here is patch showing the changes to ztypes_linux_ppc64le.go if I just pull latest master and run: This was done on RHEL7.2 ppc64, but the same kind of patch shows up on Ubuntu 14.04 & 14.10 ppc64le. I see if I can try a later Ubuntu. If I remove the pipe through mkpost.go, the differences are due to formatting. |
The The fields that are removed are of length 0... I guess technically they shouldn't be removed due to API promises, but I don't see what practical use they could have (marker for the end of the struct perhaps?). |
@bradfitz I missed your earlier request to update the CLs with the regenerated files. I just did the update as you requested earlier but I did change the patch so it didn't remove the build tags. |
@bradfitz In mkpost.go there is this code, only done for s390x:
I believe you were asking in the CL to replace unwanted fields with _ as is done in the 3rd regexp above, so I can move that below the if test and then it will be done for all GOARCHes instead of just s390x. But what about the replacement of padding fields with _ as in the 2nd regexp above? Should that be done for all GOARCHes too? |
FYI, I've just rebuilt go using Lynn's patch to see if it fixed a docker hang we were seeing (on ppc64le), and it did. 👍 |
I was out for a few days.... This is a high priority for us because it affects the upstream Docker CI build on ppc64le and would like to get the golang fix upstream so Ubuntu can pick it up. I have updated the mkpost.go change according to the earlier suggestion by @bradfitz. Let me know what else needs to be done so we can get this in ASAP. Thanks. |
Based on Ian's latest comments I have reverted my patch back to the minimum change needed to ztypes_linux_ppc64le.go and ztypes_linux_ppc64.go to fix the EpollEvent structure on these GOARCHes along with the change in types_linux.go. Trying to use the file generation scripts result in changes unrelated to this problem and introduce incompatibilities. I can open a new issue for the file generation problem if that is what should be done. |
(Sorry, just asked on the CL what you answered here.) I don't really mind if you revert unwanted changes to the ztypes files, but I do want to ensure that the changes you do make are ones produced by |
Not quite. Let me change the ztypes_* files so they match what gets generated, revert what shouldn't be there, and retest on both to make sure it's all good. |
Can this be backported to go1.6? |
CL https://golang.org/cl/22207 mentions this issue. |
The existing epoll_event structure used by many of the epoll_* syscalls was defined incorrectly for use with ppc64le & ppc64 in the syscall directory. This resulted in the caller getting incorrect information on return from these syscalls. This caused failures in fsnotify as well as builds with upstream Docker. The structure is defined correctly in gccgo. This adds a pad field that is expected for these syscalls on ppc64le, ppc64. Fixes #15135 Fixes #15288 Change-Id: If7e8ea9eb1d1ca5182c8dc0f935b334127341ffd Reviewed-on: https://go-review.googlesource.com/21582 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/22207 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Please answer these questions before submitting your issue. Thanks!
go version
)?Fails on both golang master and golang 1.6
go env
)?ppc64le Ubuntu 15.04 and ppc64 RHEL 7.2 same failures
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
Tried to build and run fsnotify tests from github.com/fsnotify.
No build or test failures.
Many test failures with golang; most golang failures will pass with gccgo but one hang there too.
I can see the first problem is that the epoll_event structure being passed to the epoll syscalls is not the same size or contents between gccgo and golang but continuing to investigate and understand the hang mentioned.
To reproduce:
go get -u github.com/fsnotify/fsnotify
cd src/fsnotify/fsnotify
go test -c
On master I see this output:
./fsnotify.test -test.run=Poller
--- FAIL: TestPollerWithData (0.00s)
inotify_poller_test.go:85: expected poller to return true
--- FAIL: TestPollerWithClose (0.00s)
inotify_poller_test.go:119: expected poller to return true
--- FAIL: TestPollerWithWakeupAndData (0.00s)
inotify_poller_test.go:140: expected poller to return true
--- FAIL: TestPollerConcurrent (0.05s)
inotify_poller_test.go:197: expected true
FAIL
If the 'go' tool used corresponds to gccgo then none of these failures occur. Through debugging I have found that argument size for the event information passed to the syscall is incorrect in golang.
Interestingly, there is also some epoll syscalls made in the runtime package and those use a different structure (from defs_linux_ppc64le.go) which looks right:
type epollevent struct {
events uint32
pad_cgo_0 [4]byte
data [8]byte // unaligned uintptr
}
Here is the declaration in syscall/ztypes_linux_ppc64le.go which is not correct:
type EpollEvent struct {
Events uint32
Fd int32
Pad int32
}
I tried to make a change to linux_defs.go to my_epoll_event but that didn't change the generated structure for me so thought it was time to open the issue.
The text was updated successfully, but these errors were encountered: