[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] merge?
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 38312fe7ec38dab85c5ac7158efd776bacb44717 # Parent 287d36b46fa3b7ec38f40a8ca799e8223d3df5ff # Parent 1fc6473ecc01534798a94ada161878dfa3330e2a merge? diff -r 287d36b46fa3 -r 38312fe7ec38 tools/console/daemon/io.c --- a/tools/console/daemon/io.c Tue Aug 30 20:36:49 2005 +++ b/tools/console/daemon/io.c Wed Aug 31 08:27:34 2005 @@ -215,9 +215,6 @@ char *dompath, *path; int err; - dom->page = NULL; - dom->evtchn_fd = -1; - asprintf(&path, "/console/%d/domain", dom->domid); dompath = xs_read(xs, path, NULL); free(path); @@ -232,28 +229,35 @@ if (err) goto out; - dom->page = xc_map_foreign_range(xc, dom->domid, getpagesize(), - PROT_READ|PROT_WRITE, dom->mfn); if (dom->page == NULL) { - err = EINVAL; - goto out; - } - - /* Opening evtchn independently for each console is a bit - * wastefule, but that's how the code is structured... */ - err = open("/dev/xen/evtchn", O_RDWR); - if (err == -1) { - err = errno; - goto out; - } - dom->evtchn_fd = err; - - if (ioctl(dom->evtchn_fd, EVENTCHN_BIND, dom->local_port) == -1) { - err = errno; - munmap(dom->page, getpagesize()); - close(dom->evtchn_fd); - dom->evtchn_fd = -1; - goto out; + dom->page = xc_map_foreign_range(xc, dom->domid, getpagesize(), + PROT_READ|PROT_WRITE, + dom->mfn); + if (dom->page == NULL) { + err = EINVAL; + goto out; + } + } + + if (dom->evtchn_fd == -1) { + /* Opening evtchn independently for each console is a bit + * wastefule, but that's how the code is structured... */ + err = open("/dev/xen/evtchn", O_RDWR); + if (err == -1) { + err = errno; + goto out; + } + dom->evtchn_fd = err; + + if (ioctl(dom->evtchn_fd, EVENTCHN_BIND, + dom->local_port) == -1) { + err = errno; + munmap(dom->page, getpagesize()); + dom->page = NULL; + close(dom->evtchn_fd); + dom->evtchn_fd = -1; + goto out; + } } out: @@ -281,6 +285,9 @@ dom->buffer.max_capacity = 0; dom->next = NULL; + dom->page = NULL; + dom->evtchn_fd = -1; + domain_create_ring(dom); dolog(LOG_DEBUG, "New domain %d", domid); @@ -290,22 +297,19 @@ static struct domain *lookup_domain(int domid) { - struct domain **pp; - - for (pp = &dom_head; *pp; pp = &(*pp)->next) { - struct domain *dom = *pp; - - if (dom->domid == domid) { + struct domain *dom; + + for (dom = dom_head; dom; dom = dom->next) + if (dom->domid == domid) return dom; - } else if (dom->domid > domid) { - *pp = create_domain(domid); - (*pp)->next = dom; - return *pp; - } - } - - *pp = create_domain(domid); - return *pp; + + dom = create_domain(domid); + if (!dom) + return NULL; + dom->next = dom_head; + dom_head = dom; + + return dom; } static void remove_domain(struct domain *dom) @@ -345,6 +349,20 @@ } } +void enum_domains(void) +{ + int domid = 1; + xc_dominfo_t dominfo; + struct domain *dom; + + while (xc_domain_getinfo(xc, domid, 1, &dominfo) == 1) { + dom = lookup_domain(dominfo.domid); + if (dominfo.dying || dominfo.crashed || dominfo.shutdown) + dom->is_dead = true; + domid = dominfo.domid + 1; + } +} + static void handle_tty_read(struct domain *dom) { ssize_t len; @@ -415,20 +433,28 @@ dolog(LOG_ERR, "read from xcs failed! %m"); exit(1); } -} - -static void enum_domains(void) -{ - int domid = 0; - xc_dominfo_t dominfo; + + enum_domains(); +} + +static void handle_xs(int fd) +{ + char **vec; + int domid; struct domain *dom; - while (xc_domain_getinfo(xc, domid, 1, &dominfo) == 1) { - dom = lookup_domain(dominfo.domid); - if (dominfo.dying || dominfo.crashed || dominfo.shutdown) - dom->is_dead = true; - domid = dominfo.domid + 1; - } + vec = xs_read_watch(xs); + if (!vec) + return; + + if (sscanf(vec[0], "/console/%d", &domid) == 1) { + dom = lookup_domain(domid); + if (dom && (dom->evtchn_fd == -1 || dom->page == NULL)) + domain_create_ring(dom); + } + + xs_acknowledge_watch(xs, vec[1]); + free(vec); } void handle_io(void) @@ -438,7 +464,7 @@ do { struct domain *d; - struct timeval tv = { 1, 0 }; + struct timeval tv = { 100, 0 }; int max_fd = -1; FD_ZERO(&readfds); @@ -446,6 +472,9 @@ FD_SET(xcs_data_fd, &readfds); max_fd = MAX(xcs_data_fd, max_fd); + + FD_SET(xs_fileno(xs), &readfds); + max_fd = MAX(xs_fileno(xs), max_fd); for (d = dom_head; d; d = d->next) { if (d->tty_fd != -1) { @@ -463,7 +492,9 @@ } ret = select(max_fd + 1, &readfds, &writefds, 0, &tv); - enum_domains(); + + if (FD_ISSET(xs_fileno(xs), &readfds)) + handle_xs(xs_fileno(xs)); if (FD_ISSET(xcs_data_fd, &readfds)) handle_xcs_msg(xcs_data_fd); diff -r 287d36b46fa3 -r 38312fe7ec38 tools/console/daemon/io.h --- a/tools/console/daemon/io.h Tue Aug 30 20:36:49 2005 +++ b/tools/console/daemon/io.h Wed Aug 31 08:27:34 2005 @@ -21,6 +21,7 @@ #ifndef CONSOLED_IO_H #define CONSOLED_IO_H +void enum_domains(void); void handle_io(void); #endif diff -r 287d36b46fa3 -r 38312fe7ec38 tools/console/daemon/main.c --- a/tools/console/daemon/main.c Tue Aug 30 20:36:49 2005 +++ b/tools/console/daemon/main.c Wed Aug 31 08:27:34 2005 @@ -85,6 +85,8 @@ xen_setup(); + enum_domains(); + handle_io(); closelog(); diff -r 287d36b46fa3 -r 38312fe7ec38 tools/console/daemon/utils.c --- a/tools/console/daemon/utils.c Tue Aug 30 20:36:49 2005 +++ b/tools/console/daemon/utils.c Wed Aug 31 08:27:34 2005 @@ -232,11 +232,16 @@ dolog(LOG_ERR, "xcs virq bind failed. Possible bug."); goto out_close_data; } - + + if (!xs_watch(xs, "/console", "console")) { + dolog(LOG_ERR, "xenstore watch on /console failes."); + goto out_close_data; + } + return true; out_close_data: - close(xcs_ctrl_fd); + close(xcs_data_fd); xcs_data_fd = -1; out_close_ctrl: close(xcs_ctrl_fd); diff -r 287d36b46fa3 -r 38312fe7ec38 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Tue Aug 30 20:36:49 2005 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Aug 31 08:27:34 2005 @@ -1045,10 +1045,9 @@ def publish_console(self): db = DBMap(db=XenNode("/console/%d" % self.id)) - db.clear() db['domain'] = self.db.getPath() db.saveDB(save=True) - + def configure_fields(self): """Process the vm configuration fields using the registered handlers. """ diff -r 287d36b46fa3 -r 38312fe7ec38 xen/common/domain.c --- a/xen/common/domain.c Tue Aug 30 20:36:49 2005 +++ b/xen/common/domain.c Wed Aug 31 08:27:34 2005 @@ -114,6 +114,8 @@ sched_rem_domain(v); domain_relinquish_resources(d); put_domain(d); + + send_guest_virq(dom0->vcpu[0], VIRQ_DOM_EXC); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |