From: Alexander Graf <agraf@suse.de>
To: QEMU-devel Developers <qemu-devel@nongnu.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [Qemu-devel] [PATCH 1/9] xen: introduce xen_change_state_handler
Date: Wed, 27 Jul 2011 15:30:49 +0200 [thread overview]
Message-ID: <1311773457-8842-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1311773457-8842-1-git-send-email-agraf@suse.de>
From: Anthony PERARD <anthony.perard@citrix.com>
Remove the call to xenstore_record_dm_state from xen_main_loop_prepare
that is HVM specific.
Add a new vm_change_state_handler shared between xen_pv and xen_hvm
machines to record the VM state to xenstore.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
xen-all.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/xen-all.c b/xen-all.c
index 167bed6..83c5476 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -797,12 +797,17 @@ void xenstore_store_pv_console_info(int i, CharDriverState *chr)
}
}
-static void xenstore_record_dm_state(XenIOState *s, const char *state)
+static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)
{
char path[50];
+ if (xs == NULL) {
+ fprintf(stderr, "xenstore connection not initialized\n");
+ exit(1);
+ }
+
snprintf(path, sizeof (path), "/local/domain/0/device-model/%u/state", xen_domid);
- if (!xs_write(s->xenstore, XBT_NULL, path, state, strlen(state))) {
+ if (!xs_write(xs, XBT_NULL, path, state, strlen(state))) {
fprintf(stderr, "error recording dm state\n");
exit(1);
}
@@ -823,15 +828,20 @@ static void xen_main_loop_prepare(XenIOState *state)
if (evtchn_fd != -1) {
qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state);
}
-
- /* record state running */
- xenstore_record_dm_state(state, "running");
}
/* Initialise Xen */
-static void xen_vm_change_state_handler(void *opaque, int running, int reason)
+static void xen_change_state_handler(void *opaque, int running, int reason)
+{
+ if (running) {
+ /* record state running */
+ xenstore_record_dm_state(xenstore, "running");
+ }
+}
+
+static void xen_hvm_change_state_handler(void *opaque, int running, int reason)
{
XenIOState *state = opaque;
if (running) {
@@ -854,6 +864,7 @@ int xen_init(void)
xen_be_printf(NULL, 0, "can't open xen interface\n");
return -1;
}
+ qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);
return 0;
}
@@ -915,7 +926,7 @@ int xen_hvm_init(void)
xen_map_cache_init();
xen_ram_init(ram_size);
- qemu_add_vm_change_state_handler(xen_vm_change_state_handler, state);
+ qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);
state->client = xen_cpu_phys_memory_client;
QLIST_INIT(&state->physmap);
--
1.6.0.2
next prev parent reply other threads:[~2011-07-27 13:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-27 13:30 [Qemu-devel] [PULL 0/9] xen patch queue 2011-07-26 Alexander Graf
2011-07-27 13:30 ` Alexander Graf [this message]
2011-07-27 13:30 ` [Qemu-devel] [PATCH 2/9] xen: Fix xen_enabled() Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 3/9] exec.c: Use ram_addr_t in cpu_physical_memory_rw(...) Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 4/9] xen: remove CONFIG_XEN_MAPCACHE Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 5/9] xen: make xen_enabled even more clever Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 6/9] cpu-common: Have a ram_addr_t of uint64 with Xen Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 7/9] xen: Fix the memory registration to reflect of what is done by Xen Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 8/9] vl.c: Check the asked ram_size later Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 9/9] xen: implement unplug protocol in xen_platform Alexander Graf
2011-07-29 15:47 ` [Qemu-devel] [PULL 0/9] xen patch queue 2011-07-26 Anthony Liguori
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=1311773457-8842-2-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=anthony.perard@citrix.com \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.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).