All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL for-5.2 0/1] Tracing patches
@ 2020-11-19 16:47 Stefan Hajnoczi
  2020-11-19 16:47 ` [PULL for-5.2 1/1] trace: use STAP_SDT_V2 to work around symbol visibility Stefan Hajnoczi
  2020-11-19 18:26 ` [PULL for-5.2 0/1] Tracing patches Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2020-11-19 16:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, qemu-block, Stefan Hajnoczi

The following changes since commit ff85db769ffd431f86d263d5e954e809a83be92f:

  Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20201119' into staging (2020-11-19 10:36:53 +0000)

are available in the Git repository at:

  https://gitlab.com/stefanha/qemu.git tags/tracing-pull-request

for you to fetch changes up to 4b265c79a85bb35abe19aacea6954c1616521639:

  trace: use STAP_SDT_V2 to work around symbol visibility (2020-11-19 16:41:09 +0000)

----------------------------------------------------------------
Pull request

Fix --enable-modules --enable-trace-backends=dtrace with recent SystemTap
releases.

----------------------------------------------------------------

Stefan Hajnoczi (1):
  trace: use STAP_SDT_V2 to work around symbol visibility

 configure         | 7 +++++++
 trace/meson.build | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PULL for-5.2 1/1] trace: use STAP_SDT_V2 to work around symbol visibility
  2020-11-19 16:47 [PULL for-5.2 0/1] Tracing patches Stefan Hajnoczi
@ 2020-11-19 16:47 ` Stefan Hajnoczi
  2020-11-19 18:26 ` [PULL for-5.2 0/1] Tracing patches Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2020-11-19 16:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Daniel P . Berrangé,
	qemu-block, rjones, fche, kraxel, Stefan Hajnoczi, wcohen,
	Philippe Mathieu-Daudé,
	Miroslav Rezanina, ddepaula

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 and downstream
backports.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1898700
Cc: wcohen@redhat.com
Cc: fche@redhat.com
Cc: kraxel@redhat.com
Cc: rjones@redhat.com
Cc: ddepaula@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: 20201119141457.844452-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 configure         | 7 +++++++
 trace/meson.build | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 714e75b5d8..796cec14de 100755
--- a/configure
+++ b/configure
@@ -4832,6 +4832,13 @@ if have_backend "dtrace"; then
   trace_backend_stap="no"
   if has 'stap' ; then
     trace_backend_stap="yes"
+
+    # Workaround to avoid dtrace(1) producing a file with 'hidden' symbol
+    # visibility. Define STAP_SDT_V2 to produce 'default' symbol visibility
+    # instead. QEMU --enable-modules depends on this because the SystemTap
+    # semaphores are linked into the main binary and not the module's shared
+    # object.
+    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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PULL for-5.2 0/1] Tracing patches
  2020-11-19 16:47 [PULL for-5.2 0/1] Tracing patches Stefan Hajnoczi
  2020-11-19 16:47 ` [PULL for-5.2 1/1] trace: use STAP_SDT_V2 to work around symbol visibility Stefan Hajnoczi
@ 2020-11-19 18:26 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2020-11-19 18:26 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers, Qemu-block

On Thu, 19 Nov 2020 at 16:48, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> The following changes since commit ff85db769ffd431f86d263d5e954e809a83be92f:
>
>   Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20201119' into staging (2020-11-19 10:36:53 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/stefanha/qemu.git tags/tracing-pull-request
>
> for you to fetch changes up to 4b265c79a85bb35abe19aacea6954c1616521639:
>
>   trace: use STAP_SDT_V2 to work around symbol visibility (2020-11-19 16:41:09 +0000)
>
> ----------------------------------------------------------------
> Pull request
>
> Fix --enable-modules --enable-trace-backends=dtrace with recent SystemTap
> releases.
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-19 18:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 16:47 [PULL for-5.2 0/1] Tracing patches Stefan Hajnoczi
2020-11-19 16:47 ` [PULL for-5.2 1/1] trace: use STAP_SDT_V2 to work around symbol visibility Stefan Hajnoczi
2020-11-19 18:26 ` [PULL for-5.2 0/1] Tracing patches Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.