diff mbox

vl: take iothread lock very early

Message ID 54F5F037.1000703@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini March 3, 2015, 5:32 p.m. UTC
On 03/03/2015 18:19, Oliver Francke wrote:
> 
> #0  __GI_exit (status=1) at exit.c:104
> #1  0x000055555575cf15 in os_daemonize () at os-posix.c:227
> #2  0x0000555555773f2e in main (argc=50, argv=0x7fffffffe0d8,
> envp=0x7fffffffe270) at vl.c:3770
> 
> compiled with "--enable-debug" and in gdb "b exit". Not a coder, so if
> this is _not_ sufficient, please give me some adivce ;)

Try removing -daemonize (hmm, that might actually fix the bug).  You
should not need "b exit", because the error is a SIGABRT and gdb stops
automatically.  The fix could be something like this:


Paolo

Comments

Oliver Francke March 3, 2015, 6:02 p.m. UTC | #1
Hi,

> Am 03.03.2015 um 18:32 schrieb Paolo Bonzini <pbonzini@redhat.com>:
> 
> 
> 
> On 03/03/2015 18:19, Oliver Francke wrote:
>> 
>> #0  __GI_exit (status=1) at exit.c:104
>> #1  0x000055555575cf15 in os_daemonize () at os-posix.c:227
>> #2  0x0000555555773f2e in main (argc=50, argv=0x7fffffffe0d8,
>> envp=0x7fffffffe270) at vl.c:3770
>> 
>> compiled with "--enable-debug" and in gdb "b exit". Not a coder, so if
>> this is _not_ sufficient, please give me some adivce ;)
> 
> Try removing -daemonize (hmm, that might actually fix the bug).  You
> should not need "b exit", because the error is a SIGABRT and gdb stops
> automatically.  The fix could be something like this:
> 

I can confirm, that un-daemonized the VM works, as well as…

> diff --git a/vl.c b/vl.c
> index e1ffd0a..af61835 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3759,7 +3759,9 @@ int main(int argc, char **argv, char **envp)
> 
>     loc_set_none();
> 
> +    qemu_mutex_unlock_iothread();
>     os_daemonize();
> +    qemu_mutex_lock_iothread();
> 

… after applying these 2 lines.


So thnx very much for the quick help/fix.

Oliver.

>     if (qemu_init_main_loop(&main_loop_err)) {
>         error_report_err(main_loop_err);
> 
> Paolo
Christian Borntraeger March 4, 2015, 10:20 p.m. UTC | #2
Am 03.03.2015 um 18:32 schrieb Paolo Bonzini:
> 
> 
> On 03/03/2015 18:19, Oliver Francke wrote:
>>
>> #0  __GI_exit (status=1) at exit.c:104
>> #1  0x000055555575cf15 in os_daemonize () at os-posix.c:227
>> #2  0x0000555555773f2e in main (argc=50, argv=0x7fffffffe0d8,
>> envp=0x7fffffffe270) at vl.c:3770
>>
>> compiled with "--enable-debug" and in gdb "b exit". Not a coder, so if
>> this is _not_ sufficient, please give me some adivce ;)
> 
> Try removing -daemonize (hmm, that might actually fix the bug).  You
> should not need "b exit", because the error is a SIGABRT and gdb stops
> automatically.  The fix could be something like this:
> 
> diff --git a/vl.c b/vl.c
> index e1ffd0a..af61835 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3759,7 +3759,9 @@ int main(int argc, char **argv, char **envp)
> 
>      loc_set_none();
> 
> +    qemu_mutex_unlock_iothread();
>      os_daemonize();
> +    qemu_mutex_lock_iothread();
> 
>      if (qemu_init_main_loop(&main_loop_err)) {
>          error_report_err(main_loop_err);
> 
> Paolo
> 

This also fixes some strange issues with libvirt after qemu updates, so probably also a candidate for a quick merge.

Christian
Eric Blake March 5, 2015, 12:40 a.m. UTC | #3
On 03/03/2015 10:32 AM, Paolo Bonzini wrote:
> 
> 
> On 03/03/2015 18:19, Oliver Francke wrote:
>>
>> #0  __GI_exit (status=1) at exit.c:104
>> #1  0x000055555575cf15 in os_daemonize () at os-posix.c:227
>> #2  0x0000555555773f2e in main (argc=50, argv=0x7fffffffe0d8,
>> envp=0x7fffffffe270) at vl.c:3770
>>
>> compiled with "--enable-debug" and in gdb "b exit". Not a coder, so if
>> this is _not_ sufficient, please give me some adivce ;)
> 
> Try removing -daemonize (hmm, that might actually fix the bug).

I've confirmed that libvirt required -daemonize, and that (temporarily)
removing -daemonize makes things work again.  So we definitely need this.

Tested-by: Eric Blake <eblake@redhat.com>

>  You
> should not need "b exit", because the error is a SIGABRT and gdb stops
> automatically.  The fix could be something like this:
> 
> diff --git a/vl.c b/vl.c
> index e1ffd0a..af61835 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3759,7 +3759,9 @@ int main(int argc, char **argv, char **envp)
> 
>      loc_set_none();
> 
> +    qemu_mutex_unlock_iothread();
>      os_daemonize();
> +    qemu_mutex_lock_iothread();
> 
>      if (qemu_init_main_loop(&main_loop_err)) {
>          error_report_err(main_loop_err);
> 
> Paolo
> 
> 
>
Christian Borntraeger March 5, 2015, 10:07 a.m. UTC | #4
Am 05.03.2015 um 01:40 schrieb Eric Blake:
> On 03/03/2015 10:32 AM, Paolo Bonzini wrote:
>>
>>
>> On 03/03/2015 18:19, Oliver Francke wrote:
>>>
>>> #0  __GI_exit (status=1) at exit.c:104
>>> #1  0x000055555575cf15 in os_daemonize () at os-posix.c:227
>>> #2  0x0000555555773f2e in main (argc=50, argv=0x7fffffffe0d8,
>>> envp=0x7fffffffe270) at vl.c:3770
>>>
>>> compiled with "--enable-debug" and in gdb "b exit". Not a coder, so if
>>> this is _not_ sufficient, please give me some adivce ;)
>>
>> Try removing -daemonize (hmm, that might actually fix the bug).
> 
> I've confirmed that libvirt required -daemonize, and that (temporarily)
> removing -daemonize makes things work again.  So we definitely need this.
> 
> Tested-by: Eric Blake <eblake@redhat.com>

Yes, came to the same conclusion.
Is there a chance to harden the error detection of libvirt somewhat?
I got things like 
"unsupported OS type hvm"
"unsupported configuration: QEMU 2.2.50 is too new for help parsing"

which made it quite hard to find out what was wrong.

Christian
diff mbox

Patch

diff --git a/vl.c b/vl.c
index e1ffd0a..af61835 100644
--- a/vl.c
+++ b/vl.c
@@ -3759,7 +3759,9 @@  int main(int argc, char **argv, char **envp)

     loc_set_none();

+    qemu_mutex_unlock_iothread();
     os_daemonize();
+    qemu_mutex_lock_iothread();

     if (qemu_init_main_loop(&main_loop_err)) {
         error_report_err(main_loop_err);