From: Dario Faggioli <dario.faggioli@citrix.com>
To: Chong Li <lichong659@gmail.com>
Cc: Chong Li <chong.li@wustl.edu>,
wei.liu2@citrix.com, Sisu Xi <xisisu@gmail.com>,
george.dunlap@eu.citrix.com, xen-devel@lists.xen.org,
Meng Xu <mengxu@cis.upenn.edu>,
dgolomb@seas.upenn.edu
Subject: Re: [PATCH v4 for Xen 4.6 4/4] xl: enable per-VCPU parameter settings for RTDS scheduler
Date: Tue, 28 Jul 2015 11:25:14 +0200 [thread overview]
Message-ID: <1438075514.2889.33.camel@citrix.com> (raw)
In-Reply-To: <1436590356-3706-5-git-send-email-chong.li@wustl.edu>
[-- Attachment #1.1: Type: text/plain, Size: 3379 bytes --]
On Fri, 2015-07-10 at 23:52 -0500, Chong Li wrote:
> Change main_sched_rtds and related output functions to support
> per-VCPU settings.
>
This patch also looks nice. A few comments provided inline.
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index c858068..da7c8a6 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -5630,6 +5630,37 @@ static int sched_domain_set(int domid, const libxl_domain_sched_params *scinfo)
> return rc;
> }
>
> +static int sched_vcpu_get(libxl_scheduler sched, int domid,
> + libxl_vcpu_sched_params *scinfo)
> +{
> + int rc;
> +
> + rc = libxl_vcpu_sched_params_get(ctx, domid, scinfo);
> + if (rc) {
> + fprintf(stderr, "libxl_vcpu_sched_params_get failed.\n");
> + return rc;
> + }
> + if (scinfo->sched != sched) {
> + fprintf(stderr, "libxl_vcpu_sched_params_get returned %s not %s.\n",
> + libxl_scheduler_to_string(scinfo->sched),
> + libxl_scheduler_to_string(sched));
> + return ERROR_INVAL;
>
We are in xl, so there's no need to use libxl error code. It's probably
not strictly forbidden either, and xl itself is really inconsistent
about this, I know.
Personally, I never use them, and I think that using them may be
confusing, and create even more inconsistency.
> +static int sched_vcpu_set(int domid, const libxl_vcpu_sched_params *scinfo)
> +{
> + int rc;
> +
> + rc = libxl_vcpu_sched_params_set(ctx, domid, scinfo);
> + if (rc)
> + fprintf(stderr, "libxl_vcpu_sched_params_set failed.\n");
> +
> + return rc;
>
In xl, when failing, most of the time we exit(-1), or something like
that. So, it's important that you log what's happening, but then there's
no need to save the return codes and propagate them.
> static int sched_credit_params_set(int poolid, libxl_sched_credit_params *scinfo)
> {
> int rc;
> @@ -5786,6 +5817,38 @@ out:
> return rc;
> }
>
> +static int sched_rtds_vcpu_output(
> + int domid, libxl_vcpu_sched_params *scinfo)
> +{
> + char *domname;
> + int rc = 0;
> + int i;
> +
> + if (domid < 0) {
>
Style (indentation). This is not the only instance of something like
this in this patch.
> + printf("%-33s %4s %4s %9s %9s\n", "Name", "ID",
> + "VCPU", "Period", "Budget");
> + return 0;
> + }
> +
> + rc = sched_vcpu_get(LIBXL_SCHEDULER_RTDS, domid, scinfo);
> + if (rc)
> + goto out;
> +
> + domname = libxl_domid_to_name(ctx, domid);
> + for( i = 0; i < scinfo->num_vcpus; i++ ) {
>
Style:
for (i = 0; i < scinfo->num_vcpus; i++) {
and indentation, I think.
> + printf("%-33s %4d %4d %9"PRIu32" %9"PRIu32"\n",
> + domname,
> + domid,
> + scinfo->vcpus[i].vcpuid,
> + scinfo->vcpus[i].period,
> + scinfo->vcpus[i].budget);
> + }
> + free(domname);
> +
> +out:
> + return rc;
> +}
> +
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
next prev parent reply other threads:[~2015-07-28 9:25 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-11 4:52 [PATCH v4 for Xen 4.6 0/4] Enable per-VCPU parameter settings for RTDS scheduler Chong Li
2015-07-11 4:52 ` [PATCH v4 for Xen 4.6 1/4] xen: enable " Chong Li
2015-07-13 8:37 ` Jan Beulich
2015-08-09 15:45 ` Chong Li
2015-08-11 9:39 ` Jan Beulich
2015-07-27 15:51 ` Dario Faggioli
2015-08-09 16:08 ` Chong Li
2015-07-11 4:52 ` [PATCH v4 for Xen 4.6 2/4] libxc: " Chong Li
2015-07-27 16:11 ` Dario Faggioli
2015-08-07 16:35 ` Chong Li
2015-07-11 4:52 ` [PATCH v4 for Xen 4.6 3/4] libxl: " Chong Li
2015-07-28 9:15 ` Dario Faggioli
2015-08-07 17:34 ` Chong Li
2015-07-11 4:52 ` [PATCH v4 for Xen 4.6 4/4] xl: " Chong Li
2015-07-28 9:25 ` Dario Faggioli [this message]
2015-08-09 14:53 ` Chong Li
2015-07-11 14:33 ` [PATCH v4 for Xen 4.6 0/4] Enable " Wei Liu
2015-07-13 10:27 ` Dario Faggioli
2015-07-14 5:45 ` Meng Xu
2015-07-14 7:13 ` Dario Faggioli
2015-07-27 15:14 ` Dario Faggioli
2015-08-07 15:50 ` Chong Li
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=1438075514.2889.33.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=chong.li@wustl.edu \
--cc=dgolomb@seas.upenn.edu \
--cc=george.dunlap@eu.citrix.com \
--cc=lichong659@gmail.com \
--cc=mengxu@cis.upenn.edu \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
--cc=xisisu@gmail.com \
/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).