ColinIanKing / stress-ng

This is the stress-ng upstream project git repository. stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.
https://github.com/ColinIanKing/stress-ng
GNU General Public License v2.0
1.82k stars 290 forks source link

Build issue with V0.18.03 on Ubuntu Bionic s390x #417

Closed Cypresslin closed 3 months ago

Cypresslin commented 3 months ago

Hello Colin, while testing V0.18.03 on Bionic s390x I noticed that the test build become very slow when compiling stress-vecfp.c and stress-vecwide.c

This is for stress-vecwide.c, which seems to be never-ending.

$ ps aux | grep stress
ubuntu    5010  0.0  0.0   6584   616 pts/0    S+   06:20   0:00 cc -Wall -Wextra -DVERSION="0.18.03" -std=gnu99 -O2 -Wformat -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Werror=format-security -fipa-pta -fivopts -fmodulo-sched -c -o stress-vecwide.o stress-vecwide.c
ubuntu    5011 99.8  2.0  90432 80432 pts/0    R+   06:20  20:31 /usr/lib/gcc/s390x-linux-gnu/7/cc1 -quiet -imultiarch s390x-linux-gnu -D VERSION="0.18.03" -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 stress-vecwide.c -quiet -dumpbase stress-vecwide.c -march=zEC12 -m64 -mzarch -auxbase-strip stress-vecwide.o -O2 -Wall -Wextra -Wformat=1 -Werror=format-security -std=gnu99 -fstack-protector-strong -fipa-pta -fivopts -fmodulo-sched -fstack-protector-strong -Wformat-security -o /tmp/ccRl4KGR.s
ubuntu    5982  0.0  0.0   6020   700 pts/3    S+   06:41   0:00 grep --color=auto stress

(I did left the test build overnight, after 14 hours it's still running. But I don't have the output anymore, can't tell you if it's hanging on the same point.)

Bisect indicates this might be the the cause:

f790e88c6edad780888c61ea085ad948d42b2131 is the first bad commit
commit f790e88c6edad780888c61ea085ad948d42b2131
Author: Colin Ian King <colin.i.king@gmail.com>
Date:   Mon Aug 12 13:57:48 2024 +0100

    Makefile: add -fivopts -fmodulo-sched optimization options

    There improve performance on the majority of compute based
    stressors, so add these.

    Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

:100644 100644 db76fce81cbefc77060b044088f203d4078c91b4 6cc3a6ec587516be3b74b4273acdc8ab3d4fad18 M  Makefile

Reverting this commit can solve this build issue on B-s390x.

To be more precise, it's the -fmodulo-sched flag, result without this flag:

$ time cc -Wall -Wextra -DVERSION="0.18.03" -std=gnu99 -O2 -Wformat -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Werror=format-security -fipa-pta -fivopts -c -o stress-vecwide.o stress-vecwide.c

real    0m1.188s
user    0m1.151s
sys 0m0.034s

gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

ColinIanKing commented 3 months ago

Yes, this is an issue with the compiler. I'll add some compiler and arch specific workarounds :-(

ColinIanKing commented 3 months ago

thanks for reporting this, I've pushed a fix to address this issue, it detects the target arch and if s390x it disables the optimization flag that's causing the issue.


commit c0e59da0b3619e58d87d9dedb98d5d3dc53ab2ae (HEAD -> master, origin/master, origin/HEAD)
Author: Colin Ian King <colin.i.king@gmail.com>
Date:   Tue Sep 3 10:44:09 2024 +0100

    Makefile: improve machine detection and disable -fmodulo-sched for S390x builds
Gorkem-Kilinc commented 3 weeks ago

Hi Colin, we started seeing this issue again after the transition from readelf to objdump in Makefile.machine (7c1b860ef6574f8533e9ef8a1f7bfdee5f65d03c) . Makefile.machine with readelf returns "ibms390" whereas we get "s390" with objdump, which is compared against "ibms390" in the workaround you provided in the Makefile.