All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Juergen Gross <jgross@suse.com>,
	xen-devel@lists.xen.org, ian.jackson@eu.citrix.com,
	stefano.stabellini@eu.citrix.com, wei.liu2@citrix.com,
	dgdegra@tycho.nsa.gov
Subject: Re: [PATCH v3 14/15] tools: don't stop xenstore domain when stopping dom0
Date: Fri, 15 Jan 2016 16:12:39 +0000	[thread overview]
Message-ID: <1452874359.6020.66.camel@citrix.com> (raw)
In-Reply-To: <1452258526-4797-15-git-send-email-jgross@suse.com>

On Fri, 2016-01-08 at 14:08 +0100, Juergen Gross wrote:
> +# get xenstore domain id (or 0 if no xenstore domain)
> +get_xsdomid()
> +{
> +    XS_DOMID=`${bindir}/xenstore-read /tool/xenstored/domid 2>/dev/null`
> +    if test $? -ne 0; then
> +        XS_DOMID=0
> +    fi

In principal this could be:
+    XS_DOMID=`${bindir}/xenstore-read /tool/xenstored/domid 2>/dev/null || echo 0`

But I'm far from convinced that is an improvement.

> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index f9933cb..29f9d19 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -4856,15 +4856,17 @@ static int main_shutdown_or_reboot(int do_reboot,
> int argc, char **argv)
>          if (wait_for_it)
>              deathws = calloc(nb_domain, sizeof(*deathws));
>  
> +        wait_for_it = 0;

Please can we avoid reusing the boolean flag used for argument handling as
a counter.

I think you will need to introduce a new nrdeathws.

I was thinking if you could invert the loop to count downwards such that
you can decrement nb_domain for uninteresting domains, but then the uses of
deathws[i] don't work, the solving of which would no doubt require another
variable anyway.


>          for (i = 0; i<nb_domain; i++) {
> -            if (dominfo[i].domid == 0)
> +            if (dominfo[i].domid == 0 || dominfo[i].never_stop)
>                  continue;
>              fn(dominfo[i].domid, deathws ? &deathws[i] : NULL, i,
>                 fallback_trigger);
> +            wait_for_it++;
>          }
>  
> -        if (wait_for_it) {
> -            wait_for_domain_deaths(deathws, nb_domain - 1 /* not dom 0
> */);
> +        if (deathws) {
> +            wait_for_domain_deaths(deathws, wait_for_it);
>              free(deathws);
>          }
>  
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-01-15 16:12 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 13:08 [PATCH v3 00/15] xenstore: make it easier to run xenstore in a domain Juergen Gross
2016-01-08 13:08 ` [PATCH v3 01/15] xen: add xenstore domain flag to hypervisor Juergen Gross
2016-01-08 14:07   ` Jan Beulich
2016-01-08 16:13     ` David Vrabel
     [not found]   ` <568FD0B902000078000C4E8F@suse.com>
2016-01-08 14:22     ` Juergen Gross
2016-01-08 14:25       ` Andrew Cooper
2016-01-08 16:03       ` Jan Beulich
     [not found]       ` <568FEBE402000078000C500D@suse.com>
2016-01-08 16:10         ` Juergen Gross
2016-01-15 15:50   ` Ian Campbell
2016-01-08 13:08 ` [PATCH v3 02/15] libxc: support new xenstore domain flag in libxc Juergen Gross
2016-01-08 13:08 ` [PATCH v3 03/15] libxl: provide a flag in dominfo to avoid stopping it Juergen Gross
2016-01-15 15:51   ` Ian Campbell
2016-01-08 13:08 ` [PATCH v3 04/15] xenstore: move init-xenstore-domain to tools/helpers Juergen Gross
2016-01-15 15:51   ` Ian Campbell
2016-01-08 13:08 ` [PATCH v3 05/15] xenstore: adjust coding style of init-xenstore-domain.c Juergen Gross
2016-01-15 15:54   ` Ian Campbell
2016-01-08 13:08 ` [PATCH v3 06/15] libxl: move xen-init-dom0 to tools/helpers Juergen Gross
2016-01-15 15:55   ` Ian Campbell
2016-01-08 13:08 ` [PATCH v3 07/15] xenstore: destroy xenstore domain in case of error after creating it Juergen Gross
2016-01-15 16:02   ` Ian Campbell
2016-01-08 13:08 ` [PATCH v3 08/15] xenstore: add error messages to init-xenstore-domain Juergen Gross
2016-01-08 13:08 ` [PATCH v3 09/15] xenstore: modify init-xenstore-domain parameter syntax Juergen Gross
2016-01-08 13:08 ` [PATCH v3 10/15] xenstore: make use of the "xenstore domain" flag Juergen Gross
2016-01-15 16:03   ` Ian Campbell
2016-01-08 13:08 ` [PATCH v3 11/15] xenstore: add init-xenstore-domain parameter to specify cmdline Juergen Gross
2016-01-08 13:08 ` [PATCH v3 12/15] tools: split up xen-init-dom0.c Juergen Gross
2016-01-08 13:08 ` [PATCH v3 13/15] xenstore: write xenstore domain data to xenstore Juergen Gross
2016-01-08 13:08 ` [PATCH v3 14/15] tools: don't stop xenstore domain when stopping dom0 Juergen Gross
2016-01-15 16:12   ` Ian Campbell [this message]
2016-01-15 16:24     ` Juergen Gross
2016-01-08 13:08 ` [PATCH v3 15/15] docs: document xenstore domain xenstore paths Juergen Gross
2016-01-15 16:14   ` Ian Campbell
2016-01-15 16:22     ` Juergen Gross
2016-01-15 16:27       ` Ian Campbell
2016-01-15 15:04 ` [PATCH v3 00/15] xenstore: make it easier to run xenstore in a domain Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452874359.6020.66.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jgross@suse.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.