Unable to build latest kvm-unit-test on Hirsute PowerPC (lswx/lswi invalid when little-endian)

Bug #1931534 reported by Po-Hsu Lin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-kernel-tests
Fix Released
Undecided
Unassigned

Bug Description

This issue was found on Hirsute 5.11 PowerPC with node "baltar", binutil version 2.36.1-6ubuntu1

With our branch hirsute-WIP and also the latest tip 53017303f8363 upstream

Test build failed with:
Checking powerpc/spapr_hcall.elf for unsupported reloc types... looks good.
gcc -std=gnu99 -ffreestanding -O2 -msoft-float -mabi=no-altivec -mno-altivec -I /home/ubuntu/upstream/kvm-unit-tests/lib -I /home/ubuntu/upstream/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MF powerpc/.rtas.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings -Wempty-body -Wuninitialized -Wignored-qualifiers -Werror -fomit-frame-pointer -fno-stack-protector -Wno-frame-address -fno-pic -no-pie -Wclobbered -Wunused-but-set-parameter -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -Wmissing-prototypes -Wstrict-prototypes -mlittle-endian -c -o powerpc/rtas.o powerpc/rtas.c
gcc -std=gnu99 -ffreestanding -O2 -msoft-float -mabi=no-altivec -mno-altivec -I /home/ubuntu/upstream/kvm-unit-tests/lib -I /home/ubuntu/upstream/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MF powerpc/.rtas.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings -Wempty-body -Wuninitialized -Wignored-qualifiers -Werror -fomit-frame-pointer -fno-stack-protector -Wno-frame-address -fno-pic -no-pie -Wclobbered -Wunused-but-set-parameter -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -Wmissing-prototypes -Wstrict-prototypes -mlittle-endian -c -o powerpc/rtas.aux.o /home/ubuntu/upstream/kvm-unit-tests/lib/auxinfo.c \
 -DPROGNAME=\"powerpc/rtas.elf\"
ld -EL -nostdlib -pie -n -o powerpc/rtas.elf \
 -T /home/ubuntu/upstream/kvm-unit-tests/powerpc/flat.lds --build-id=none \
 powerpc/rtas.o powerpc/cstart64.o powerpc/reloc64.o lib/libcflat.a lib/libfdt/libfdt.a powerpc/rtas.aux.o
rm -f powerpc/rtas.aux.o
Checking powerpc/rtas.elf for unsupported reloc types... looks good.
gcc -std=gnu99 -ffreestanding -O2 -msoft-float -mabi=no-altivec -mno-altivec -I /home/ubuntu/upstream/kvm-unit-tests/lib -I /home/ubuntu/upstream/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MF powerpc/.emulator.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings -Wempty-body -Wuninitialized -Wignored-qualifiers -Werror -fomit-frame-pointer -fno-stack-protector -Wno-frame-address -fno-pic -no-pie -Wclobbered -Wunused-but-set-parameter -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -Wmissing-prototypes -Wstrict-prototypes -mlittle-endian -c -o powerpc/emulator.o powerpc/emulator.c
/tmp/ccVRmsH2.s: Assembler messages:
/tmp/ccVRmsH2.s:335: Error: `lswx' invalid when little-endian
/tmp/ccVRmsH2.s:381: Error: `lswx' invalid when little-endian
/tmp/ccVRmsH2.s:403: Error: `lswx' invalid when little-endian
/tmp/ccVRmsH2.s:432: Error: `lswx' invalid when little-endian
/tmp/ccVRmsH2.s:624: Error: `lswi' invalid when little-endian
/tmp/ccVRmsH2.s:669: Error: `lswi' invalid when little-endian
/tmp/ccVRmsH2.s:690: Error: `lswi' invalid when little-endian
make: *** [<builtin>: powerpc/emulator.o] Error 1

Please find attachment for a more complete build log.

There is a similar issue reported against valgrind
https://<email address hidden>/msg489085.html

It seems to be binutils related.
Test build works in Bionic PowerPC, binutils version 2.30-21ubuntu1~18.04.5

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :
tags: added: ppc64el ubuntu-kvm-unit-tests
tags: added: 5.11 hirsute sru-20210531
Po-Hsu Lin (cypressyew)
description: updated
description: updated
Revision history for this message
Thadeu Lima de Souza Cascardo (cascardo) wrote :

I was able to made it build after conditioning the part of emulator.c that uses lswx and lswi on big endian.

However, one of the points of running those instructions under kvm on a little endian system is to test its behavior. I will see if there is any way to tell binutils to allow those instructions.

Cascardo.

Revision history for this message
Thadeu Lima de Souza Cascardo (cascardo) wrote :

There is no such option, besides building as big endian. We could still build it as big endian and test it as a BE guest on a LE host. But we might as well just skip it those two subtests for now.

Cascardo.

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Found on Power8 node dryden with Hirsute 5.11.0-23.24

tags: added: sru-20210621
Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Issue reported upstream:
https://lore.kernel<email address hidden>/T/

tags: added: hinted
Revision history for this message
Po-Hsu Lin (cypressyew) wrote :
Changed in ubuntu-kernel-tests:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.