From e8374944952f27becea383faca11ce500a26475e Mon Sep 17 00:00:00 2001 From: Daniel P. Berrangé Date: Nov 19 2020 11:36:57 +0000 Subject: Re-enable systemtap tracing Signed-off-by: Daniel P. Berrangé --- diff --git a/0001-trace-use-STAP_SDT_V2-to-work-around-symbol-visibili.patch b/0001-trace-use-STAP_SDT_V2-to-work-around-symbol-visibili.patch new file mode 100644 index 0000000..c850e61 --- /dev/null +++ b/0001-trace-use-STAP_SDT_V2-to-work-around-symbol-visibili.patch @@ -0,0 +1,73 @@ +From 0e330ca9023487b3635cdcee1b7ef03266ea9068 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Thu, 19 Nov 2020 11:27:04 +0000 +Subject: [PATCH] trace: use STAP_SDT_V2 to work around symbol visibility +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +QEMU binaries no longer launch successfully with recent SystemTap +releases. This is because modular QEMU builds link the sdt semaphores +into the main binary instead of into the shared objects where they are +used. The symbol visibility of semaphores is 'hidden' and the dynamic +linker prints an error during module loading: + + $ ./configure --enable-trace-backends=dtrace --enable-modules ... + ... + Failed to open module: /builddir/build/BUILD/qemu-4.2.0/s390x-softmmu/../block-curl.so: undefined symbol: qemu_curl_close_semaphore + +The long-term solution is to generate per-module dtrace .o files and +link them into the module instead of the main binary. + +In the short term we can define STAP_SDT_V2 so dtrace(1) produces a .o +file with 'default' symbol visibility instead of 'hidden'. This +workaround is small and easier to merge for QEMU 5.2. + +Cc: Daniel P. Berrangé +Cc: wcohen@redhat.com +Cc: fche@redhat.com +Cc: kraxel@redhat.com +Cc: rjones@redhat.com +Cc: mrezanin@redhat.com +Cc: ddepaula@redhat.com +Signed-off-by: Stefan Hajnoczi +--- + configure | 1 + + trace/meson.build | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index 714e75b5d8..5d91d49c7b 100755 +--- a/configure ++++ b/configure +@@ -4832,6 +4832,7 @@ if have_backend "dtrace"; then + trace_backend_stap="no" + if has 'stap' ; then + trace_backend_stap="yes" ++ QEMU_CFLAGS="$QEMU_CFLAGS -DSTAP_SDT_V2" + fi + fi + +diff --git a/trace/meson.build b/trace/meson.build +index d5fc45c628..843ea14495 100644 +--- a/trace/meson.build ++++ b/trace/meson.build +@@ -38,13 +38,13 @@ foreach dir : [ '.' ] + trace_events_subdirs + trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'), + output: fmt.format('trace-dtrace', 'h'), + input: trace_dtrace, +- command: [ 'dtrace', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ]) ++ command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ]) + trace_ss.add(trace_dtrace_h) + if host_machine.system() != 'darwin' + trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'), + output: fmt.format('trace-dtrace', 'o'), + input: trace_dtrace, +- command: [ 'dtrace', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ]) ++ command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ]) + trace_ss.add(trace_dtrace_o) + endif + +-- +2.28.0 + diff --git a/qemu.spec b/qemu.spec index f04c04d..d52a0bc 100644 --- a/qemu.spec +++ b/qemu.spec @@ -216,7 +216,7 @@ Summary: QEMU is a FAST! processor emulator Name: qemu Version: 5.2.0 -Release: 0.4%{?rcrel}%{?dist} +Release: 0.5%{?rcrel}%{?dist} Epoch: 2 License: GPLv2 and BSD and MIT and CC-BY URL: http://www.qemu.org/ @@ -237,6 +237,8 @@ Source20: kvm-x86.modprobe.conf # /etc/security/limits.d/95-kvm-ppc64-memlock.conf Source21: 95-kvm-ppc64-memlock.conf +Patch0001: 0001-trace-use-STAP_SDT_V2-to-work-around-symbol-visibili.patch + BuildRequires: meson BuildRequires: gcc @@ -1045,10 +1047,6 @@ buildldflags="VL_LDFLAGS=-Wl,--build-id" # but there's a performance impact for non-dtrace so we don't use them tracebackends="dtrace" -# 2020-08-17: tracing disabled, breaks modules on f33+ -# https://bugzilla.redhat.com/show_bug.cgi?id=1869339 -tracebackends="log" - %if %{have_spice} %global spiceflag --enable-spice %else @@ -1289,8 +1287,8 @@ done for src in %{buildroot}%{_datadir}/systemtap/tapset/qemu-*.stp do dst=`echo $src | sed -e 's/.stp/-static.stp/'` - #mv $src $dst - #perl -i -p -e 's/(qemu-\w+)/$1-static/g; s/(qemu\.user\.\w+)/$1.static/g' $dst + mv $src $dst + perl -i -p -e 's/(qemu-\w+)/$1-static/g; s/(qemu\.user\.\w+)/$1.static/g' $dst done popd @@ -1519,7 +1517,7 @@ getent passwd qemu >/dev/null || \ %{_datadir}/%{name}/efi-vmxnet3.rom %{_datadir}/%{name}/vhost-user/50-qemu-virtiofsd.json %{_mandir}/man1/qemu.1* -#{_mandir}/man1/qemu-trace-stap.1* +%{_mandir}/man1/qemu-trace-stap.1* %{_mandir}/man1/virtfs-proxy-helper.1* %{_mandir}/man1/virtiofsd.1* %{_mandir}/man7/qemu-block-drivers.7* @@ -1531,7 +1529,7 @@ getent passwd qemu >/dev/null || \ %{_bindir}/qemu-keymap %{_bindir}/qemu-pr-helper %{_bindir}/qemu-storage-daemon -#{_bindir}/qemu-trace-stap +%{_bindir}/qemu-trace-stap %{_unitdir}/qemu-pr-helper.service %{_unitdir}/qemu-pr-helper.socket %attr(4755, root, root) %{_libexecdir}/qemu-bridge-helper @@ -1680,24 +1678,24 @@ getent passwd qemu >/dev/null || \ %{_bindir}/qemu-xtensa %{_bindir}/qemu-xtensaeb -#{_datadir}/systemtap/tapset/qemu-i386*.stp -#{_datadir}/systemtap/tapset/qemu-x86_64*.stp -#{_datadir}/systemtap/tapset/qemu-aarch64*.stp -#{_datadir}/systemtap/tapset/qemu-alpha*.stp -#{_datadir}/systemtap/tapset/qemu-arm*.stp -#{_datadir}/systemtap/tapset/qemu-cris*.stp -#{_datadir}/systemtap/tapset/qemu-hppa*.stp -#{_datadir}/systemtap/tapset/qemu-m68k*.stp -#{_datadir}/systemtap/tapset/qemu-microblaze*.stp -#{_datadir}/systemtap/tapset/qemu-mips*.stp -#{_datadir}/systemtap/tapset/qemu-nios2*.stp -#{_datadir}/systemtap/tapset/qemu-or1k*.stp -#{_datadir}/systemtap/tapset/qemu-ppc*.stp -#{_datadir}/systemtap/tapset/qemu-riscv*.stp -#{_datadir}/systemtap/tapset/qemu-s390x*.stp -#{_datadir}/systemtap/tapset/qemu-sh4*.stp -#{_datadir}/systemtap/tapset/qemu-sparc*.stp -#{_datadir}/systemtap/tapset/qemu-xtensa*.stp +%{_datadir}/systemtap/tapset/qemu-i386*.stp +%{_datadir}/systemtap/tapset/qemu-x86_64*.stp +%{_datadir}/systemtap/tapset/qemu-aarch64*.stp +%{_datadir}/systemtap/tapset/qemu-alpha*.stp +%{_datadir}/systemtap/tapset/qemu-arm*.stp +%{_datadir}/systemtap/tapset/qemu-cris*.stp +%{_datadir}/systemtap/tapset/qemu-hppa*.stp +%{_datadir}/systemtap/tapset/qemu-m68k*.stp +%{_datadir}/systemtap/tapset/qemu-microblaze*.stp +%{_datadir}/systemtap/tapset/qemu-mips*.stp +%{_datadir}/systemtap/tapset/qemu-nios2*.stp +%{_datadir}/systemtap/tapset/qemu-or1k*.stp +%{_datadir}/systemtap/tapset/qemu-ppc*.stp +%{_datadir}/systemtap/tapset/qemu-riscv*.stp +%{_datadir}/systemtap/tapset/qemu-s390x*.stp +%{_datadir}/systemtap/tapset/qemu-sh4*.stp +%{_datadir}/systemtap/tapset/qemu-sparc*.stp +%{_datadir}/systemtap/tapset/qemu-xtensa*.stp %files user-binfmt @@ -1709,21 +1707,21 @@ getent passwd qemu >/dev/null || \ # in the qemu-user filelists %{_exec_prefix}/lib/binfmt.d/qemu-*-static.conf %{_bindir}/qemu-*-static -#{_datadir}/systemtap/tapset/qemu-*-static.stp +%{_datadir}/systemtap/tapset/qemu-*-static.stp %endif %files system-aarch64 %files system-aarch64-core %{_bindir}/qemu-system-aarch64 -#{_datadir}/systemtap/tapset/qemu-system-aarch64*.stp +%{_datadir}/systemtap/tapset/qemu-system-aarch64*.stp %{_mandir}/man1/qemu-system-aarch64.1* %files system-alpha %files system-alpha-core %{_bindir}/qemu-system-alpha -#{_datadir}/systemtap/tapset/qemu-system-alpha*.stp +%{_datadir}/systemtap/tapset/qemu-system-alpha*.stp %{_mandir}/man1/qemu-system-alpha.1* %{_datadir}/%{name}/palcode-clipper @@ -1732,28 +1730,28 @@ getent passwd qemu >/dev/null || \ %files system-arm-core %{_bindir}/qemu-system-arm %{_datadir}/%{name}/npcm7xx_bootrom.bin -#{_datadir}/systemtap/tapset/qemu-system-arm*.stp +%{_datadir}/systemtap/tapset/qemu-system-arm*.stp %{_mandir}/man1/qemu-system-arm.1* %files system-avr %files system-avr-core %{_bindir}/qemu-system-avr -#{_datadir}/systemtap/tapset/qemu-system-avr*.stp +%{_datadir}/systemtap/tapset/qemu-system-avr*.stp %{_mandir}/man1/qemu-system-avr.1* %files system-cris %files system-cris-core %{_bindir}/qemu-system-cris -#{_datadir}/systemtap/tapset/qemu-system-cris*.stp +%{_datadir}/systemtap/tapset/qemu-system-cris*.stp %{_mandir}/man1/qemu-system-cris.1* %files system-hppa %files system-hppa-core %{_bindir}/qemu-system-hppa -#{_datadir}/systemtap/tapset/qemu-system-hppa*.stp +%{_datadir}/systemtap/tapset/qemu-system-hppa*.stp %{_mandir}/man1/qemu-system-hppa.1* %{_datadir}/%{name}/hppa-firmware.img @@ -1761,7 +1759,7 @@ getent passwd qemu >/dev/null || \ %files system-m68k %files system-m68k-core %{_bindir}/qemu-system-m68k -#{_datadir}/systemtap/tapset/qemu-system-m68k*.stp +%{_datadir}/systemtap/tapset/qemu-system-m68k*.stp %{_mandir}/man1/qemu-system-m68k.1* @@ -1769,7 +1767,7 @@ getent passwd qemu >/dev/null || \ %files system-microblaze-core %{_bindir}/qemu-system-microblaze %{_bindir}/qemu-system-microblazeel -#{_datadir}/systemtap/tapset/qemu-system-microblaze*.stp +%{_datadir}/systemtap/tapset/qemu-system-microblaze*.stp %{_mandir}/man1/qemu-system-microblaze.1* %{_mandir}/man1/qemu-system-microblazeel.1* %{_datadir}/%{name}/petalogix*.dtb @@ -1781,7 +1779,7 @@ getent passwd qemu >/dev/null || \ %{_bindir}/qemu-system-mipsel %{_bindir}/qemu-system-mips64 %{_bindir}/qemu-system-mips64el -#{_datadir}/systemtap/tapset/qemu-system-mips*.stp +%{_datadir}/systemtap/tapset/qemu-system-mips*.stp %{_mandir}/man1/qemu-system-mips.1* %{_mandir}/man1/qemu-system-mipsel.1* %{_mandir}/man1/qemu-system-mips64el.1* @@ -1791,14 +1789,14 @@ getent passwd qemu >/dev/null || \ %files system-nios2 %files system-nios2-core %{_bindir}/qemu-system-nios2 -#{_datadir}/systemtap/tapset/qemu-system-nios2*.stp +%{_datadir}/systemtap/tapset/qemu-system-nios2*.stp %{_mandir}/man1/qemu-system-nios2.1* %files system-or1k %files system-or1k-core %{_bindir}/qemu-system-or1k -#{_datadir}/systemtap/tapset/qemu-system-or1k*.stp +%{_datadir}/systemtap/tapset/qemu-system-or1k*.stp %{_mandir}/man1/qemu-system-or1k.1* @@ -1806,7 +1804,7 @@ getent passwd qemu >/dev/null || \ %files system-ppc-core %{_bindir}/qemu-system-ppc %{_bindir}/qemu-system-ppc64 -#{_datadir}/systemtap/tapset/qemu-system-ppc*.stp +%{_datadir}/systemtap/tapset/qemu-system-ppc*.stp %{_mandir}/man1/qemu-system-ppc.1* %{_mandir}/man1/qemu-system-ppc64.1* %{_datadir}/%{name}/bamboo.dtb @@ -1826,21 +1824,21 @@ getent passwd qemu >/dev/null || \ %{_bindir}/qemu-system-riscv64 %{_datadir}/%{name}/opensbi-riscv*.bin %{_datadir}/%{name}/opensbi-riscv*.elf -#{_datadir}/systemtap/tapset/qemu-system-riscv*.stp +%{_datadir}/systemtap/tapset/qemu-system-riscv*.stp %{_mandir}/man1/qemu-system-riscv*.1* %files system-rx %files system-rx-core %{_bindir}/qemu-system-rx -#{_datadir}/systemtap/tapset/qemu-system-rx*.stp +%{_datadir}/systemtap/tapset/qemu-system-rx*.stp %{_mandir}/man1/qemu-system-rx.1* %files system-s390x %files system-s390x-core %{_bindir}/qemu-system-s390x -#{_datadir}/systemtap/tapset/qemu-system-s390x*.stp +%{_datadir}/systemtap/tapset/qemu-system-s390x*.stp %{_mandir}/man1/qemu-system-s390x.1* %{_datadir}/%{name}/s390-ccw.img %{_datadir}/%{name}/s390-netboot.img @@ -1850,7 +1848,7 @@ getent passwd qemu >/dev/null || \ %files system-sh4-core %{_bindir}/qemu-system-sh4 %{_bindir}/qemu-system-sh4eb -#{_datadir}/systemtap/tapset/qemu-system-sh4*.stp +%{_datadir}/systemtap/tapset/qemu-system-sh4*.stp %{_mandir}/man1/qemu-system-sh4.1* %{_mandir}/man1/qemu-system-sh4eb.1* @@ -1859,7 +1857,7 @@ getent passwd qemu >/dev/null || \ %files system-sparc-core %{_bindir}/qemu-system-sparc %{_bindir}/qemu-system-sparc64 -#{_datadir}/systemtap/tapset/qemu-system-sparc*.stp +%{_datadir}/systemtap/tapset/qemu-system-sparc*.stp %{_mandir}/man1/qemu-system-sparc.1* %{_mandir}/man1/qemu-system-sparc64.1* %{_datadir}/%{name}/QEMU,tcx.bin @@ -1869,7 +1867,7 @@ getent passwd qemu >/dev/null || \ %files system-tricore %files system-tricore-core %{_bindir}/qemu-system-tricore -#{_datadir}/systemtap/tapset/qemu-system-tricore*.stp +%{_datadir}/systemtap/tapset/qemu-system-tricore*.stp %{_mandir}/man1/qemu-system-tricore.1* @@ -1877,8 +1875,8 @@ getent passwd qemu >/dev/null || \ %files system-x86-core %{_bindir}/qemu-system-i386 %{_bindir}/qemu-system-x86_64 -#{_datadir}/systemtap/tapset/qemu-system-i386*.stp -#{_datadir}/systemtap/tapset/qemu-system-x86_64*.stp +%{_datadir}/systemtap/tapset/qemu-system-i386*.stp +%{_datadir}/systemtap/tapset/qemu-system-x86_64*.stp %{_mandir}/man1/qemu-system-i386.1* %{_mandir}/man1/qemu-system-x86_64.1* %{_datadir}/%{name}/bios.bin @@ -1902,12 +1900,15 @@ getent passwd qemu >/dev/null || \ %files system-xtensa-core %{_bindir}/qemu-system-xtensa %{_bindir}/qemu-system-xtensaeb -#{_datadir}/systemtap/tapset/qemu-system-xtensa*.stp +%{_datadir}/systemtap/tapset/qemu-system-xtensa*.stp %{_mandir}/man1/qemu-system-xtensa.1* %{_mandir}/man1/qemu-system-xtensaeb.1* %changelog +* Thu Nov 19 2020 Daniel P. Berrangé - 5.2.0-0.5.rc2 +- Re-enable systemtap tracing + * Wed Nov 18 2020 Cole Robinson - 5.2.0-0.4.rc2 - Rebase to qemu-5.2.0-rc2