qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Daniel P . Berrange" <berrange@redhat.com>,
	peterx@redhat.com,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PATCH 1/9] vl: export machine_init_done
Date: Mon,  5 Mar 2018 14:50:32 +0800	[thread overview]
Message-ID: <20180305065040.10353-2-peterx@redhat.com> (raw)
In-Reply-To: <20180305065040.10353-1-peterx@redhat.com>

We have that variable but not exported.  Export that so modules can have
a way to poke on whether machine init has finished.

Meanwhile, set that up even before calling the notifiers, so that
notifiers who may depend on this field will get a correct answer.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 include/sysemu/sysemu.h   | 2 ++
 stubs/machine-init-done.c | 2 ++
 vl.c                      | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 77bb3da582..3f0f35610b 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -86,6 +86,8 @@ void qemu_system_guest_panicked(GuestPanicInformation *info);
 void qemu_add_exit_notifier(Notifier *notify);
 void qemu_remove_exit_notifier(Notifier *notify);
 
+extern bool machine_init_done;
+
 void qemu_add_machine_init_done_notifier(Notifier *notify);
 void qemu_remove_machine_init_done_notifier(Notifier *notify);
 
diff --git a/stubs/machine-init-done.c b/stubs/machine-init-done.c
index 9a0d62514f..4121f1709b 100644
--- a/stubs/machine-init-done.c
+++ b/stubs/machine-init-done.c
@@ -2,6 +2,8 @@
 #include "qemu-common.h"
 #include "sysemu/sysemu.h"
 
+bool machine_init_done = true;
+
 void qemu_add_machine_init_done_notifier(Notifier *notify)
 {
 }
diff --git a/vl.c b/vl.c
index a33ac008fb..57777e8d47 100644
--- a/vl.c
+++ b/vl.c
@@ -2712,7 +2712,7 @@ static void qemu_run_exit_notifiers(void)
     notifier_list_notify(&exit_notifiers, NULL);
 }
 
-static bool machine_init_done;
+bool machine_init_done;
 
 void qemu_add_machine_init_done_notifier(Notifier *notify)
 {
@@ -2729,8 +2729,8 @@ void qemu_remove_machine_init_done_notifier(Notifier *notify)
 
 static void qemu_run_machine_init_done_notifiers(void)
 {
-    notifier_list_notify(&machine_init_done_notifiers, NULL);
     machine_init_done = true;
+    notifier_list_notify(&machine_init_done_notifiers, NULL);
 }
 
 static const QEMUOption *lookup_opt(int argc, char **argv,
-- 
2.14.3

  reply	other threads:[~2018-03-05  6:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05  6:50 [Qemu-devel] [PATCH 0/9] chardev: qio related non-default context support Peter Xu
2018-03-05  6:50 ` Peter Xu [this message]
2018-03-05 11:48   ` [Qemu-devel] [PATCH 1/9] vl: export machine_init_done Marc-André Lureau
2018-03-06  5:20     ` Peter Xu
2018-03-05  6:50 ` [Qemu-devel] [PATCH 2/9] chardev: fix leak in tcp_chr_telnet_init_io() Peter Xu
2018-03-05 11:48   ` Marc-André Lureau
2018-03-05  6:50 ` [Qemu-devel] [PATCH 3/9] chardev: update net listener gcontext Peter Xu
2018-03-05 11:48   ` Marc-André Lureau
2018-03-05  6:50 ` [Qemu-devel] [PATCH 4/9] chardev: allow telnet gsource to switch gcontext Peter Xu
2018-03-05  6:50 ` [Qemu-devel] [PATCH 5/9] chardev: introduce chr_machine_done hook Peter Xu
2018-03-05 10:54   ` Marc-André Lureau
2018-03-06  5:27     ` Peter Xu
2018-03-05  6:50 ` [Qemu-devel] [PATCH 6/9] chardev: use chardev's gcontext for async connect Peter Xu
2018-03-05  6:50 ` [Qemu-devel] [PATCH 7/9] chardev: tcp: postpone async connection setup Peter Xu
2018-03-05  6:50 ` [Qemu-devel] [PATCH 8/9] chardev: tcp: let TLS run on chardev context Peter Xu
2018-03-05  6:50 ` [Qemu-devel] [PATCH 9/9] chardev: tcp: postpone TLS work until machine done Peter Xu
2018-03-05  7:43 ` [Qemu-devel] [PATCH 0/9] chardev: qio related non-default context support no-reply
2018-03-05  7:59   ` Peter Xu

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=20180305065040.10353-2-peterx@redhat.com \
    --to=peterx@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).