[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Cleanups to suspend-event-channel patches.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1215171558 -3600 # Node ID 6c2fe520e32d3076d0dab4f243fcb6d0832953cb # Parent 9353f9931d9671d683b94ecdfd124c3a6d9cef68 Cleanups to suspend-event-channel patches. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- tools/libxc/xc_domain.c | 3 ++- tools/libxc/xenctrl.h | 3 ++- tools/xcutils/xc_save.c | 21 +++------------------ xen/common/domain.c | 2 +- xen/common/event_channel.c | 12 ++++++------ xen/include/xen/event.h | 7 ++----- 6 files changed, 16 insertions(+), 32 deletions(-) diff -r 9353f9931d96 -r 6c2fe520e32d tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Fri Jul 04 12:20:19 2008 +0100 +++ b/tools/libxc/xc_domain.c Fri Jul 04 12:39:18 2008 +0100 @@ -981,7 +981,8 @@ int xc_domain_set_target( return do_domctl(xc_handle, &domctl); } -int xc_dom_subscribe(int xc_handle, domid_t dom, evtchn_port_t port) +int xc_domain_subscribe_for_suspend( + int xc_handle, domid_t dom, evtchn_port_t port) { DECLARE_DOMCTL; diff -r 9353f9931d96 -r 6c2fe520e32d tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Fri Jul 04 12:20:19 2008 +0100 +++ b/tools/libxc/xenctrl.h Fri Jul 04 12:39:18 2008 +0100 @@ -814,7 +814,8 @@ int xc_flask_op(int xc_handle, flask_op_ * Subscribe to state changes in a domain via evtchn. * Returns -1 on failure, in which case errno will be set appropriately. */ -int xc_dom_subscribe(int xc_handle, domid_t domid, evtchn_port_t port); +int xc_domain_subscribe_for_suspend( + int xc_handle, domid_t domid, evtchn_port_t port); /************************** * GRANT TABLE OPERATIONS * diff -r 9353f9931d96 -r 6c2fe520e32d tools/xcutils/xc_save.c --- a/tools/xcutils/xc_save.c Fri Jul 04 12:20:19 2008 +0100 +++ b/tools/xcutils/xc_save.c Fri Jul 04 12:39:18 2008 +0100 @@ -25,9 +25,7 @@ static struct suspendinfo { int xce; /* event channel handle */ - int suspend_evtchn; - int suspended_evtchn; } si; /** @@ -47,11 +45,6 @@ static int compat_suspend(int domid) static int suspend_evtchn_release(int xc, int domid) { - if (si.suspended_evtchn >= 0) { - xc_dom_subscribe(xc, domid, 0); - xc_evtchn_unbind(si.xce, si.suspended_evtchn); - si.suspended_evtchn = -1; - } if (si.suspend_evtchn >= 0) { xc_evtchn_unbind(si.xce, si.suspend_evtchn); si.suspend_evtchn = -1; @@ -75,7 +68,6 @@ static int suspend_evtchn_init(int xc, i si.xce = -1; si.suspend_evtchn = -1; - si.suspended_evtchn = -1; xs = xs_daemon_open(); if (!xs) { @@ -107,14 +99,7 @@ static int suspend_evtchn_init(int xc, i goto cleanup; } - si.suspended_evtchn = xc_evtchn_bind_unbound_port(si.xce, domid); - if (si.suspended_evtchn < 0) { - errx(1, "failed to allocate suspend notification port: %d", - si.suspended_evtchn); - goto cleanup; - } - - rc = xc_dom_subscribe(xc, domid, si.suspended_evtchn); + rc = xc_domain_subscribe_for_suspend(xc, domid, port); if (rc < 0) { errx(1, "failed to subscribe to domain: %d", rc); goto cleanup; @@ -149,10 +134,10 @@ static int evtchn_suspend(int domid) errx(1, "error polling suspend notification channel: %d", rc); return 0; } - } while (rc != si.suspended_evtchn); + } while (rc != si.suspend_evtchn); /* harmless for one-off suspend */ - if (xc_evtchn_unmask(si.xce, si.suspended_evtchn) < 0) + if (xc_evtchn_unmask(si.xce, si.suspend_evtchn) < 0) errx(1, "failed to unmask suspend notification channel: %d", rc); /* notify xend that it can do device migration */ diff -r 9353f9931d96 -r 6c2fe520e32d xen/common/domain.c --- a/xen/common/domain.c Fri Jul 04 12:20:19 2008 +0100 +++ b/xen/common/domain.c Fri Jul 04 12:39:18 2008 +0100 @@ -98,7 +98,7 @@ static void __domain_finalise_shutdown(s d->is_shut_down = 1; if ( (d->shutdown_code == SHUTDOWN_suspend) && d->suspend_evtchn ) - evtchn_set_pending(dom0->vcpu[0], d->suspend_evtchn); + evtchn_send(d, d->suspend_evtchn); else send_guest_global_virq(dom0, VIRQ_DOM_EXC); } diff -r 9353f9931d96 -r 6c2fe520e32d xen/common/event_channel.c --- a/xen/common/event_channel.c Fri Jul 04 12:20:19 2008 +0100 +++ b/xen/common/event_channel.c Fri Jul 04 12:39:18 2008 +0100 @@ -55,6 +55,8 @@ rc = (_errno); \ goto out; \ } while ( 0 ) + +static int evtchn_set_pending(struct vcpu *v, int port); static int virq_is_global(int virq) { @@ -470,11 +472,10 @@ static long evtchn_close(evtchn_close_t return __evtchn_close(current->domain, close->port); } - -long evtchn_send(unsigned int lport) +int evtchn_send(struct domain *d, unsigned int lport) { struct evtchn *lchn, *rchn; - struct domain *ld = current->domain, *rd; + struct domain *ld = d, *rd; struct vcpu *rvcpu; int rport, ret = 0; @@ -534,8 +535,7 @@ out: return ret; } - -int evtchn_set_pending(struct vcpu *v, int port) +static int evtchn_set_pending(struct vcpu *v, int port) { struct domain *d = v->domain; @@ -891,7 +891,7 @@ long do_event_channel_op(int cmd, XEN_GU struct evtchn_send send; if ( copy_from_guest(&send, arg, 1) != 0 ) return -EFAULT; - rc = evtchn_send(send.port); + rc = evtchn_send(current->domain, send.port); break; } diff -r 9353f9931d96 -r 6c2fe520e32d xen/include/xen/event.h --- a/xen/include/xen/event.h Fri Jul 04 12:20:19 2008 +0100 +++ b/xen/include/xen/event.h Fri Jul 04 12:39:18 2008 +0100 @@ -15,9 +15,6 @@ #include <xen/softirq.h> #include <asm/bitops.h> #include <asm/event.h> - -/* Returns TRUE if the delivery port was already pending. */ -int evtchn_set_pending(struct vcpu *v, int port); /* * send_guest_vcpu_virq: Notify guest via a per-VCPU VIRQ. @@ -41,8 +38,8 @@ void send_guest_global_virq(struct domai */ int send_guest_pirq(struct domain *d, int pirq); -/* Send a notification from a local event-channel port. */ -long evtchn_send(unsigned int lport); +/* Send a notification from a given domain's event-channel port. */ +int evtchn_send(struct domain *d, unsigned int lport); /* Bind a local event-channel port to the specified VCPU. */ long evtchn_bind_vcpu(unsigned int port, unsigned int vcpu_id); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |