Bug 2000479

Summary: QEMU's coroutines fail with CFLAGS=-flto on aarch64
Product: Red Hat Enterprise Linux 9 Reporter: Eric Auger <eric.auger>
Component: clangAssignee: Tom Stellard <tstellar>
Status: CLOSED WONTFIX QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: medium    
Version: 9.0CC: fweimer, kwolf, mprchlik, thuth, yihyu
Target Milestone: rcKeywords: Bugfix, Triaged
Target Release: ---   
Hardware: aarch64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-03-02 07:27:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1924294    

Description Eric Auger 2021-09-02 08:46:46 UTC
As suggested in https://bugzilla.redhat.com/show_bug.cgi?id=1952483#c16 I open a BZ against Clang to follow the issue of 'lto' with qemu's coroutines.

The issue was first found with 'lto' option along with gcc. It looks the issue still is there with clang using lto option, at least on ARM.  https://bugzilla.redhat.com/show_bug.cgi?id=1952483#c15 suggests it seems to work on s390x though (to be confirmed).

A technical analysis of the issue from the qemu perspective can be found at
https://bugzilla.redhat.com/show_bug.cgi?id=1952483#c8

Florian Weimer started a thread upstream
Disabling TLS address caching to help QEMU on GNU/Linux
https://gcc.gnu.org/pipermail/gcc/2021-July/236831.html

Same kind of discussion shall happen for CLANG I guess.

How to reproduce, configure & build qemu with clang and lto.

./configure --cc=clang --cxx=/bin/false --prefix=/usr --libdir=/usr/lib64 --datadir=/usr/share --sysconfdir=/etc --interp-prefix=/usr/qemu-%M --localstatedir=/var --docdir=/usr/share/doc --libexecdir=/usr/libexec '--extra-ldflags=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now   -flto' '--extra-cflags=-O2 -flto -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS --config /usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong   -fasynchronous-unwind-tables ' --target-list=aarch64-softmmu --enable-kvm --extra-cflags=-Wstrict-prototypes --extra-cflags=-Wredundant-decls --enable-trace-backends=log --enable-seccomp --enable-cap-ng --disable-werror --without-default-devices --disable-capstone --meson=/usr/bin/meson
make
sudo dnf -y install perl-Test-Harness
make check-unit -j8

test-block-iothread during "make check " fails on aarch64 with ERROR test-block-iothread - Bail out! ERROR:../tests/unit/test-block-iothread.c:379:test_job_run: assertion failed: (qemu_get_current_aio_context() == job->aio_context)

Normally test-block-iothread  shall pass.

Comment 6 RHEL Program Management 2023-03-02 07:27:48 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.