From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcIKo-0003L0-3g for qemu-devel@nongnu.org; Thu, 30 Jun 2011 10:35:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QcIKm-0002Th-L5 for qemu-devel@nongnu.org; Thu, 30 Jun 2011 10:35:14 -0400 Received: from cantor2.suse.de ([195.135.220.15]:50942 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcIKm-0002Ta-7Q for qemu-devel@nongnu.org; Thu, 30 Jun 2011 10:35:12 -0400 Message-ID: <4E0C899F.6070708@suse.de> Date: Thu, 30 Jun 2011 16:35:11 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1309346169-14554-1-git-send-email-stefano.stabellini@eu.citrix.com> <4E0C6802.6080200@suse.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] xen: introduce xen_change_state_handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Stabellini Cc: Anthony Perard , "xen-devel@lists.xensource.com" , "qemu-devel@nongnu.org" On 06/30/2011 04:37 PM, Stefano Stabellini wrote: > On Thu, 30 Jun 2011, Alexander Graf wrote: >> On 06/29/2011 01:16 PM, stefano.stabellini@eu.citrix.com wrote: >>> From: Anthony PERARD >>> >>> 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 >>> Signed-off-by: Stefano Stabellini >>> --- >>> xen-all.c | 25 ++++++++++++++++++------- >>> 1 files changed, 18 insertions(+), 7 deletions(-) >>> >>> diff --git a/xen-all.c b/xen-all.c >>> index 3fd04ef..e8da35f 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"); >>> + } >> So where is this ever executed in the PV case? > > qemu_add_vm_change_state_handler(xen_change_state_handler, NULL) is now > called by xen_init, that is common between xen_pv and xen_fv machines Ah, there it is. Sorry, I missed it the first time I read the patch :). Alex From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH] xen: introduce xen_change_state_handler Date: Thu, 30 Jun 2011 16:35:11 +0200 Message-ID: <4E0C899F.6070708@suse.de> References: <1309346169-14554-1-git-send-email-stefano.stabellini@eu.citrix.com> <4E0C6802.6080200@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Stefano Stabellini Cc: Anthony Perard , "xen-devel@lists.xensource.com" , "qemu-devel@nongnu.org" List-Id: xen-devel@lists.xenproject.org On 06/30/2011 04:37 PM, Stefano Stabellini wrote: > On Thu, 30 Jun 2011, Alexander Graf wrote: >> On 06/29/2011 01:16 PM, stefano.stabellini@eu.citrix.com wrote: >>> From: Anthony PERARD >>> >>> 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 >>> Signed-off-by: Stefano Stabellini >>> --- >>> xen-all.c | 25 ++++++++++++++++++------- >>> 1 files changed, 18 insertions(+), 7 deletions(-) >>> >>> diff --git a/xen-all.c b/xen-all.c >>> index 3fd04ef..e8da35f 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"); >>> + } >> So where is this ever executed in the PV case? > > qemu_add_vm_change_state_handler(xen_change_state_handler, NULL) is now > called by xen_init, that is common between xen_pv and xen_fv machines Ah, there it is. Sorry, I missed it the first time I read the patch :). Alex