xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Meng Xu <mengxu@cis.upenn.edu>
Cc: ian.campbell@citrix.com, xisisu@gmail.com,
	stefano.stabellini@eu.citrix.com, george.dunlap@eu.citrix.com,
	ian.jackson@eu.citrix.com, xen-devel@lists.xen.org,
	xumengpanda@gmail.com, lichong659@gmail.com,
	dgolomb@seas.upenn.edu
Subject: Re: [PATCH RFC v1 4/4] libxc for rt scheduler
Date: Fri, 11 Jul 2014 16:49:36 +0200	[thread overview]
Message-ID: <1405090176.29306.451.camel@Solace> (raw)
In-Reply-To: <1405054198-29106-5-git-send-email-mengxu@cis.upenn.edu>


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

On ven, 2014-07-11 at 00:49 -0400, Meng Xu wrote:
> Add xc_sched_rt_* functions to interact with Xen to set/get domain's

> --- /dev/null
> +++ b/tools/libxc/xc_rt.c

> +#include "xc_private.h"
> +
> +int
> +xc_sched_rt_domain_set(
> +    xc_interface *xch,
> +    uint32_t domid,
> +    struct xen_domctl_sched_rt_params *sdom)
>
So, both here...

> +{
> +    int rc;
> +    DECLARE_DOMCTL;
> +    DECLARE_HYPERCALL_BOUNCE(sdom, 
> +        sizeof(*sdom), 
> +        XC_HYPERCALL_BUFFER_BOUNCE_IN);
> +
... and here... I know libxc is not terribly consistent when it comes to
coding style. Still, I like stuff to be aligned to the opening brace of
the function/macro.

Have a look at xc_domain.c, e.g., 

...
int xc_vcpu_setaffinity(xc_interface *xch,
                        uint32_t domid,
                        int vcpu,
                        xc_cpumap_t cpumap_hard_inout,
                        xc_cpumap_t cpumap_soft_inout,
                        uint32_t flags)
{
    DECLARE_DOMCTL;
    DECLARE_HYPERCALL_BOUNCE(cpumap_hard_inout, 0,
                             XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
    DECLARE_HYPERCALL_BOUNCE(cpumap_soft_inout, 0,
                             XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
...

> +    if ( xc_hypercall_bounce_pre(xch, sdom) )
> +        return -1;
> +
> +    domctl.cmd = XEN_DOMCTL_scheduler_op;
> +    domctl.domain = (domid_t) domid;
> +    domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_RT;
> +    domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
> +    set_xen_guest_handle(domctl.u.scheduler_op.u.rt.schedule, sdom);
> +
> +    rc = do_domctl(xch, &domctl);
> +
> +    xc_hypercall_bounce_post(xch, sdom);
> +
So, the bouncing logic seems fine. Looking at what other schedulers do,
there should be no particular need for bouncing anything.

xen/include/public/domctl.h:

struct xen_domctl_scheduler_op {
    uint32_t sched_id;  /* XEN_SCHEDULER_* */
    uint32_t cmd;       /* XEN_DOMCTL_SCHEDOP_* */
    union {
        struct xen_domctl_sched_sedf {
            uint64_aligned_t period;
            uint64_aligned_t slice;
            uint64_aligned_t latency;
            uint32_t extratime;
            uint32_t weight;
        } sedf;
        struct xen_domctl_sched_credit {
            uint16_t weight;
            uint16_t cap;
        } credit;
        struct xen_domctl_sched_credit2 {
            uint16_t weight;
        } credit2;
    } u;
};

I see you have a TODO item relate to this interface, so I guess I'm
leaving this alone.

My view here is, since per-VCPU scheduling parameters are important for
this scheduler, you either:
 - provide an interface for getting and setting the parameters of _one_
   _VCPU_, and the call them repeatedly, if for instance you need to act
   on a domain. In this case, no array and no bouncing should be
   necessary.
 - provide both the above, and another interface, that one with an array
   as big as the number of VCPUs of the domain, and use it to provide 
   the hypervisor with the parameters of all the VCPUs, and act 
   appropriately inside Xen.

Personally, I'd start with the former, and add the latter later, if we
deem it necessary.

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 14:49 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11  4:49 Introduce rt real-time scheduler for Xen Meng Xu
2014-07-11  4:49 ` [PATCH RFC v1 1/4] rt: Add rt scheduler to hypervisor Meng Xu
2014-07-11 14:27   ` Dario Faggioli
2014-07-11 14:37   ` Andrew Cooper
2014-07-11 15:21     ` Dario Faggioli
2014-07-11 15:40       ` Andrew Cooper
2014-07-11 15:48         ` Dario Faggioli
2014-07-16 17:05           ` Konrad Rzeszutek Wilk
2014-07-17 10:12             ` Meng Xu
2014-07-17 15:12               ` Dario Faggioli
2014-07-18  5:46                 ` Meng Xu
2014-07-18 18:40               ` Konrad Rzeszutek Wilk
2014-07-11  4:49 ` [PATCH RFC v1 2/4] xl for rt scheduler Meng Xu
2014-07-11 11:02   ` Wei Liu
2014-07-11 14:59     ` Meng Xu
2014-07-11 15:07       ` Dario Faggioli
2014-07-11 16:25         ` Meng Xu
2014-07-13 12:58         ` Meng Xu
2014-07-14  7:40           ` Dario Faggioli
2014-07-14  9:31           ` Wei Liu
2014-07-17 15:39           ` Ian Campbell
2014-07-11  4:49 ` [PATCH RFC v1 3/4] libxl " Meng Xu
2014-07-11 11:05   ` Wei Liu
2014-07-11 15:08   ` Dario Faggioli
2014-07-12 18:16     ` Meng Xu
2014-07-14 10:38       ` Dario Faggioli
2014-07-17 15:34     ` Ian Campbell
2014-07-17 15:36   ` Ian Campbell
2014-07-18 11:05     ` Meng Xu
2014-07-11  4:49 ` [PATCH RFC v1 4/4] libxc " Meng Xu
2014-07-11 14:49   ` Dario Faggioli [this message]
2014-07-11 16:23     ` Meng Xu
2014-07-11 16:35       ` Dario Faggioli
2014-07-11 16:49         ` Andrew Cooper
2014-07-12 19:46         ` Meng Xu
2014-07-17 15:29     ` Ian Campbell
2014-07-17 15:34       ` George Dunlap
2014-07-17 22:16         ` Meng Xu
2014-07-18  9:49           ` Dario Faggioli
2014-07-18  9:51           ` Ian Campbell
2014-07-18 12:11             ` Meng Xu
2014-07-18  9:47         ` Ian Campbell
2014-07-18 10:00           ` Dario Faggioli
2014-07-11 10:50 ` Introduce rt real-time scheduler for Xen Wei Liu
2014-07-11 11:06   ` Dario Faggioli
2014-07-11 16:14     ` Meng Xu
2014-07-11 16:19 ` Dario Faggioli

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=1405090176.29306.451.camel@Solace \
    --to=dario.faggioli@citrix.com \
    --cc=dgolomb@seas.upenn.edu \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=lichong659@gmail.com \
    --cc=mengxu@cis.upenn.edu \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xisisu@gmail.com \
    --cc=xumengpanda@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).