Skip to contentSkip to conversation

A few Machines crash when "no default audio driver available"

DISCUSSION Markus Armbruster 5 participants 13 messages Jul 9 – Jul 20

lore
Share & tools
lore
#0 lore raw

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio
Backtrace:
    #0  0x00007ffff4a5432c in __pthread_kill_implementation () at /lib64/libc.so.6
    #1  0x00007ffff49fa15e in raise () at /lib64/libc.so.6
    #2  0x00007ffff49e16d0 in abort () at /lib64/libc.so.6
    #3  0x0000555555584ae9 in error_handle
        (err=0x55555836e8a0, errp=0x5555579c55c8 <error_abort>)
        at ../util/error.c:37
    #4  0x0000555556055670 in error_handle
        (errp=<optimized out>, err=<optimized out>) at ../util/error.c:301
    #5  error_propagate (dst_errp=<optimized out>, local_err=<optimized out>)
        at ../util/error.c:300
    #6  0x0000555555dbc754 in device_set_realized
        (obj=<optimized out>, value=<optimized out>, errp=0x5555579c55c8 <error_abort>) at ../hw/core/qdev.c:629
    #7  0x0000555555dbf9e9 in property_set_bool
        (obj=0x55555836eb50, v=<optimized out>, name=<optimized out>, opaque=0x555557b90f20, errp=0x5555579c55c8 <error_abort>) at ../qom/object.c:2484
    #8  0x0000555555dc2ec9 in object_property_set
        (obj=obj@entry=0x55555836eb50, name=name@entry=0x5555565a98c8 "realized", v=v@entry=0x555557b8faa0, errp=errp@entry=0x5555579c55c8 <error_abort>)
        at ../qom/object.c:1548
    #9  0x0000555555dc6ca1 in object_property_set_qobject
        (obj=obj@entry=0x55555836eb50, name=name@entry=0x5555565a98c8 "realized", value=value@entry=0x55555836e9a0, errp=errp@entry=0x5555579c55c8 <error_abort>)
        at ../qom/qom-qobject.c:28
    #10 0x0000555555dc3666 in object_property_set_bool
        (obj=0x55555836eb50, name=0x5555565a98c8 "realized", value=<optimized out>, errp=0x5555579c55c8 <error_abort>) at ../qom/object.c:1618
    #11 0x0000555555dbbfde in qdev_realize_and_unref
        (dev=dev@entry=0x55555836eb50, bus=bus@entry=0x55555834e0c0, errp=<optimized out>) at ../hw/core/qdev.c:284
    #12 0x00005555557988d5 in i2c_slave_realize_and_unref
        (dev=dev@entry=0x55555836eb50, bus=bus@entry=0x55555834e0c0, errp=<optimized out>) at ../hw/i2c/core.c:378
    #13 0x0000555555b6fe1d in musicpal_init (machine=0x555557f21520)
        at ../hw/arm/musicpal.c:1334
    #14 0x000055555572d1d2 in machine_run_board_init
        (machine=0x555557f21520, mem_path=<optimized out>, errp=<optimized out>)
        at ../hw/core/machine.c:1696
    #15 0x00005555559f9699 in qemu_init_board () at ../system/vl.c:2727
    #16 qmp_x_exit_preconfig (errp=errp@entry=0x5555579c55c0 <error_fatal>)
        at ../system/vl.c:2821
    #17 0x00005555559fd3fc in qmp_x_exit_preconfig (errp=<optimized out>)
        at ../system/vl.c:2816
    #18 qemu_init (argc=<optimized out>, argv=<optimized out>)
        at ../system/vl.c:3862
    #19 0x000055555558d899 in main (argc=<optimized out>, argv=<optimized out>)
        at ../system/main.c:71

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

The error comes from audio_init(). Backtrace:

    #0  error_setg_internal
        (errp=errp@entry=0x7fffffffd730, src=src@entry=0x5555565cfd35 "../audio/audio.c", line=line@entry=106, func=func@entry=0x55555670a468 <__func__.3> "audio_init", fmt=fmt@entry=0x55555655ef38 "no default audio driver available")
        at ../util/error.c:96
    #1  0x0000555555ec18fc in audio_init
        (dev=dev@entry=0x0, errp=errp@entry=0x7fffffffd730) at ../audio/audio.c:106
    #2  0x0000555555ec1d36 in audio_get_default_audio_be
        (errp=errp@entry=0x7fffffffd730) at ../audio/audio.c:130
    #3  0x0000555555ec21c5 in audio_be_check
        (be=be@entry=0x55555836ebf8, errp=errp@entry=0x7fffffffd730)
        at ../audio/audio-be.c:15
    #4  0x00005555556fc57a in wm8750_realize
        (dev=<optimized out>, errp=0x7fffffffd730) at ../hw/audio/wm8750.c:628
    #5  0x0000555555dbc7c7 in device_set_realized
        (obj=<optimized out>, value=<optimized out>, errp=0x5555579c55c8 <error_abort>) at ../hw/core/qdev.c:514
    #6  0x0000555555dbf9e9 in property_set_bool
        (obj=0x55555836eb50, v=<optimized out>, name=<optimized out>, opaque=0x555557b90f20, errp=0x5555579c55c8 <error_abort>) at ../qom/object.c:2484
    #7  0x0000555555dc2ec9 in object_property_set
        (obj=obj@entry=0x55555836eb50, name=name@entry=0x5555565a98c8 "realized", v=v@entry=0x555557b8faa0, errp=errp@entry=0x5555579c55c8 <error_abort>)
        at ../qom/object.c:1548
    #8  0x0000555555dc6ca1 in object_property_set_qobject
        (obj=obj@entry=0x55555836eb50, name=name@entry=0x5555565a98c8 "realized", value=value@entry=0x55555836e9a0, errp=errp@entry=0x5555579c55c8 <error_abort>)
        at ../qom/qom-qobject.c:28
    #9  0x0000555555dc3666 in object_property_set_bool
        (obj=0x55555836eb50, name=0x5555565a98c8 "realized", value=<optimized out>, errp=0x5555579c55c8 <error_abort>) at ../qom/object.c:1618
    #10 0x0000555555dbbfde in qdev_realize_and_unref
        (dev=dev@entry=0x55555836eb50, bus=bus@entry=0x55555834e0c0, errp=<optimized out>) at ../hw/core/qdev.c:284
    #11 0x00005555557988d5 in i2c_slave_realize_and_unref
        (dev=dev@entry=0x55555836eb50, bus=bus@entry=0x55555834e0c0, errp=<optimized out>) at ../hw/i2c/core.c:378
    #12 0x0000555555b6fe1d in musicpal_init (machine=0x555557f21520)
        at ../hw/arm/musicpal.c:1334
    #13 0x000055555572d1d2 in machine_run_board_init
        (machine=0x555557f21520, mem_path=<optimized out>, errp=<optimized out>)
        at ../hw/core/machine.c:1696
    #14 0x00005555559f9699 in qemu_init_board () at ../system/vl.c:2727
    #15 qmp_x_exit_preconfig (errp=errp@entry=0x5555579c55c0 <error_fatal>)
        at ../system/vl.c:2821
    #16 0x00005555559fd3fc in qmp_x_exit_preconfig (errp=<optimized out>)
        at ../system/vl.c:2816
    #17 qemu_init (argc=<optimized out>, argv=<optimized out>)
        at ../system/vl.c:3862
    #18 0x000055555558d899 in main (argc=<optimized out>, argv=<optimized out>)
        at ../system/main.c:71
#1 lore raw
Quoted 10 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

thanks
-- PMM

#2 lore raw

Cc: mainainters for "Overall Audio backends"

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

Quoted 8 lines
Quoted 4 lines
$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

There's plenty of precedence for /dev/null-like backends.

Quoted 3 lines

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

Yes.

#3 lore raw
Quoted 19 lines · Markus Armbruster

Cc: mainainters for "Overall Audio backends"

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

Quoted 8 lines
Quoted 4 lines
$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Quoted 7 lines

There's plenty of precedence for /dev/null-like backends.

Quoted 3 lines

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

Yes.

We've got a bit of tension between "no defaults" and "builtin audio devices" here.

Cnosider if I had instead done

qemu-system-x86_64 -M pc -device ac97 -nodefaults

It is not unreasonable to expect to see an error because you asked explicitly for 'ac97' and forgot to wire up the required audio backend, and asked to NOT have any defaults.

But with your 'musicpal' machine example, you never asked for the frontend device, so you should be forgiven for also not asking for a audio backend.

If we guarantee a /dev/null audio backend always exists, we help the second case but degrade the first case

So we must pick the lesser evil :-(

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#4 lore raw
Quoted 36 lines · Daniel P. Berrangé
Quoted 19 lines · Markus Armbruster

Cc: mainainters for "Overall Audio backends"

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

Quoted 8 lines
Quoted 4 lines
$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Quoted 7 lines

There's plenty of precedence for /dev/null-like backends.

Quoted 3 lines

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

Yes.

We've got a bit of tension between "no defaults" and "builtin audio devices" here.

Cnosider if I had instead done

qemu-system-x86_64 -M pc -device ac97 -nodefaults

Quoted 7 lines

It is not unreasonable to expect to see an error because you asked explicitly for 'ac97' and forgot to wire up the required audio backend, and asked to NOT have any defaults.

But with your 'musicpal' machine example, you never asked for the frontend device, so you should be forgiven for also not asking for a audio backend.

Ah, so this is because of -nodefaults, not because QEMU was somehow built with no audio backends in it.

Quoted 2 lines

If we guarantee a /dev/null audio backend always exists, we help the second case but degrade the first case

As a possible analogy, for network devices we just warn in the analogous "device created but no backend wired up":

./build/x86/qemu-system-x86_64 -nodefaults -device e1000 -display none
qemu-system-x86_64: warning: nic e1000.0 has no peer

and the effective behaviour is that output packets are dropped.

We could make audio devices do that (which would be basically equivalent to "if we need an audio backend and we don't have one, warn and create the null backend").

-- PMM

#5 lore raw

Hi

Quoted 55 lines · Peter Maydell
Quoted 36 lines · Daniel P. Berrangé
Quoted 19 lines · Markus Armbruster

Cc: mainainters for "Overall Audio backends"

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

Quoted 8 lines
Quoted 4 lines
$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Quoted 7 lines

There's plenty of precedence for /dev/null-like backends.

Quoted 3 lines

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

Yes.

We've got a bit of tension between "no defaults" and "builtin audio devices" here.

Cnosider if I had instead done

qemu-system-x86_64 -M pc -device ac97 -nodefaults

Quoted 7 lines

It is not unreasonable to expect to see an error because you asked explicitly for 'ac97' and forgot to wire up the required audio backend, and asked to NOT have any defaults.

But with your 'musicpal' machine example, you never asked for the frontend device, so you should be forgiven for also not asking for a audio backend.

Ah, so this is because of -nodefaults, not because QEMU was somehow built with no audio backends in it.

Quoted 2 lines

If we guarantee a /dev/null audio backend always exists, we help the second case but degrade the first case

As a possible analogy, for network devices we just warn in the analogous "device created but no backend wired up":

Quoted 9 lines

./build/x86/qemu-system-x86_64 -nodefaults -device e1000 -display none
qemu-system-x86_64: warning: nic e1000.0 has no peer

and the effective behaviour is that output packets are dropped.

We could make audio devices do that (which would be basically equivalent to "if we need an audio backend and we don't have one, warn and create the null backend").

Note that we don't have a real "null" backend. The "none" backend does mixing/resampling/volume before dropping the audio (its parent is MIXENG_BACKEND). I think it would be worth to add (so one day we can compile qemu without the whole audio/ engine)

#6 lore raw
Quoted 68 lines · Marc-André Lureau

Hi

Quoted 55 lines · Peter Maydell
Quoted 36 lines · Daniel P. Berrangé
Quoted 19 lines · Markus Armbruster

Cc: mainainters for "Overall Audio backends"

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

Quoted 8 lines
Quoted 4 lines
$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Quoted 7 lines

There's plenty of precedence for /dev/null-like backends.

Quoted 3 lines

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

Yes.

We've got a bit of tension between "no defaults" and "builtin audio devices" here.

Cnosider if I had instead done

qemu-system-x86_64 -M pc -device ac97 -nodefaults

Quoted 7 lines

It is not unreasonable to expect to see an error because you asked explicitly for 'ac97' and forgot to wire up the required audio backend, and asked to NOT have any defaults.

But with your 'musicpal' machine example, you never asked for the frontend device, so you should be forgiven for also not asking for a audio backend.

Ah, so this is because of -nodefaults, not because QEMU was somehow built with no audio backends in it.

Quoted 2 lines

If we guarantee a /dev/null audio backend always exists, we help the second case but degrade the first case

As a possible analogy, for network devices we just warn in the analogous "device created but no backend wired up":

Quoted 9 lines

./build/x86/qemu-system-x86_64 -nodefaults -device e1000 -display none
qemu-system-x86_64: warning: nic e1000.0 has no peer

and the effective behaviour is that output packets are dropped.

We could make audio devices do that (which would be basically equivalent to "if we need an audio backend and we don't have one, warn and create the null backend").

Quoted 4 lines

Note that we don't have a real "null" backend. The "none" backend does mixing/resampling/volume before dropping the audio (its parent is MIXENG_BACKEND). I think it would be worth to add (so one day we can compile qemu without the whole audio/ engine)

Rather than adding "null" backend, IMHO, we should make "none" do what its name suggests, by removing the MIGENG_BACKEND from it.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#7 lore raw

Hi

Quoted 70 lines · Daniel P. Berrangé
Quoted 68 lines · Marc-André Lureau

Hi

Quoted 64 lines · Peter Maydell
Quoted 36 lines · Daniel P. Berrangé
Quoted 19 lines · Markus Armbruster

Cc: mainainters for "Overall Audio backends"

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

Quoted 8 lines
Quoted 4 lines
$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Quoted 7 lines

There's plenty of precedence for /dev/null-like backends.

Quoted 3 lines

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

Yes.

We've got a bit of tension between "no defaults" and "builtin audio devices" here.

Cnosider if I had instead done

qemu-system-x86_64 -M pc -device ac97 -nodefaults

Quoted 7 lines

It is not unreasonable to expect to see an error because you asked explicitly for 'ac97' and forgot to wire up the required audio backend, and asked to NOT have any defaults.

But with your 'musicpal' machine example, you never asked for the frontend device, so you should be forgiven for also not asking for a audio backend.

Ah, so this is because of -nodefaults, not because QEMU was somehow built with no audio backends in it.

Quoted 2 lines

If we guarantee a /dev/null audio backend always exists, we help the second case but degrade the first case

As a possible analogy, for network devices we just warn in the analogous "device created but no backend wired up":

./build/x86/qemu-system-x86_64 -nodefaults -device e1000 -display none
qemu-system-x86_64: warning: nic e1000.0 has no peer

and the effective behaviour is that output packets are dropped.

We could make audio devices do that (which would be basically equivalent to "if we need an audio backend and we don't have one, warn and create the null backend").

Quoted 8 lines
Quoted 4 lines

Note that we don't have a real "null" backend. The "none" backend does mixing/resampling/volume before dropping the audio (its parent is MIXENG_BACKEND). I think it would be worth to add (so one day we can compile qemu without the whole audio/ engine)

Rather than adding "null" backend, IMHO, we should make "none" do what its name suggests, by removing the MIGENG_BACKEND from it.

It's a bit more complicated, the "none" backend can be used by vnc (not spice or dbus), and we have the now-deprecated HMP wavcapture command.

Note, the new "qemu-vnc" server does not mix/resample audio at this point, it takes the first audio stream instead.

Fwiw, a "null" audio backend would still need to process audio data at a correct pace.

#8 lore raw
Quoted 78 lines · Marc-André Lureau

Hi

Quoted 75 lines · Daniel P. Berrangé
Quoted 72 lines · Marc-André Lureau

Hi

Quoted 55 lines · Peter Maydell
Quoted 36 lines · Daniel P. Berrangé
Quoted 19 lines · Markus Armbruster

Cc: mainainters for "Overall Audio backends"

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

Quoted 8 lines
Quoted 4 lines
$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Quoted 7 lines

There's plenty of precedence for /dev/null-like backends.

Quoted 3 lines

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

Yes.

We've got a bit of tension between "no defaults" and "builtin audio devices" here.

Cnosider if I had instead done

qemu-system-x86_64 -M pc -device ac97 -nodefaults

Quoted 7 lines

It is not unreasonable to expect to see an error because you asked explicitly for 'ac97' and forgot to wire up the required audio backend, and asked to NOT have any defaults.

But with your 'musicpal' machine example, you never asked for the frontend device, so you should be forgiven for also not asking for a audio backend.

Ah, so this is because of -nodefaults, not because QEMU was somehow built with no audio backends in it.

Quoted 2 lines

If we guarantee a /dev/null audio backend always exists, we help the second case but degrade the first case

As a possible analogy, for network devices we just warn in the analogous "device created but no backend wired up":

Quoted 9 lines

./build/x86/qemu-system-x86_64 -nodefaults -device e1000 -display none
qemu-system-x86_64: warning: nic e1000.0 has no peer

and the effective behaviour is that output packets are dropped.

We could make audio devices do that (which would be basically equivalent to "if we need an audio backend and we don't have one, warn and create the null backend").

Note that we don't have a real "null" backend. The "none" backend does mixing/resampling/volume before dropping the audio (its parent is MIXENG_BACKEND). I think it would be worth to add (so one day we can compile qemu without the whole audio/ engine)

Quoted 7 lines
Quoted 3 lines

Rather than adding "null" backend, IMHO, we should make "none" do what its name suggests, by removing the MIGENG_BACKEND from it.

It's a bit more complicated, the "none" backend can be used by vnc (not spice or dbus), and we have the now-deprecated HMP wavcapture command.

Oh right because VNC used the capture APIs to receive the audio. It should probably have had an explicit "vnc" audio backend like spice did :-(

Quoted 8 lines

Note, the new "qemu-vnc" server does not mix/resample audio at this point, it takes the first audio stream instead.

Fwiw, a "null" audio backend would still need to process audio data at a correct pace.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#9 lore raw
Quoted 43 lines · Daniel P. Berrangé
Quoted 42 lines · Marc-André Lureau

Hi

Quoted 39 lines · Daniel P. Berrangé
Quoted 37 lines · Marc-André Lureau

Hi

Quoted 34 lines · Peter Maydell
Quoted 32 lines · Daniel P. Berrangé
Quoted 19 lines · Markus Armbruster

Cc: mainainters for "Overall Audio backends"

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

Quoted 8 lines
Quoted 4 lines
$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Quoted 7 lines

There's plenty of precedence for /dev/null-like backends.

Quoted 3 lines

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

Yes.

We've got a bit of tension between "no defaults" and "builtin audio devices" here.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Cnosider if I had instead done

qemu-system-x86_64 -M pc -device ac97 -nodefaults

It is not unreasonable to expect to see an error because you asked explicitly for 'ac97' and forgot to wire up the required audio backend, and asked to NOT have any defaults.

Even then, a crash is unequivocally wrong. Fatal error would be defensible.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

But with your 'musicpal' machine example, you never asked for the frontend device, so you should be forgiven for also not asking for a audio backend.

Indeed.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Ah, so this is because of -nodefaults, not because QEMU was somehow built with no audio backends in it.

Yes.

There are more ways to end up with no audio backend.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

If we guarantee a /dev/null audio backend always exists, we help the second case but degrade the first case

As a possible analogy, for network devices we just warn in the analogous "device created but no backend wired up":

./build/x86/qemu-system-x86_64 -nodefaults -device e1000 -display none
qemu-system-x86_64: warning: nic e1000.0 has no peer

and the effective behaviour is that output packets are dropped.

When a network device lacks a backend, we make it behave as if it's not connected to anything, and also tell the user that this is the case. Makes sense, especially for onboard devices: the user may not care for such an onboard device, and can't remove it.

When an audio device lacks a backend, could we make it behave as if it's not connected to anything?

Longwinded way to say ...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

We could make audio devices do that (which would be basically equivalent to "if we need an audio backend and we don't have one, warn and create the null backend").

... yes, please.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

Note that we don't have a real "null" backend. The "none" backend does mixing/resampling/volume before dropping the audio (its parent is MIXENG_BACKEND). I think it would be worth to add (so one day we can compile qemu without the whole audio/ engine)

Rather than adding "null" backend, IMHO, we should make "none" do what its name suggests, by removing the MIGENG_BACKEND from it.

Quoted 7 lines
Quoted 3 lines

It's a bit more complicated, the "none" backend can be used by vnc (not spice or dbus), and we have the now-deprecated HMP wavcapture command.

Oh right because VNC used the capture APIs to receive the audio. It should probably have had an explicit "vnc" audio backend like spice did :-(

Is this fixable?

"Certain audio commands only work when you actually have an audio backend" would be perfectly reasonable, wouldn'it ?

Quoted 6 lines
Quoted 6 lines

Note, the new "qemu-vnc" server does not mix/resample audio at this point, it takes the first audio stream instead.

Fwiw, a "null" audio backend would still need to process audio data at a correct pace.

I'm dense today: why?

#10 lore raw

Hi

Quoted 110 lines · Markus Armbruster
Quoted 43 lines · Daniel P. Berrangé
Quoted 42 lines · Marc-André Lureau

Hi

Quoted 39 lines · Daniel P. Berrangé
Quoted 37 lines · Marc-André Lureau

Hi

Quoted 34 lines · Peter Maydell
Quoted 32 lines · Daniel P. Berrangé
Quoted 19 lines · Markus Armbruster

Cc: mainainters for "Overall Audio backends"

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

Quoted 8 lines
Quoted 4 lines
$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Quoted 7 lines

There's plenty of precedence for /dev/null-like backends.

Quoted 3 lines

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

Yes.

We've got a bit of tension between "no defaults" and "builtin audio devices" here.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Cnosider if I had instead done

qemu-system-x86_64 -M pc -device ac97 -nodefaults

It is not unreasonable to expect to see an error because you asked explicitly for 'ac97' and forgot to wire up the required audio backend, and asked to NOT have any defaults.

Even then, a crash is unequivocally wrong. Fatal error would be defensible.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

But with your 'musicpal' machine example, you never asked for the frontend device, so you should be forgiven for also not asking for a audio backend.

Indeed.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Ah, so this is because of -nodefaults, not because QEMU was somehow built with no audio backends in it.

Yes.

There are more ways to end up with no audio backend.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

If we guarantee a /dev/null audio backend always exists, we help the second case but degrade the first case

As a possible analogy, for network devices we just warn in the analogous "device created but no backend wired up":

./build/x86/qemu-system-x86_64 -nodefaults -device e1000 -display none
qemu-system-x86_64: warning: nic e1000.0 has no peer

and the effective behaviour is that output packets are dropped.

When a network device lacks a backend, we make it behave as if it's not connected to anything, and also tell the user that this is the case. Makes sense, especially for onboard devices: the user may not care for such an onboard device, and can't remove it.

When an audio device lacks a backend, could we make it behave as if it's not connected to anything?

Longwinded way to say ...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

We could make audio devices do that (which would be basically equivalent to "if we need an audio backend and we don't have one, warn and create the null backend").

... yes, please.

Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 4 lines

Note that we don't have a real "null" backend. The "none" backend does mixing/resampling/volume before dropping the audio (its parent is MIXENG_BACKEND). I think it would be worth to add (so one day we can compile qemu without the whole audio/ engine)

Rather than adding "null" backend, IMHO, we should make "none" do what its name suggests, by removing the MIGENG_BACKEND from it.

It's a bit more complicated, the "none" backend can be used by vnc (not spice or dbus), and we have the now-deprecated HMP wavcapture command.

Quoted 6 lines
Quoted 3 lines

Oh right because VNC used the capture APIs to receive the audio. It should probably have had an explicit "vnc" audio backend like spice did :-(

Is this fixable?

Yes, that's not so trivial though.. (mostly because compatibility with existing behaviour/cli etc)

Quoted 11 lines

"Certain audio commands only work when you actually have an audio backend" would be perfectly reasonable, wouldn'it ?

Quoted 6 lines
Quoted 6 lines

Note, the new "qemu-vnc" server does not mix/resample audio at this point, it takes the first audio stream instead.

Fwiw, a "null" audio backend would still need to process audio data at a correct pace.

I'm dense today: why?

-audio is emulating a real DAC/ADC that consumes bytes in real-time. If you just do >/dev/null, the audio clock will be too fast, and most apps playing video will likely just play as quickly as they can... This is just the small part we need to keep emulating right depending on the audio stream format

#11 lore raw
In reply to Daniel P. Berrangé
Quoted 35 lines · Daniel P. Berrangé
Quoted 19 lines · Markus Armbruster

Cc: mainainters for "Overall Audio backends"

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

Quoted 8 lines
Quoted 4 lines
$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Quoted 7 lines

There's plenty of precedence for /dev/null-like backends.

Quoted 3 lines

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

Yes.

We've got a bit of tension between "no defaults" and "builtin audio devices" here.

Cnosider if I had instead done

qemu-system-x86_64 -M pc -device ac97 -nodefaults

Quoted 7 lines

It is not unreasonable to expect to see an error because you asked explicitly for 'ac97' and forgot to wire up the required audio backend, and asked to NOT have any defaults.

But with your 'musicpal' machine example, you never asked for the frontend device, so you should be forgiven for also not asking for a audio backend.

These machines have an audio device on-board (for pegasos it's part of the VIA south bridge) so nodefaults does not change that. I think it would be enough to exit with an error message instead of crashing and let the user correct the command.

Regards,
BALATON Zoltan

#12 lore raw
In reply to Peter Maydell
Quoted 12 lines · Peter Maydell
Quoted 10 lines · Markus Armbruster

I stumbled over ARM machine musicpal, PPC machines pegasos1, pegasos2, and MIPS machine fuloong2e crashes.

I run them like this:

$ qemu-system-aarch64 -M musicpal -nodefaults -S -display none -monitor stdio

Died when device_set_realized() tried to propagate a "no default audio driver available" error to &error_abort.

Quoted 7 lines

Is this something we want to have be a possibility the devices have to cope with? Can we have the "ignores all audio data" backend be always available instead?

Otherwise every audio device needs to cope with "there is no audio backend available" and implement "do nothing with the audio data" itself.

I think the "no default audio driver available" error was returned from the device but it was not propagated properly somewhere around error_handle to become an error message to abort with so it's not something the devices should care about but some problem in error handling. Without -nodefaults there is a default audio device so this does not happen but with -nodefaults you need to specify one explicitly. I think the question is why the error is not propagated and exited with on error_abort instead of crashing and is not something specific to these devices or machines which are just reproducers of the error handling issue.

Regards,
BALATON Zoltan