From: Jiri Denemark Subject: [PATCH] Fix xenconsole after aborted save Date: Mon, 20 Apr 2009 15:23:53 +0200 Message-ID: <20090420132353.GA20653@orkuz.home> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="mYCpIKhGyMATD0i+" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --mYCpIKhGyMATD0i+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi. When a domain is resumed after aborted save (e.g., because of insufficient space on a device where the domain is being saved), xm console cannot send/read any data. The reason is that the event channel used by xenconsole stays unbound. This patch modifies xenconsoled to check current status of open event channels and rebind them if necessary. Signed-off-by: Jiri Denemark --mYCpIKhGyMATD0i+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="console-evtchn-rebind.patch" diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -523,6 +523,7 @@ static int domain_create_ring(struct dom { int err, remote_port, ring_ref, rc; char *type, path[PATH_MAX]; + int rebind = 0; err = xs_gather(xs, dom->serialpath, "ring-ref", "%u", &ring_ref, @@ -548,8 +549,17 @@ static int domain_create_ring(struct dom } free(type); - if ((ring_ref == dom->ring_ref) && (remote_port == dom->remote_port)) - goto out; + if ((ring_ref == dom->ring_ref) && (remote_port == dom->remote_port)) { + xc_evtchn_status_t status = { + .dom = DOMID_SELF, + .port = dom->local_port }; + + if (xc_evtchn_status(xc, &status) + || status.status != EVTCHNSTAT_interdomain) + rebind = 1; + else + goto out; + } if (ring_ref != dom->ring_ref) { if (dom->interface != NULL) @@ -565,17 +575,19 @@ static int domain_create_ring(struct dom dom->ring_ref = ring_ref; } - dom->local_port = -1; - dom->remote_port = -1; - if (dom->xce_handle != -1) - xc_evtchn_close(dom->xce_handle); + if (!rebind) { + dom->local_port = -1; + dom->remote_port = -1; + if (dom->xce_handle != -1) + xc_evtchn_close(dom->xce_handle); - /* Opening evtchn independently for each console is a bit - * wasteful, but that's how the code is structured... */ - dom->xce_handle = xc_evtchn_open(); - if (dom->xce_handle == -1) { - err = errno; - goto out; + /* Opening evtchn independently for each console is a bit + * wasteful, but that's how the code is structured... */ + dom->xce_handle = xc_evtchn_open(); + if (dom->xce_handle == -1) { + err = errno; + goto out; + } } rc = xc_evtchn_bind_interdomain(dom->xce_handle, --mYCpIKhGyMATD0i+ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --mYCpIKhGyMATD0i+--