ia64/xen-unstable

changeset 7073:9ff1bea68d51

Merge.
author emellor@ewan
date Tue Sep 27 13:54:02 2005 +0100 (2005-09-27)
parents f9296342d9b2 70b6e60df750
children 63f06da6c5b0
files .hgignore Makefile linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c tools/console/daemon/io.c tools/python/xen/web/http.py tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/xenstore/xenstored_domain.c
line diff
     1.1 --- a/.hgignore	Tue Sep 27 13:53:06 2005 +0100
     1.2 +++ b/.hgignore	Tue Sep 27 13:54:02 2005 +0100
     1.3 @@ -158,6 +158,7 @@
     1.4  ^tools/xenstore/xs_dom0_test$
     1.5  ^tools/xenstore/xs_random$
     1.6  ^tools/xenstore/xs_stress$
     1.7 +^tools/xenstore/xs_tdb_dump$
     1.8  ^tools/xenstore/xs_test$
     1.9  ^tools/xenstore/xs_watch_stress$
    1.10  ^tools/xentrace/xenctx$
     2.1 --- a/Makefile	Tue Sep 27 13:53:06 2005 +0100
     2.2 +++ b/Makefile	Tue Sep 27 13:54:02 2005 +0100
     2.3 @@ -164,7 +164,7 @@ help:
     2.4  uninstall: DESTDIR=
     2.5  uninstall: D=$(DESTDIR)
     2.6  uninstall:
     2.7 -	[ -d $(D)/etc/xen ] && mv -f $(D)/etc/xen $(D)/etc/xen.old-`date +%s`
     2.8 +	[ -d $(D)/etc/xen ] && mv -f $(D)/etc/xen $(D)/etc/xen.old-`date +%s` || true
     2.9  	rm -rf $(D)/etc/init.d/xend*
    2.10  	rm -rf $(D)/etc/hotplug/xen-backend.agent
    2.11  	rm -rf $(D)/var/run/xen* $(D)/var/lib/xen*
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Tue Sep 27 13:53:06 2005 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Tue Sep 27 13:54:02 2005 +0100
     3.3 @@ -80,6 +80,15 @@ static void frontend_changed(struct xenb
     3.4  		return;
     3.5  	}
     3.6  
     3.7 +	/* Map the shared frame, irq etc. */
     3.8 +	err = blkif_map(be->blkif, ring_ref, evtchn);
     3.9 +	if (err) {
    3.10 +		xenbus_dev_error(be->dev, err, "mapping ring-ref %lu port %u",
    3.11 +				 ring_ref, evtchn);
    3.12 +		return;
    3.13 +	}
    3.14 +	/* XXX From here on should 'blkif_unmap' on error. */
    3.15 +
    3.16  again:
    3.17  	/* Supply the information about the device the frontend needs */
    3.18  	err = xenbus_transaction_start();
    3.19 @@ -112,16 +121,8 @@ again:
    3.20  		goto abort;
    3.21  	}
    3.22  
    3.23 -	/* Map the shared frame, irq etc. */
    3.24 -	err = blkif_map(be->blkif, ring_ref, evtchn);
    3.25 -	if (err) {
    3.26 -		xenbus_dev_error(be->dev, err, "mapping ring-ref %lu port %u",
    3.27 -				 ring_ref, evtchn);
    3.28 -		goto abort;
    3.29 -	}
    3.30 -
    3.31  	err = xenbus_transaction_end(0);
    3.32 -	if (err == EAGAIN)
    3.33 +	if (err == -EAGAIN)
    3.34  		goto again;
    3.35  	if (err) {
    3.36  		xenbus_dev_error(be->dev, err, "ending transaction",
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Tue Sep 27 13:53:06 2005 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Tue Sep 27 13:54:02 2005 +0100
     4.3 @@ -591,29 +591,25 @@ again:
     4.4  		goto abort_transaction;
     4.5  	}
     4.6  
     4.7 -	info->backend = backend;
     4.8 -	backend = NULL;
     4.9 -
    4.10 -	info->watch.node = info->backend;
    4.11 -	info->watch.callback = watch_for_status;
    4.12 -	err = register_xenbus_watch(&info->watch);
    4.13 -	if (err) {
    4.14 -		message = "registering watch on backend";
    4.15 -		goto abort_transaction;
    4.16 -	}
    4.17 -
    4.18  	err = xenbus_transaction_end(0);
    4.19  	if (err) {
    4.20 -		if (err == EAGAIN)
    4.21 +		if (err == -EAGAIN)
    4.22  			goto again;
    4.23  		xenbus_dev_error(dev, err, "completing transaction");
    4.24  		goto destroy_blkring;
    4.25  	}
    4.26  
    4.27 - out:
    4.28 -	if (backend)
    4.29 -		kfree(backend);
    4.30 -	return err;
    4.31 +	info->watch.node = backend;
    4.32 +	info->watch.callback = watch_for_status;
    4.33 +	err = register_xenbus_watch(&info->watch);
    4.34 +	if (err) {
    4.35 +		message = "registering watch on backend";
    4.36 +		goto destroy_blkring;
    4.37 +	}
    4.38 +
    4.39 +	info->backend = backend;
    4.40 +
    4.41 +	return 0;
    4.42  
    4.43   abort_transaction:
    4.44  	xenbus_transaction_end(1);
    4.45 @@ -621,7 +617,10 @@ again:
    4.46  	xenbus_dev_error(dev, err, "%s", message);
    4.47   destroy_blkring:
    4.48  	blkif_free(info);
    4.49 -	goto out;
    4.50 + out:
    4.51 +	if (backend)
    4.52 +		kfree(backend);
    4.53 +	return err;
    4.54  }
    4.55  
    4.56  /* Setup supplies the backend dir, virtual device.
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Tue Sep 27 13:53:06 2005 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Tue Sep 27 13:54:02 2005 +0100
     5.3 @@ -1148,31 +1148,27 @@ again:
     5.4  		goto abort_transaction;
     5.5  	}
     5.6  
     5.7 -	info->backend = backend;
     5.8 -	backend = NULL;
     5.9 -
    5.10 -	info->watch.node = info->backend;
    5.11 -	info->watch.callback = watch_for_status;
    5.12 -	err = register_xenbus_watch(&info->watch);
    5.13 -	if (err) {
    5.14 -		message = "registering watch on backend";
    5.15 -		goto abort_transaction;
    5.16 -	}
    5.17 -
    5.18  	err = xenbus_transaction_end(0);
    5.19  	if (err) {
    5.20 -		if (err == EAGAIN)
    5.21 +		if (err == -EAGAIN)
    5.22  			goto again;
    5.23  		xenbus_dev_error(dev, err, "completing transaction");
    5.24  		goto destroy_ring;
    5.25  	}
    5.26  
    5.27 +	info->watch.node = backend;
    5.28 +	info->watch.callback = watch_for_status;
    5.29 +	err = register_xenbus_watch(&info->watch);
    5.30 +	if (err) {
    5.31 +		message = "registering watch on backend";
    5.32 +		goto destroy_ring;
    5.33 +	}
    5.34 +
    5.35 +	info->backend = backend;
    5.36 +
    5.37  	netif_state = NETIF_STATE_CONNECTED;
    5.38  
    5.39 - out:
    5.40 -	if (backend)
    5.41 -		kfree(backend);
    5.42 -	return err;
    5.43 +	return 0;
    5.44  
    5.45   abort_transaction:
    5.46  	xenbus_transaction_end(1);
    5.47 @@ -1180,7 +1176,10 @@ again:
    5.48  	xenbus_dev_error(dev, err, "%s", message);
    5.49   destroy_ring:
    5.50  	shutdown_device(info);
    5.51 -	goto out;
    5.52 + out:
    5.53 +	if (backend)
    5.54 +		kfree(backend);
    5.55 +	return err;
    5.56  }
    5.57  
    5.58  /* Setup supplies the backend dir, virtual device.
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Tue Sep 27 13:53:06 2005 +0100
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Tue Sep 27 13:54:02 2005 +0100
     6.3 @@ -88,6 +88,26 @@ static void frontend_changed(struct xenb
     6.4  		return;
     6.5  	}
     6.6  
     6.7 +	err = tpmif_map(be->tpmif, ringref, evtchn);
     6.8 +	if (err) {
     6.9 +		xenbus_dev_error(be->dev, err,
    6.10 +				 "mapping shared-frame %lu port %u",
    6.11 +				 ringref, evtchn);
    6.12 +		return;
    6.13 +	}
    6.14 +
    6.15 +	err = tpmif_vtpm_open(be->tpmif,
    6.16 +	                      be->frontend_id,
    6.17 +	                      be->instance);
    6.18 +	if (err) {
    6.19 +		xenbus_dev_error(be->dev, err,
    6.20 +		                 "queueing vtpm open packet");
    6.21 +		/*
    6.22 +		 * Should close down this device and notify FE
    6.23 +		 * about closure.
    6.24 +		 */
    6.25 +		return;
    6.26 +	}
    6.27  
    6.28  	/*
    6.29  	 * Tell the front-end that we are ready to go -
    6.30 @@ -107,29 +127,8 @@ again:
    6.31  		goto abort;
    6.32  	}
    6.33  
    6.34 -	err = tpmif_map(be->tpmif, ringref, evtchn);
    6.35 -	if (err) {
    6.36 -		xenbus_dev_error(be->dev, err,
    6.37 -				 "mapping shared-frame %lu port %u",
    6.38 -				 ringref, evtchn);
    6.39 -		goto abort;
    6.40 -	}
    6.41 -
    6.42 -	err = tpmif_vtpm_open(be->tpmif,
    6.43 -	                      be->frontend_id,
    6.44 -	                      be->instance);
    6.45 -	if (err) {
    6.46 -		xenbus_dev_error(be->dev, err,
    6.47 -		                 "queueing vtpm open packet");
    6.48 -		/*
    6.49 -		 * Should close down this device and notify FE
    6.50 -		 * about closure.
    6.51 -		 */
    6.52 -		goto abort;
    6.53 -	}
    6.54 -
    6.55  	err = xenbus_transaction_end(0);
    6.56 -	if (err == EAGAIN)
    6.57 +	if (err == -EAGAIN)
    6.58  		goto again;
    6.59  	if (err) {
    6.60  		xenbus_dev_error(be->dev, err, "end of transaction");
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Tue Sep 27 13:53:06 2005 +0100
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Tue Sep 27 13:54:02 2005 +0100
     7.3 @@ -352,29 +352,25 @@ again:
     7.4  		goto abort_transaction;
     7.5  	}
     7.6  
     7.7 -	info->backend = backend;
     7.8 -	backend = NULL;
     7.9 -
    7.10 -	info->watch.node = info->backend;
    7.11 -	info->watch.callback = watch_for_status;
    7.12 -	err = register_xenbus_watch(&info->watch);
    7.13 -	if (err) {
    7.14 -		message = "registering watch on backend";
    7.15 -		goto abort_transaction;
    7.16 -	}
    7.17 -
    7.18  	err = xenbus_transaction_end(0);
    7.19 -	if (err == EAGAIN)
    7.20 +	if (err == -EAGAIN)
    7.21  		goto again;
    7.22  	if (err) {
    7.23  		xenbus_dev_error(dev, err, "completing transaction");
    7.24  		goto destroy_tpmring;
    7.25  	}
    7.26  
    7.27 -out:
    7.28 -	if (backend)
    7.29 -		kfree(backend);
    7.30 -	return err;
    7.31 +	info->watch.node = backend;
    7.32 +	info->watch.callback = watch_for_status;
    7.33 +	err = register_xenbus_watch(&info->watch);
    7.34 +	if (err) {
    7.35 +		message = "registering watch on backend";
    7.36 +		goto destroy_tpmring;
    7.37 +	}
    7.38 +
    7.39 +	info->backend = backend;
    7.40 +
    7.41 +	return 0;
    7.42  
    7.43  abort_transaction:
    7.44  	xenbus_transaction_end(1);
    7.45 @@ -382,7 +378,10 @@ abort_transaction:
    7.46  	xenbus_dev_error(dev, err, "%s", message);
    7.47  destroy_tpmring:
    7.48  	destroy_tpmring(info, &my_private);
    7.49 -	goto out;
    7.50 +out:
    7.51 +	if (backend)
    7.52 +		kfree(backend);
    7.53 +	return err;
    7.54  }
    7.55  
    7.56  
     8.1 --- a/tools/console/daemon/io.c	Tue Sep 27 13:53:06 2005 +0100
     8.2 +++ b/tools/console/daemon/io.c	Tue Sep 27 13:54:02 2005 +0100
     8.3 @@ -399,7 +399,7 @@ void enum_domains(void)
     8.4  
     8.5  	while (xc_domain_getinfo(xc, domid, 1, &dominfo) == 1) {
     8.6  		dom = lookup_domain(dominfo.domid);
     8.7 -		if (dominfo.dying || dominfo.crashed || dominfo.shutdown) {
     8.8 +		if (dominfo.dying) {
     8.9  			if (dom)
    8.10  				shutdown_domain(dom);
    8.11  		} else {
    13.1 --- a/tools/xenstore/xenstored_domain.c	Tue Sep 27 13:53:06 2005 +0100
    13.2 +++ b/tools/xenstore/xenstored_domain.c	Tue Sep 27 13:54:02 2005 +0100
    13.3 @@ -63,6 +63,8 @@ struct domain
    13.4  	/* The connection associated with this. */
    13.5  	struct connection *conn;
    13.6  
    13.7 +	/* Have we noticed that this domain is shutdown? */
    13.8 +	int shutdown;
    13.9  };
   13.10  
   13.11  static LIST_HEAD(domains);
   13.12 @@ -222,19 +224,25 @@ static void domain_cleanup(void)
   13.13  {
   13.14  	xc_dominfo_t dominfo;
   13.15  	struct domain *domain, *tmp;
   13.16 -	int released = 0;
   13.17 +	int notify = 0;
   13.18  
   13.19  	list_for_each_entry_safe(domain, tmp, &domains, list) {
   13.20  		if (xc_domain_getinfo(*xc_handle, domain->domid, 1,
   13.21  				      &dominfo) == 1 &&
   13.22 -		    dominfo.domid == domain->domid &&
   13.23 -		    !dominfo.dying && !dominfo.crashed && !dominfo.shutdown)
   13.24 -			continue;
   13.25 +		    dominfo.domid == domain->domid) {
   13.26 +			if ((dominfo.crashed || dominfo.shutdown)
   13.27 +			    && !domain->shutdown) {
   13.28 +				domain->shutdown = 1;
   13.29 +				notify = 1;
   13.30 +			}
   13.31 +			if (!dominfo.dying)
   13.32 +				continue;
   13.33 +		}
   13.34  		talloc_free(domain->conn);
   13.35 -		released++;
   13.36 +		notify = 1;
   13.37  	}
   13.38  
   13.39 -	if (released)
   13.40 +	if (notify)
   13.41  		fire_watches(NULL, "@releaseDomain", false);
   13.42  }
   13.43  
   13.44 @@ -272,6 +280,7 @@ static struct domain *new_domain(void *c
   13.45  	struct domain *domain;
   13.46  	domain = talloc(context, struct domain);
   13.47  	domain->port = 0;
   13.48 +	domain->shutdown = 0;
   13.49  	domain->domid = domid;
   13.50  	domain->path = talloc_strdup(domain, path);
   13.51  	domain->page = xc_map_foreign_range(*xc_handle, domain->domid,