Patchwork [v2,15/39] vl: init main loop earlier

login
register
mail settings
Submitter Paolo Bonzini
Date Oct. 31, 2012, 3:30 p.m.
Message ID <1351697456-16107-16-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/195930/
State New
Headers show

Comments

Paolo Bonzini - Oct. 31, 2012, 3:30 p.m.
Otherwise, chardevs will not be able to create a bottom half as soon
as that will require an AioContext.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 vl.c | 12 ++++++------
 1 file modificato, 6 inserzioni(+), 6 rimozioni(-)
Jan Kiszka - Nov. 2, 2012, 7:26 a.m.
On 2012-10-31 16:30, Paolo Bonzini wrote:
> Otherwise, chardevs will not be able to create a bottom half as soon
> as that will require an AioContext.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  vl.c | 12 ++++++------
>  1 file modificato, 6 inserzioni(+), 6 rimozioni(-)
> 
> diff --git a/vl.c b/vl.c
> index b3186fa..f84e969 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3311,6 +3311,12 @@ int main(int argc, char **argv, char **envp)
>      }
>      loc_set_none();
>  
> +    qemu_init_cpu_loop();
> +    if (qemu_init_main_loop()) {
> +        fprintf(stderr, "qemu_init_main_loop failed\n");
> +        exit(1);
> +    }
> +
>      if (qemu_opts_foreach(qemu_find_opts("sandbox"), parse_sandbox, NULL, 0)) {
>          exit(1);
>      }
> @@ -3463,12 +3469,6 @@ int main(int argc, char **argv, char **envp)
>  
>      configure_accelerator();
>  
> -    qemu_init_cpu_loop();
> -    if (qemu_init_main_loop()) {
> -        fprintf(stderr, "qemu_init_main_loop failed\n");
> -        exit(1);
> -    }
> -
>      machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
>      if (machine_opts) {
>          kernel_filename = qemu_opt_get(machine_opts, "kernel");
> 

This breaks daemonize as the BQL is marked as owned by the father
process. See also [1] in this context.

Can we move os_daemonize before that, or what are its dependencies? I
have an increasingly bad feeling about this code shuffling.

Jan

[1] http://thread.gmane.org/gmane.comp.emulators.qemu/179311

Patch

diff --git a/vl.c b/vl.c
index b3186fa..f84e969 100644
--- a/vl.c
+++ b/vl.c
@@ -3311,6 +3311,12 @@  int main(int argc, char **argv, char **envp)
     }
     loc_set_none();
 
+    qemu_init_cpu_loop();
+    if (qemu_init_main_loop()) {
+        fprintf(stderr, "qemu_init_main_loop failed\n");
+        exit(1);
+    }
+
     if (qemu_opts_foreach(qemu_find_opts("sandbox"), parse_sandbox, NULL, 0)) {
         exit(1);
     }
@@ -3463,12 +3469,6 @@  int main(int argc, char **argv, char **envp)
 
     configure_accelerator();
 
-    qemu_init_cpu_loop();
-    if (qemu_init_main_loop()) {
-        fprintf(stderr, "qemu_init_main_loop failed\n");
-        exit(1);
-    }
-
     machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
     if (machine_opts) {
         kernel_filename = qemu_opt_get(machine_opts, "kernel");