Demonstrate and fix SIGBUS problems on sparc64#504
Demonstrate and fix SIGBUS problems on sparc64#504petterreinholdtsen wants to merge 2 commits intoberkeley-abc:masterfrom
Conversation
|
It now get SIGBUS in this code: I am completely perplexed, as gdb as far as I can tell, report that both p and p->pEntriesFree are pointers with 8 byte alignment, which as far as I could tell is the most sparc64 can demand. I tried with the following patch, slowly growing as my confusion grew: It crashes when reading p, when fetching the address of p, and of course when trying to fetch p->nChunkSize. I believe I am going to need help with this one, and that it was time to report it here. |
|
Further tries to pinpoint the crash locate it just after a call to calloc(): I do not understand how changing the content of the struct can make the pointer to the struct invalid. |
ee63660 to
ad13915
Compare
|
I was able to figure out what caused my confusion. The build dependencies were not working as expected, and editing the source did not cause a full rebuild, so I was looking at new source with a crash in the old build. With that out of the way I managed to fix more alignment issues, but in the end ran out of time and decided to put the issue aside for now. The provided patches fixes some crashes, but not all of them. I suspect the misaligned memory accesses causes slowdown on more forgiving architectures like x86, and that fixing the alignment issues could speed up the process. I noticed the self testing failed because of timeout after 10000 seconds on ppc64el and hope that fixing alignment issues might get the tests to complete a bit quicker. Perhaps someone with more spare time than me can pick up where I left. |
The self test of yosys exercising abc currently crash with SIGBUS on sparc64. This is most likely caused by incorrect memory alignment accesses. The added test was lifted from yosys to make it easy to trigger the crash, and the modified ABC_MEMALIGN handling move the alignment selection out of the makefile and into the C++ code where it is needed.
The code still crashes, but now in a different location for a different reason.