All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Josh Whitehead <josh.whitehead@dornerworks.com>
Cc: Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Robert VanVossen <robert.vanvossen@dornerworks.com>,
	Xen-devel <xen-devel@lists.xen.org>,
	Nathan Studer <nate.studer@gmail.com>
Subject: Re: [RFC PATCH v2 2/7] Fixed formatting and misleading comments/variables. Added comments and renamed variables to accurately reflect modern terminology
Date: Fri, 11 Jul 2014 05:59:40 +0200	[thread overview]
Message-ID: <1405051180.29306.208.camel@Solace> (raw)
In-Reply-To: <1404939348-4926-3-git-send-email-josh.whitehead@dornerworks.com>


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

On mer, 2014-07-09 at 16:55 -0400, Josh Whitehead wrote:
> Due to the age of the scheduler there were many incorrect/misleading comments
> and variable names, the bulk of which centered around the fact that "VCPU" and
> "Domain" used to be synonymous.  Therefore a large portion of these modifcations
> involve simply changing a variable "d" to a "v" or a "dom" to "vcpu" so that the
> comments and variable names are accurate to what's being used.
> 
Indeed!

> A few other name changes were also made, the most significant being the change
> from "slice" to "budget" to better reflect modern terminology used in real-time
> algorithms such as CBS and deferrable server.
> 
BTW, I said that, at libxl and libxc level (but I mostly was referring
to libxl) it's fine to keep slice as the name of this param, at least
for now.

I confirm that that's what I think, for libxl. Right here, deep down
inside the hypervisor, I agree about the slice-->budget transition.

> --- a/xen/common/sched_sedf.c
> +++ b/xen/common/sched_sedf.c

> @@ -28,14 +49,13 @@
>  #define SEDF_ASLEEP (16)
>  
This one here alone, and define to 16, is kind of ugly, but I shall say
that when reviewing the previous patch...

>  #define DEFAULT_PERIOD (MILLISECS(20))
> -#define DEFAULT_SLICE (MILLISECS(10))
> +#define DEFAULT_BUDGET (MILLISECS(10))
>  
>  #define PERIOD_MAX MILLISECS(10000) /* 10s  */
>  #define PERIOD_MIN (MICROSECS(10))  /* 10us */
> -#define SLICE_MIN (MICROSECS(5))    /*  5us */
> +#define BUDGET_MIN (MICROSECS(5))    /*  5us */
>
How about we make the name of the scheduler part of the name of these
macros. I.e., SEDF_DEFAULT_BUDGET and SEDF_MIN_BUDGET (or
SEDF_BUDGET_MIN, but I like it worse) ?

It's certainly not necessary, but it's what other schedulers do, and it
may come handy when grep-ping, etc.

> -#define IMPLY(a, b) (!(a) || (b))
> -#define EQ(a, b) ((!!(a)) == (!!(b)))
> +#define EQ(_A, _B) ((!!(_A)) == (!!(_B)))
>  
Do we really need to keep this? Not such a big deal I guess, but I truly
tryly truly dislike it! :-(

>  struct sedf_dom_info {
> @@ -52,16 +72,16 @@ struct sedf_vcpu_info {
>      struct list_head list;
>   
>      /* Parameters for EDF */
> -    s_time_t  period;  /* = relative deadline */
> -    s_time_t  slice;   /* = worst case execution time */
> +    s_time_t  period;  /* = Server scheduling period */
>
I'd say "VCPUs scheduling period". I know 'Server' is the correct term,
but I suspect it will just be confusing people...
 
>  #define SEDF_PRIV(_ops) \
>      ((struct sedf_priv_info *)((_ops)->sched_data))
> -#define EDOM_INFO(d)   ((struct sedf_vcpu_info *)((d)->sched_priv))
> -#define CPU_INFO(cpu)  \
> -    ((struct sedf_cpu_info *)per_cpu(schedule_data, cpu).sched_priv)
> -#define LIST(d)        (&EDOM_INFO(d)->list)
> -#define RUNQ(cpu)      (&CPU_INFO(cpu)->runnableq)
> -#define WAITQ(cpu)     (&CPU_INFO(cpu)->waitq)
> -#define IDLETASK(cpu)  (idle_vcpu[cpu])
> +#define SEDF_VCPU(_vcpu)   ((struct sedf_vcpu_info *)((_vcpu)->sched_priv))
> +#define SEDF_PCPU(_cpu)  \
> +    ((struct sedf_cpu_info *)per_cpu(schedule_data, _cpu).sched_priv)
> +#define LIST(_vcpu)        (&SEDF_VCPU(_vcpu)->list)
> +#define RUNQ(_cpu)      (&SEDF_PCPU(_cpu)->runnableq)
> +#define WAITQ(_cpu)     (&SEDF_PCPU(_cpu)->waitq)
> +#define IDLETASK(_cpu)  (idle_vcpu[_cpu])
>  
While at this, can you put down a comment on what LIST, RUNQ and WAITQ
are? RUNQ is pretty obvious, the others, not so much.

>  #define PERIOD_BEGIN(inf) ((inf)->deadl_abs - (inf)->period)
>  
> -#define DIV_UP(x,y) (((x) + (y) - 1) / y)
> +#define DIV_UP(_X, _Y) (((_X) + (_Y) - 1) / _Y)
>  
Does this makes much difference?
 
>  /*
> - * Adds a domain to the queue of processes which wait for the beginning of the
> - * next period; this list is therefore sortet by this time, which is simply
> + * Adds a vcpu to the queue of processes which wait for the beginning of the
                               of vcpus    ?

> + * next period; this list is therefore sorted by this time, which is simply
>   * absol. deadline - period.
>   */ 
> -DOMAIN_COMPARER(waitq, list, PERIOD_BEGIN(d1), PERIOD_BEGIN(d2));
> +VCPU_COMPARER(waitq, list, PERIOD_BEGIN(v1), PERIOD_BEGIN(v2));
>  static inline void __add_to_waitqueue_sort(struct vcpu *v)
>  {
>      ASSERT(!__task_on_queue(v));
> @@ -156,12 +176,12 @@ static inline void __add_to_waitqueue_sort(struct vcpu *v)
>  }
>  
>  /*
> - * Adds a domain to the queue of processes which have started their current
> + * Adds a vcpu to the queue of processes which have started their current
>
same here.

>   * period and are runnable (i.e. not blocked, dieing,...). The first element
>   * on this list is running on the processor, if the list is empty the idle
>   * task will run. As we are implementing EDF, this list is sorted by deadlines.
>   */ 

> @@ -187,19 +207,19 @@ static void *sedf_alloc_vdata(const struct scheduler *ops, struct vcpu *v, void
>  
>      inf->vcpu = v;
>  
> -    inf->deadl_abs   = 0;
> -    inf->status      = SEDF_ASLEEP;
> +    inf->deadl_abs  = 0;
> +    inf->status     = SEDF_ASLEEP;
>  
>      if (v->domain->domain_id == 0)
>      {
> -        /* Domain 0, needs a slice to boot the machine */
> -        inf->period      = DEFAULT_PERIOD;
> -        inf->slice       = DEFAULT_SLICE;
> +        /* Domain 0, needs a budget to boot the machine */
> +        inf->period = DEFAULT_PERIOD;
> +        inf->budget = DEFAULT_BUDGET;
>      }
>      else
>      {
> -        inf->period      = DEFAULT_PERIOD;
> -        inf->slice       = 0;
> +        inf->period = DEFAULT_PERIOD;
> +        inf->budget = 0;
>      }
>
So, by default, Dom0 gets DEFAULT_BUDGET, other domains get 0. Does this
mean they can't even start executing until someone changes that
manually, by modifying the parameters and giving them some budget?


>  static struct task_slice sedf_do_schedule(
>      const struct scheduler *ops, s_time_t now, bool_t tasklet_work_scheduled)
> @@ -401,18 +421,18 @@ static struct task_slice sedf_do_schedule(
>      int                   cpu      = smp_processor_id();
>      struct list_head     *runq     = RUNQ(cpu);
>      struct list_head     *waitq    = WAITQ(cpu);
> -    struct sedf_vcpu_info *inf     = EDOM_INFO(current);
> +    struct sedf_vcpu_info *inf     = SEDF_VCPU(current);
>      struct sedf_vcpu_info *runinf, *waitinf;
>      struct task_slice      ret;
>  
>      SCHED_STAT_CRANK(schedule);
>  
> -    /* Idle tasks don't need any of the following stuf */
> +    /* Idle tasks don't need any of the following stuff */
          Idle vcpu

It's again not a big deal, but it's more consistent.

>  /*
> - * This function wakes up a domain, i.e. moves them into the waitqueue
> - * things to mention are: admission control is taking place nowhere at
> - * the moment, so we can't be sure, whether it is safe to wake the domain
> - * up at all. 
>
I am all in favor of the removal of this complex and broken logic for
handling wake-ups.

However, the chunk of commit above --which is pretty much unrelated to
wake-ups-- seems something useful to have somewhere, perhaps at the
beginning of the file.

Anyway, whether you want to use this chunk or not, what I have in mind
is it'd be worth mentioning that the scheduler does not (by design)
perform any admission control at all.

What do you think?
 
> -static void sedf_wake(const struct scheduler *ops, struct vcpu *d)
> +/*
> + * This function wakes up a vcpu, i.e. moves them into the appropriate queue
> + *
> + * When a blocked vcpu unblocks, it is allowed to start execution at
> + * the beginning of the next complete period
> + * (D..deadline, R..running, B..blocking/sleeping, U..unblocking/waking up
> + *
> + * DRRB_____D__U_____DRRRRR___D________ ... 
> + *
> + * - This causes the vcpu to miss a period (and a deadlline)
> + * - Doesn't disturb the schedule at all
> + * - Deadlines keep occuring isochronous
> + */
>
Oh, ok. So, between the various special cases, you decided to pick
number 1, calle "Very conservative". If it were me, I would probably
have picked the one called "Part 2b" (i.e., the one that resets the
deadline).

Well, I don't think this matter much anyway, since you're changing it in
the next patch, I'm sure. :-)

> +static void sedf_wake(const struct scheduler *ops, struct vcpu *v)
>  {
>      s_time_t              now = NOW();
> -    struct sedf_vcpu_info* inf = EDOM_INFO(d);
> +    struct sedf_vcpu_info* inf = SEDF_VCPU(v);
>  
> -    if ( unlikely(is_idle_vcpu(d)) )
> +    if ( unlikely(is_idle_vcpu(v)) )
>          return;
>     
> -    if ( unlikely(__task_on_queue(d)) )
> +    if ( unlikely(__task_on_queue(v)) )
>          return;
>  
> -    ASSERT(!sedf_runnable(d));
> +    ASSERT(!sedf_runnable(v));
>      inf->status &= ~SEDF_ASLEEP;
>   
>      if ( unlikely(inf->deadl_abs == 0) )
>      {
>          /* Initial setup of the deadline */
> -        inf->deadl_abs = now + inf->slice;
> +        inf->deadl_abs = now + inf->budget;
>      }
>    
>  #ifdef SEDF_STATS 
> @@ -627,14 +595,14 @@ static void sedf_wake(const struct scheduler *ops, struct vcpu *d)
>      }
>      else
>      {
> -            /* Long unblocking */
> +        /* Long unblocking, someone is going to miss their deadline. */
>
Sorry? Someone who?

>          inf->long_block_tot++;
>      }

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:[~2014-07-11  3:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09 20:55 [RFC PATCH v2 0/7] Repurpose SEDF Scheduler for Real-time Use Josh Whitehead
2014-07-09 20:55 ` [RFC PATCH v2 1/7] Removed all code from sedf not needed for basic EDF functionality Josh Whitehead
2014-07-11  7:05   ` Dario Faggioli
2014-07-11 19:54     ` Konrad Rzeszutek Wilk
2014-07-14 16:06       ` Dario Faggioli
2014-07-09 20:55 ` [RFC PATCH v2 2/7] Fixed formatting and misleading comments/variables. Added comments and renamed variables to accurately reflect modern terminology Josh Whitehead
2014-07-11  3:59   ` Dario Faggioli [this message]
2014-07-09 20:55 ` [RFC PATCH v2 3/7] Added constant bandwidth server functionality to sedf scheduler Josh Whitehead
2014-07-11  9:37   ` Dario Faggioli
2014-07-09 20:55 ` [RFC PATCH v2 4/7] Add cbs parameter support and removed sedf parameters from libxc Josh Whitehead
2014-07-10 23:17   ` Dario Faggioli
2014-07-09 20:55 ` [RFC PATCH v2 5/7] Add cbs parameter support and removed sedf parameters with a LIBXL_API_VERSION gate from libxl Josh Whitehead
2014-07-10 14:09   ` Ian Campbell
2014-07-10 14:55     ` Ian Jackson
2014-07-10 23:02     ` Dario Faggioli
2014-07-11 11:12       ` Ian Campbell
2014-07-10 14:26   ` Dario Faggioli
2014-07-09 20:55 ` [RFC PATCH v2 6/7] Changed slice to budget in libxc for the sedf scheduler Josh Whitehead
2014-07-10 14:15   ` Ian Campbell
2014-07-10 23:11   ` Dario Faggioli
2014-07-11 11:11     ` Ian Campbell
2014-07-11 13:51       ` Dario Faggioli
2014-07-09 20:55 ` [RFC PATCH v2 7/7] Changed slice to budget in libxl " Josh Whitehead
2014-07-10 14:43 ` [RFC PATCH v2 0/7] Repurpose SEDF Scheduler for Real-time Use Ian Campbell
2014-07-11  5:01   ` Dario Faggioli
2014-07-11 11:15     ` Ian Campbell
2014-07-11 13:35       ` Dario Faggioli
2014-07-11 13:50         ` Ian Campbell
2014-07-11 13:58           ` Dario Faggioli
2014-07-11 20:02     ` Konrad Rzeszutek Wilk

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=1405051180.29306.208.camel@Solace \
    --to=dario.faggioli@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=josh.whitehead@dornerworks.com \
    --cc=nate.studer@gmail.com \
    --cc=robert.vanvossen@dornerworks.com \
    --cc=stefano.stabellini@eu.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.