qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Programmingkid <programmingkidx@gmail.com>
Cc: qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Help with deadlock when using sound
Date: Tue, 12 May 2015 09:45:52 +0200	[thread overview]
Message-ID: <5551AFB0.5020908@redhat.com> (raw)
In-Reply-To: <1D282622-B470-4916-BC6A-689EC83B1B42@gmail.com>

On 12/05/2015 00:43, Programmingkid wrote:
> 
> On May 10, 2015, at 10:54 AM, Paolo Bonzini wrote:
> 
>>
>>
>> On 06/05/2015 18:40, Programmingkid wrote:
>>> When I try to use the pcspk sound hardware, QEMU freezes and uses
>>> 100% of the cpu time. This is the command I use:
>>>
>>> qemu-system-i386 -cdrom <anything you wan here> -soundhw pcspk
>>>
>>> This looks like a deadlock situation because some unknown code called
>>> qemu_mutex_lock(). Here is the stack trace at the freeze:
>>>
>>> (gdb) bt #0  0x00007fff824e2db6 in semaphore_wait_trap () #1
>>> 0x00007fff824e8417 in pthread_mutex_lock () #2  0x0000000100267199 in
>>> qemu_mutex_lock (mutex=<value temporarily unavailable, due to
>>> optimizations>) at util/qemu-thread-posix.c:73 #3  0x003c44016e95153b
>>> in ?? ()
>>>
>>> My host is Mac OS 10.6.8. My guest isn't really anything. I have used
>>> Windows XP before but it isn't necessary to reproduce the problem.
>>>
>>> The ?? is what appears to be the problem. I can't even print
>>> instructions at that address. Any ideas as to what is calling the
>>> qemu_mutex_lock() function could help.

The unknown code here is probably some place where gdb cannot find the
frame pointer.  Not a surprise if you are using a 5 year old debugger
with (presumably) a newer compiler.

>> Reproduced with a FreeDOS image from QEMU Advent Calendar.  It locks up
>> as soon as you type "beep".
>>
>> It works with the PulseAudio and ALSA backends, but it doesn't with the
>> SDL backend, even on Linux.
>>
>> Also, it deadlocks even with KVM enabled.
>>
>> Paolo
> 
> OK, I see a pattern. SDL and CoreAudio both don't support audio input. Both of them have this code:
>  .voice_size_in  = 0
> 
> Alsa and PulseAudio do support audio input and work. Coincidence?

Yes.  Locking in SDL is completely broken.  sdl_callback runs with the
SDL audio lock taken, but then it waits on a semaphore so you cannot
call any other SDL audio function from the main thread.  As soon as you
do that, you get a deadlock.  I'm strongly tempted to just remove the
driver.

On the other hand, CoreAudio seems to be okay.  Can you try "thread
apply all bt full" from gdb?

Paolo

  reply	other threads:[~2015-05-12  9:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 16:40 [Qemu-devel] Help with deadlock when using sound Programmingkid
2015-05-06 17:00 ` Peter Maydell
2015-05-06 19:41   ` Programmingkid
2015-05-06 21:10     ` Peter Maydell
2015-05-06 21:19       ` Programmingkid
2015-05-06 21:31         ` Peter Maydell
2015-05-06 21:41           ` Programmingkid
2015-05-06 21:53             ` Peter Maydell
2015-05-06 21:30       ` Programmingkid
2015-05-10 14:54 ` Paolo Bonzini
2015-05-10 15:55   ` Paolo Bonzini
2015-05-10 19:41   ` Programmingkid
2015-05-11 22:43   ` Programmingkid
2015-05-12  7:45     ` Paolo Bonzini [this message]
2015-05-12 18:59       ` Programmingkid
2015-05-13  3:23       ` Programmingkid
2015-05-13  9:38         ` Peter Maydell
2015-05-13 13:54           ` Programmingkid
2015-05-13 15:03             ` Peter Maydell
2015-05-13 13:56           ` Paolo Bonzini
     [not found] <BDB13C47-556C-4C58-8A4C-2BB7343F1FB4@gmail.com>
2015-05-10 14:05 ` Programmingkid

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5551AFB0.5020908@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).