[Qemu-devel] [PATCH 0/7] audio: modularize

Gerd Hoffmann posted 7 patches 7 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180306074053.22856-1-kraxel@redhat.com
Test checkpatch passed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test docker-quick@centos6 passed
Test ppcbe passed
Test ppcle passed
Test s390x passed
configure             |  7 ++++-
Makefile              |  4 +++
Makefile.objs         |  1 +
audio/audio_int.h     | 14 ++++-----
include/qemu/module.h |  1 +
audio/alsaaudio.c     |  8 ++++-
audio/audio.c         | 83 +++++++++++++++++++++++++++++++++++----------------
audio/coreaudio.c     |  8 ++++-
audio/dsoundaudio.c   |  8 ++++-
audio/noaudio.c       |  8 ++++-
audio/ossaudio.c      |  8 ++++-
audio/paaudio.c       |  8 ++++-
audio/sdlaudio.c      |  8 ++++-
audio/spiceaudio.c    |  8 ++++-
audio/wavaudio.c      |  8 ++++-
audio/Makefile.objs   | 30 +++++++++++++------
scripts/create_config |  2 +-
17 files changed, 159 insertions(+), 55 deletions(-)
[Qemu-devel] [PATCH 0/7] audio: modularize
Posted by Gerd Hoffmann 7 years, 7 months ago
Add audio driver (host backend) registry.  Add audio module support.
Enable module builds for alsa, oss, pulse and sdl.

Gerd Hoffmann (7):
  audio: add driver registry
  audio: add module loading support
  build: enable audio modules
  audio/alsa: build as module
  audio/oss: build as module
  audio/pulseaudio: build as module
  audio/sdl: build as module

 configure             |  7 ++++-
 Makefile              |  4 +++
 Makefile.objs         |  1 +
 audio/audio_int.h     | 14 ++++-----
 include/qemu/module.h |  1 +
 audio/alsaaudio.c     |  8 ++++-
 audio/audio.c         | 83 +++++++++++++++++++++++++++++++++++----------------
 audio/coreaudio.c     |  8 ++++-
 audio/dsoundaudio.c   |  8 ++++-
 audio/noaudio.c       |  8 ++++-
 audio/ossaudio.c      |  8 ++++-
 audio/paaudio.c       |  8 ++++-
 audio/sdlaudio.c      |  8 ++++-
 audio/spiceaudio.c    |  8 ++++-
 audio/wavaudio.c      |  8 ++++-
 audio/Makefile.objs   | 30 +++++++++++++------
 scripts/create_config |  2 +-
 17 files changed, 159 insertions(+), 55 deletions(-)

-- 
2.9.3


Re: [Qemu-devel] [PATCH 0/7] audio: modularize
Posted by Marc-André Lureau 7 years, 7 months ago
Hi

On Tue, Mar 6, 2018 at 8:40 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Add audio driver (host backend) registry.  Add audio module support.
> Enable module builds for alsa, oss, pulse and sdl.
>
> Gerd Hoffmann (7):
>   audio: add driver registry
>   audio: add module loading support
>   build: enable audio modules
>   audio/alsa: build as module
>   audio/oss: build as module
>   audio/pulseaudio: build as module
>   audio/sdl: build as module
>

Is this a problem on my side? (configure
'--audio-drv-list=oss,alsa,pa,sdl' '--enable-modules')

elmarco@boraha:~/src/qemu/build (master %)$
x86_64-softmmu/qemu-system-x86_64 -audio-help
Failed to open module:
/home/elmarco/src/qemu/build/x86_64-softmmu/../audio-oss.so: undefined
symbol: _TRACE_OSS_INVALID_AVAILABLE_SIZE_DSTATE
Failed to open module:
/home/elmarco/src/qemu/build/x86_64-softmmu/../audio-alsa.so:
undefined symbol: _TRACE_ALSA_XRUN_OUT_DSTATE
Failed to open module:
/home/elmarco/src/qemu/build/x86_64-softmmu/../audio-pa.so: undefined
symbol: audio_pt_unlock_and_signal
Failed to open module:
/home/elmarco/src/qemu/build/x86_64-softmmu/../audio-sdl.so: undefined
symbol: audio_pcm_sw_write

>  configure             |  7 ++++-
>  Makefile              |  4 +++
>  Makefile.objs         |  1 +
>  audio/audio_int.h     | 14 ++++-----
>  include/qemu/module.h |  1 +
>  audio/alsaaudio.c     |  8 ++++-
>  audio/audio.c         | 83 +++++++++++++++++++++++++++++++++++----------------
>  audio/coreaudio.c     |  8 ++++-
>  audio/dsoundaudio.c   |  8 ++++-
>  audio/noaudio.c       |  8 ++++-
>  audio/ossaudio.c      |  8 ++++-
>  audio/paaudio.c       |  8 ++++-
>  audio/sdlaudio.c      |  8 ++++-
>  audio/spiceaudio.c    |  8 ++++-
>  audio/wavaudio.c      |  8 ++++-
>  audio/Makefile.objs   | 30 +++++++++++++------
>  scripts/create_config |  2 +-
>  17 files changed, 159 insertions(+), 55 deletions(-)
>
> --
> 2.9.3
>
>



-- 
Marc-André Lureau

Re: [Qemu-devel] [PATCH 0/7] audio: modularize
Posted by Gerd Hoffmann 7 years, 7 months ago
On Tue, Mar 06, 2018 at 12:22:49PM +0100, Marc-André Lureau wrote:
> Hi
> 
> On Tue, Mar 6, 2018 at 8:40 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> > Add audio driver (host backend) registry.  Add audio module support.
> > Enable module builds for alsa, oss, pulse and sdl.
> >
> > Gerd Hoffmann (7):
> >   audio: add driver registry
> >   audio: add module loading support
> >   build: enable audio modules
> >   audio/alsa: build as module
> >   audio/oss: build as module
> >   audio/pulseaudio: build as module
> >   audio/sdl: build as module
> >
> 
> Is this a problem on my side? (configure
> '--audio-drv-list=oss,alsa,pa,sdl' '--enable-modules')
> 
> elmarco@boraha:~/src/qemu/build (master %)$
> x86_64-softmmu/qemu-system-x86_64 -audio-help
> Failed to open module:
> /home/elmarco/src/qemu/build/x86_64-softmmu/../audio-oss.so: undefined
> symbol: _TRACE_OSS_INVALID_AVAILABLE_SIZE_DSTATE
> Failed to open module:
> /home/elmarco/src/qemu/build/x86_64-softmmu/../audio-alsa.so:
> undefined symbol: _TRACE_ALSA_XRUN_OUT_DSTATE
> Failed to open module:
> /home/elmarco/src/qemu/build/x86_64-softmmu/../audio-pa.so: undefined
> symbol: audio_pt_unlock_and_signal
> Failed to open module:
> /home/elmarco/src/qemu/build/x86_64-softmmu/../audio-sdl.so: undefined
> symbol: audio_pcm_sw_write

Works fine here.  Tried "make clean && make"?

Qemu build system seems to not rebuild object files when the compiler
flags change.  So you can't switch between --enable-modules and
--disable-modules without "make clean" inbetween.  Same issue when
patches switch code from compiled-in to modular and you try an
incremental build.

I've seen only build failues due to this, not module load errors.  But
possibly only because I stopped doing incremental builds when working on
module patches ...

cheers,
  Gerd


Re: [Qemu-devel] [PATCH 0/7] audio: modularize
Posted by Marc-André Lureau 7 years, 7 months ago
Hi

On Tue, Mar 6, 2018 at 12:42 PM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> On Tue, Mar 06, 2018 at 12:22:49PM +0100, Marc-André Lureau wrote:
>> Hi
>>
>> On Tue, Mar 6, 2018 at 8:40 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
>> > Add audio driver (host backend) registry.  Add audio module support.
>> > Enable module builds for alsa, oss, pulse and sdl.
>> >
>> > Gerd Hoffmann (7):
>> >   audio: add driver registry
>> >   audio: add module loading support
>> >   build: enable audio modules
>> >   audio/alsa: build as module
>> >   audio/oss: build as module
>> >   audio/pulseaudio: build as module
>> >   audio/sdl: build as module
>> >
>>
>> Is this a problem on my side? (configure
>> '--audio-drv-list=oss,alsa,pa,sdl' '--enable-modules')
>>
>> elmarco@boraha:~/src/qemu/build (master %)$
>> x86_64-softmmu/qemu-system-x86_64 -audio-help
>> Failed to open module:
>> /home/elmarco/src/qemu/build/x86_64-softmmu/../audio-oss.so: undefined
>> symbol: _TRACE_OSS_INVALID_AVAILABLE_SIZE_DSTATE
>> Failed to open module:
>> /home/elmarco/src/qemu/build/x86_64-softmmu/../audio-alsa.so:
>> undefined symbol: _TRACE_ALSA_XRUN_OUT_DSTATE
>> Failed to open module:
>> /home/elmarco/src/qemu/build/x86_64-softmmu/../audio-pa.so: undefined
>> symbol: audio_pt_unlock_and_signal
>> Failed to open module:
>> /home/elmarco/src/qemu/build/x86_64-softmmu/../audio-sdl.so: undefined
>> symbol: audio_pcm_sw_write
>
> Works fine here.  Tried "make clean && make"?
>
> Qemu build system seems to not rebuild object files when the compiler
> flags change.  So you can't switch between --enable-modules and
> --disable-modules without "make clean" inbetween.  Same issue when
> patches switch code from compiled-in to modular and you try an
> incremental build.

Fresh directory, cleaned ccache. That didn't help. fwiw, I am
compiling on f27, gcc (GCC) 7.3.1 20180130. I'll investigate further
if you can't reproduce.

> I've seen only build failues due to this, not module load errors.  But
> possibly only because I stopped doing incremental builds when working on
> module patches ...
>
> cheers,
>   Gerd
>



-- 
Marc-André Lureau

Re: [Qemu-devel] [PATCH 0/7] audio: modularize
Posted by Gerd Hoffmann 7 years, 7 months ago
> >> /home/elmarco/src/qemu/build/x86_64-softmmu/../audio-pa.so: undefined
> >> symbol: audio_pt_unlock_and_signal

> Fresh directory, cleaned ccache. That didn't help. fwiw, I am
> compiling on f27, gcc (GCC) 7.3.1 20180130. I'll investigate further
> if you can't reproduce.

Hmm, working fine here (both rhel-7 and fedora-27 testbuild container, default
build flags).

The symbol in question should be provided by qemu:

kraxel@fedora-64bit ~/projects/qemu/build/fedora# objdump -x audio-pa.so | grep audio_pt_unlock_and_signal
0000000000000000         *UND*  0000000000000000              audio_pt_unlock_and_signal
kraxel@fedora-64bit ~/projects/qemu/build/fedora# objdump -x x86_64-softmmu/qemu-system-x86_64 | grep audio_pt_unlock_and_signal
00000000004735f0 g     F .text  0000000000000067              audio_pt_unlock_and_signal

Possibly your linker throws it away, thinking there is no user because of the
modular drivers?

cheers,
  Gerd


Re: [Qemu-devel] [PATCH 0/7] audio: modularize
Posted by Marc-André Lureau 7 years, 7 months ago
Hi

On Tue, Mar 6, 2018 at 2:27 PM, Gerd Hoffmann <kraxel@redhat.com> wrote:
>> >> /home/elmarco/src/qemu/build/x86_64-softmmu/../audio-pa.so: undefined
>> >> symbol: audio_pt_unlock_and_signal
>
>> Fresh directory, cleaned ccache. That didn't help. fwiw, I am
>> compiling on f27, gcc (GCC) 7.3.1 20180130. I'll investigate further
>> if you can't reproduce.
>
> Hmm, working fine here (both rhel-7 and fedora-27 testbuild container, default
> build flags).
>
> The symbol in question should be provided by qemu:
>
> kraxel@fedora-64bit ~/projects/qemu/build/fedora# objdump -x audio-pa.so | grep audio_pt_unlock_and_signal
> 0000000000000000         *UND*  0000000000000000              audio_pt_unlock_and_signal
> kraxel@fedora-64bit ~/projects/qemu/build/fedora# objdump -x x86_64-softmmu/qemu-system-x86_64 | grep audio_pt_unlock_and_signal
> 00000000004735f0 g     F .text  0000000000000067              audio_pt_unlock_and_signal
>
> Possibly your linker throws it away, thinking there is no user because of the
> modular drivers?

It's not that, but it works if I build qemu with -rdynamic. dlopen(3):

External  references in the shared object are resolved using the
shared objects in that object's dependency list and any other objects
previously opened with the RTLD_GLOBAL flag.  If the executable
       was linked with the flag "-rdynamic" (or, synonymously,
"--export-dynamic"), then the global symbols in the executable will
also be used to resolve references in a dynamically loaded shared
object.

(If I understand right, there is some magic rules.mk
process-archive-undefs to make sure the used symbols from modules are
always linked in)

Could it be that -rdynamic / --export-dynamic is assumed in our build
system since modules have been added?

yes, it's pulled from /usr/lib64/pkgconfig/gmodule-2.0.pc, but glib
upstream built with meson doesn't have the flag anymore. That's
probably worth fixing in glib:
https://bugzilla.gnome.org/show_bug.cgi?id=794123

We should switch to using gmodule-export-2.0.pc (since 2.6), which is
also broken in meson build.  I'll send a patch for that.

-- 
Marc-André Lureau