xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Chong Li <lichong659@gmail.com>
Cc: Chong Li <chong.li@wustl.edu>, Wei Liu <wei.liu2@citrix.com>,
	Sisu Xi <xisisu@gmail.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	xen-devel <xen-devel@lists.xen.org>,
	Meng Xu <mengxu@cis.upenn.edu>,
	Dagaen Golomb <dgolomb@seas.upenn.edu>
Subject: Re: [PATCH v7 for Xen 4.7 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Date: Fri, 18 Mar 2016 10:17:31 +0100	[thread overview]
Message-ID: <1458292651.15374.82.camel@citrix.com> (raw)
In-Reply-To: <CAGHO-iodYVZziEAhKenKgs3_F-ByyX-CK35kWRk+UuAoShbp+A@mail.gmail.com>


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

On Thu, 2016-03-17 at 14:50 -0500, Chong Li wrote:
> On Wed, Mar 16, 2016 at 11:05 PM, Dario Faggioli
> <dario.faggioli@citrix.com> wrote:
> > 
> > On Wed, 2016-03-16 at 11:47 -0500, Chong Li wrote:
> > > 
> > > +/* Set the RTDS scheduling parameters of all vcpus of a domain
> > > */
> > > +static int sched_rtds_vcpus_params_set_all(libxl__gc *gc,
> > > uint32_t
> > > domid,
> > > +                               const libxl_vcpu_sched_params
> > > *scinfo)
> > > 
> > Indentation?
> If I follow the indentation rule, the second line would be longer
> than
> 80 characters.
> The function name is just too long.
> 
static
int sched_rtds_vcpus_params_set_all(libxl__gc *gc, uint32_t domid,
                                    const libxl_vcpu_sched_params *scinfo)

or 

static int
sched_rtds_vcpus_params_set_all(libxl__gc *gc, uint32_t domid,
                                const libxl_vcpu_sched_params *scinfo)

or shorten the name.

From quickly looking at libxl, neither of the first two proposed
solutions seems to happen much, so I recommend shortening the name a
bit. It's an internal function, so we can do that pretty freely.

> > > LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT) {
> > > -        if (scinfo->budget < 1) {
> > > -            LOG(ERROR, "VCPU budget is not set or out of range,
> > > "
> > > -                       "valid values are larger than 1");
> > > +    if (scinfo->period !=
> > > LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT &&
> > > +        scinfo->budget !=
> > > LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT)
> > > +        if (sched_rtds_validate_params(gc, scinfo->period,
> > > scinfo-
> > > > 
> > > > budget))
> > >              return ERROR_INVAL;
> > > 
> > I'm not sure I understand. What's happening in this function?
> > 
> > As it stands after this patch, it looks to me that:
> >  - we read the default scheduling parameter from Xen,
> >    via xc_sched_rtds_domain_get()
> >  - we (possibly, if both are non-default) validate a new period and
> >    budget couple of values
> >  - we don't use such values for anything, and set back what we got
> >    from Xen, via xc_sched_rtds_domain_set()
> > 
> > Either I'm missing something very basic, or this is not what Wei
> > said
> > when reviewing v6:
> > 
> > "Then at callsites you set those values with two direct assignment:
> > 
> >    if (validate(period_value, budget_value) != 0) {
> >        error;
> >    }
> >    period = period_value;
> >    budget = budget_value;"
> > 
> > Is it?
> The current RTDS (xen 4.6) is:
> 
> 1) Read the (per-domain) scheduling params from Xen, and store them
> to sdom
> 2) If period equals LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT (which is
> -1), use sdom.period;
>     else sdom.period = new period (if new period is valid);
>     If budget equals LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT (which
> is
> -1), use sdom.budget;
>     else sdom.budget = new budget;
> 3) xc_sched_rtds_domain_set (sdom);
> 
Sort of, let me restate it more generally:

 1) get currently set period and budget;
 2) if scinfo->period is not PERIOD_DEFAULT and is valid, update
    the period;
 3) if scinfo->budget is not BUDGET_DEFAULT and is valid, update
    the budget

However that happens in terms of where the values of budget and period
are stashed, what call to xc_sched_rtds_domain_{get,set}() are made,
etc.

So, basically, when you say "if period equals PERIOD_DEFAULT", you mean
scinfo->period, i.e., the period being set is just the default libxl
value for it, which in turns means (most likely) one want to only alter
the budget.

> In our patch, my plan is:
> 1) Read the default params from Xen, and store them to sdom
> 2) If period equals LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT (which is
> -1), use sdom.period;
>     else sdom.period = new period (if new period is valid);
>     If budget equals LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT (which
> is
> -1), use sdom.budget;
>     else sdom.budget = new budget;
> 3) xc_sched_rtds_domain_set (sdom);
> 
> Even though I made some mistakes in this post (forgot the two "else"s
> in my plan), is this plan ok?
> 
Your plan should be to leve things exactly as they are, from a
functional/logical perspective.

The difference between "(per-domain) scheduling params from Xen" of
right now, and "the default params from Xen" of after the patch, is of
no concern here, as it's all done by Xen.

So, really, this should be _all_ about taking the chance of refactoring
the code such as the validating function does not have weird side
effects, not about changing the logic, which looks fine to me.

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:[~2016-03-18  9:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 16:47 [PATCH v7 for Xen 4.7 0/4] Enable per-VCPU parameter settings for RTDS scheduler Chong Li
2016-03-16 16:47 ` [PATCH v7 for Xen 4.7 1/4] xen: enable " Chong Li
2016-03-17 10:03   ` Dario Faggioli
2016-03-17 20:42     ` Chong Li
2016-03-18  7:39       ` Jan Beulich
2016-03-18 10:47         ` Dario Faggioli
2016-03-18 20:22           ` Chong Li
2016-03-18  7:48     ` Jan Beulich
2016-03-16 16:47 ` [PATCH v7 for Xen 4.7 2/4] libxc: " Chong Li
2016-03-16 19:24   ` Wei Liu
2016-03-17  2:28   ` Dario Faggioli
2016-03-16 16:47 ` [PATCH v7 for Xen 4.7 3/4] libxl: " Chong Li
2016-03-16 19:24   ` Wei Liu
2016-03-17  4:05   ` Dario Faggioli
2016-03-17 19:50     ` Chong Li
2016-03-18  9:17       ` Dario Faggioli [this message]
2016-03-17  4:29   ` Dario Faggioli
2016-03-16 16:47 ` [PATCH v7 for Xen 4.7 4/4] xl: " Chong Li
2016-03-16 19:24   ` Wei Liu
2016-03-16 19:29     ` 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=1458292651.15374.82.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=Ian.Jackson@eu.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).