xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Harmandeep Kaur <write.harmandeep@gmail.com>,
	xen-devel@lists.xenproject.org
Cc: lars.kurth@citrix.com, wei.liu2@citrix.com,
	ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com,
	ian.jackson@eu.citrix.com, george.dunlap@citrix.com
Subject: Re: [PATCH v2 2/5] xl: improve return and exit codes of scheduling related functions
Date: Mon, 26 Oct 2015 10:56:50 +0100	[thread overview]
Message-ID: <1445853410.2717.35.camel@citrix.com> (raw)
In-Reply-To: <1445664696-14258-3-git-send-email-write.harmandeep@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 4080 bytes --]

On Sat, 2015-10-24 at 11:01 +0530, Harmandeep Kaur wrote:
> turning scheduling related functions xl exit codes towards using the
> EXIT_[SUCCESS|FAILURE] macros, instead of instead of arbitrary
> numbers
> or libxl return codes.
> 
"turning scheduling related xl functions exit codes..."

However, it is already clear from the "xl:" tag in the subject that
you'll be dealing with xl code, so I think you can just remove "xl"
from here.

Also, I'd (quickly) mention the fact that you are actually doing two
conversions in this patch:
 - for main_*: arbitrary --> EXIT_SUCCESS|EXIT_FAILURe
 - for internal fucntion: arbitrary --> 0/1

Finally, when sending new versions of a patch, it is rather useful that
you include:
 - in the cover letter, a summary of what changed, overall, in that
particular new version of the series (big-ish changes, and/or changes
related on the series structure, like new patch being added, etc.);
 - in each patch, a summary of what changed in that particular patch.
That's helpful for people doing the reviews, as it make quite easi to
check whether you actually considered all points that where raised
during previous iteration.

The latter, you can put (I usually do it in bulleted list form) in...
> Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
> ---
>
...here, i.e., after the "---" mark just below the Signed-off-by: tag.
This way, git will throw it away when committing the patch, which is a
good thing (in fact, we want the summary to be there during review, but
we don't want it in `git log').

About the patch, this is really good, and we're almost there (AFAICT).
I think I found an issue, though, here:

> @@ -5975,13 +5965,12 @@ static int
> sched_domain_output(libxl_scheduler sched, int (*output)(int),
>      libxl_cpupoolinfo *poolinfo = NULL;
>      uint32_t poolid;
>      int nb_domain, n_pools = 0, i, p;
> -    int rc = 0;
>  
>      if (cpupool) {
>          if (libxl_cpupool_qualifier_to_cpupoolid(ctx, cpupool,
> &poolid, NULL) ||
>              !libxl_cpupoolid_is_valid(ctx, poolid)) {
>              fprintf(stderr, "unknown cpupool \'%s\'\n", cpupool);
> -            return -ERROR_FAIL;
> +            return 1;
>          }
>      }
>  
> @@ -5994,10 +5983,10 @@ static int
> sched_domain_output(libxl_scheduler sched, int (*output)(int),
>      if (!poolinfo) {
>          fprintf(stderr, "error getting cpupool info\n");
>          libxl_dominfo_list_free(info, nb_domain);
> -        return -ERROR_NOMEM;
> +        return 1;
>      }
>  
> -    for (p = 0; !rc && (p < n_pools); p++) {
> +    for (p = 0; p < n_pools; p++) {
>          if ((poolinfo[p].sched != sched) ||
>              (cpupool && (poolid != poolinfo[p].poolid)))
>              continue;
>
I don't think we can just get rid of rc in this way. In fact...


> @@ -6008,8 +5997,7 @@ static int sched_domain_output(libxl_scheduler
> sched, int (*output)(int),
>          for (i = 0; i < nb_domain; i++) {
>              if (info[i].cpupool != poolinfo[p].poolid)
>                  continue;
> -            rc = output(info[i].domid);
> -            if (rc)
> +            if (output(info[i].domid))
>                  break;
>
... if the call to whatever output points fails, we break out from the
inner loop, but not from the outer one, while the original code wanted
us to leave that one too.

So, I think in this case you should keep rc, or use another strategy,
involving 'return'-s or 'goto'-s (but I think just keeping rc is the
easiest and better solution).

It is quite possible that I suggested you to do this during v1's
review. If yes, that was because I must have missed the "!rc" part of
the outer loop condition... Sorry for that. :-P

Thanks and Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2015-10-26  9:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-24  5:31 [PATCH v2 0/5] xl: convert exit codes to EXIT_[SUCCESS|FAILURE] Harmandeep Kaur
2015-10-24  5:31 ` [PATCH v2 1/5] " Harmandeep Kaur
2015-10-26  9:32   ` Dario Faggioli
2015-10-26 17:39   ` Wei Liu
2015-10-24  5:31 ` [PATCH v2 2/5] xl: improve return and exit codes of scheduling related functions Harmandeep Kaur
2015-10-26  9:56   ` Dario Faggioli [this message]
2015-10-24  5:31 ` [PATCH v2 3/5] xl: improve return and exit codes of vcpu " Harmandeep Kaur
2015-10-26 10:03   ` Dario Faggioli
2015-10-24  5:31 ` [PATCH v2 4/5] xl: improve return and exit codes of cpupool " Harmandeep Kaur
2015-10-26 10:06   ` Dario Faggioli
2015-10-24  5:31 ` [PATCH v2 5/5] xl: improve return and exit codes of parse " Harmandeep Kaur
2015-10-26 10:34   ` Dario Faggioli
2015-10-26 10:40   ` Dario Faggioli
2015-10-26 17:54   ` Wei Liu

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=1445853410.2717.35.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=lars.kurth@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=write.harmandeep@gmail.com \
    --cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).