qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Lluís Vilanova" <vilanova@ac.upc.edu>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	Riku Voipio <riku.voipio@iki.fi>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCHv17/8] [trivial] Track when QEMU has finished initialization
Date: Tue, 13 Oct 2015 19:11:01 +0200	[thread overview]
Message-ID: <20151013171100.21325.36966.stgit@localhost> (raw)
In-Reply-To: <20151013171020.21325.27626.stgit@localhost>

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 Makefile.objs            |    2 +-
 bsd-user/main.c          |    1 +
 include/qemu-common.h    |    3 +++
 linux-user/main.c        |    1 +
 qemu-common.c            |   14 ++++++++++++++
 stubs/Makefile.objs      |    1 +
 stubs/qemu-common-stub.c |   21 +++++++++++++++++++++
 vl.c                     |    2 ++
 8 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 qemu-common.c
 create mode 100644 stubs/qemu-common-stub.c

diff --git a/Makefile.objs b/Makefile.objs
index bc43e5c..e1d7b25 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -2,7 +2,7 @@
 # Common libraries for tools and emulators
 stub-obj-y = stubs/
 util-obj-y = util/ qobject/ qapi/
-util-obj-y += qmp-introspect.o qapi-types.o qapi-visit.o qapi-event.o
+util-obj-y += qmp-introspect.o qapi-types.o qapi-visit.o qapi-event.o qemu-common.o
 
 #######################################################################
 # block-obj-y is code used by both qemu system emulation and qemu-img
diff --git a/bsd-user/main.c b/bsd-user/main.c
index f0a1268..43f85e6 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -1121,6 +1121,7 @@ int main(int argc, char **argv)
         gdbserver_start (gdbstub_port);
         gdb_handlesig(cpu, 0);
     }
+    qemu_initialized = true;
     cpu_loop(env);
     /* never exits */
     return 0;
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 0bd212b..33f6909 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -35,6 +35,9 @@
 # error Unknown pointer size
 #endif
 
+/* Whether the system has finished initializing */
+extern bool qemu_initialized;
+
 void cpu_ticks_init(void);
 
 /* icount */
diff --git a/linux-user/main.c b/linux-user/main.c
index 1f60ff2..9bd2912 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4663,6 +4663,7 @@ int main(int argc, char **argv, char **envp)
         }
         gdb_handlesig(cpu, 0);
     }
+    qemu_initialized = true;
     cpu_loop(env);
     /* never exits */
     return 0;
diff --git a/qemu-common.c b/qemu-common.c
new file mode 100644
index 0000000..4b5ca1a
--- /dev/null
+++ b/qemu-common.c
@@ -0,0 +1,14 @@
+/*
+ * Common symbol definitions for all tools and targets.
+ *
+ * Copyright (C) 2011-2015 Lluís Vilanova <vilanova@ac.upc.edu>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+*/
+
+#include "qemu-common.h"
+
+
+/* Whether QEMU has been initialized. */
+bool qemu_initialized;
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 85e4e81..259504f 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -39,3 +39,4 @@ stub-obj-y += cpus.o
 stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
+stub-obj-y += qemu-common-stub.o
diff --git a/stubs/qemu-common-stub.c b/stubs/qemu-common-stub.c
new file mode 100644
index 0000000..f34f019
--- /dev/null
+++ b/stubs/qemu-common-stub.c
@@ -0,0 +1,21 @@
+/*
+ * Common symbol definitions for all tools and targets.
+ *
+ * Copyright (C) 2011-2015 Lluís Vilanova <vilanova@ac.upc.edu>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+*/
+
+#include "qemu-common.h"
+#include <qemu/module.h>
+
+
+static void do_qemu_initialized_init(void)
+{
+    /* Tools always consider QEMU as inited */
+    qemu_initialized = true;
+}
+
+/* Block is always inited on both tools (and targets) */
+block_init(do_qemu_initialized_init);
diff --git a/vl.c b/vl.c
index f2bd8d2..aae8d47 100644
--- a/vl.c
+++ b/vl.c
@@ -4637,6 +4637,8 @@ int main(int argc, char **argv, char **envp)
         }
     }
 
+    qemu_initialized = true;
+
     main_loop();
     bdrv_close_all();
     pause_all_vcpus();

  parent reply	other threads:[~2015-10-13 17:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 17:10 [Qemu-devel] [RFC][PATCHv10/8] trace: Per-vCPU tracing states Lluís Vilanova
2015-10-13 17:10 ` [Qemu-devel] [PATCHv11/8] trace: Add support for vCPU pointers in trace events Lluís Vilanova
2015-10-16  9:13   ` Stefan Hajnoczi
2015-10-16 15:12     ` Eduardo Habkost
2015-10-16 15:44       ` Lluís Vilanova
2015-10-13 17:10 ` [Qemu-devel] [PATCHv12/8] trace: Add 'vcpu' event property Lluís Vilanova
2015-10-16  9:16   ` Stefan Hajnoczi
2015-10-16 15:45     ` Lluís Vilanova
2015-10-13 17:10 ` [Qemu-devel] [PATCHv13/8] trace: [tcg] Identify events with the 'vcpu' property Lluís Vilanova
2015-10-13 17:33   ` Eric Blake
2015-10-13 18:27     ` Lluís Vilanova
2015-10-13 18:57       ` Markus Armbruster
2015-10-13 17:10 ` [Qemu-devel] [PATCHv14/8] exec: [tcg] Refactor flush of per-CPU virtual TB cache Lluís Vilanova
2015-10-13 17:10 ` [Qemu-devel] [PATCHv15/8] exec: [ŧcg] Use multiple physical TB caches Lluís Vilanova
2015-10-13 17:10 ` [Qemu-devel] [PATCHv16/8] exec: [tcg] Track which vCPU is performing translation and execution Lluís Vilanova
2015-10-13 17:11 ` Lluís Vilanova [this message]
2015-10-13 18:56   ` [Qemu-devel] [PATCHv17/8] [trivial] Track when QEMU has finished initialization Markus Armbruster
2015-10-13 17:11 ` [Qemu-devel] [PATCHv18/8] trace: [tcg] Add per-vCPU tracing states for events with the 'vcpu' property Lluís Vilanova
2015-10-13 17:50   ` Eric Blake
2015-10-13 19:43     ` Lluís Vilanova
2015-10-16  9:19   ` Stefan Hajnoczi
2015-10-16 15:42     ` Lluís Vilanova
2015-10-13 17:26 ` [Qemu-devel] [RFC][PATCHv10/8] trace: Per-vCPU tracing states Lluís Vilanova

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=20151013171100.21325.36966.stgit@localhost \
    --to=vilanova@ac.upc.edu \
    --cc=blauwirbel@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=stefanha@gmail.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).