From: Dario Faggioli <dario.faggioli@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Chong Li <chong.li@wustl.edu>, Sisu Xi <xisisu@gmail.com>,
george.dunlap@eu.citrix.com, xen-devel@lists.xen.org,
Meng Xu <mengxu@cis.upenn.edu>, Chong Li <lichong659@gmail.com>,
dgolomb@seas.upenn.edu
Subject: Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
Date: Tue, 7 Jul 2015 16:55:53 +0200 [thread overview]
Message-ID: <1436280953.22672.119.camel@citrix.com> (raw)
In-Reply-To: <559BB101020000780008D371@mail.emea.novell.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 9958 bytes --]
On Tue, 2015-07-07 at 09:59 +0100, Jan Beulich wrote:
> >>> On 29.06.15 at 04:44, <lichong659@gmail.com> wrote:
> > --- a/xen/common/Makefile
> > +++ b/xen/common/Makefile
> > @@ -31,7 +31,6 @@ obj-y += rbtree.o
> > obj-y += rcupdate.o
> > obj-y += sched_credit.o
> > obj-y += sched_credit2.o
> > -obj-y += sched_sedf.o
> > obj-y += sched_arinc653.o
> > obj-y += sched_rt.o
> > obj-y += schedule.o
>
> Stray change. Or perhaps the file doesn't build anymore, in which case
> you should instead have stated that the patch is dependent upon the
> series removing SEDF.
>
> > @@ -1157,8 +1158,75 @@ rt_dom_cntl(
> > list_for_each( iter, &sdom->vcpu )
> > {
> > struct rt_vcpu * svc = list_entry(iter, struct rt_vcpu, sdom_elem);
> > - svc->period = MICROSECS(op->u.rtds.period); /* transfer to nanosec */
> > - svc->budget = MICROSECS(op->u.rtds.budget);
> > + svc->period = MICROSECS(op->u.d.rtds.period); /* transfer to nanosec */
> > + svc->budget = MICROSECS(op->u.d.rtds.budget);
> > + }
> > + spin_unlock_irqrestore(&prv->lock, flags);
> > + break;
> > + case XEN_DOMCTL_SCHEDOP_getvcpuinfo:
> > + spin_lock_irqsave(&prv->lock, flags);
> > + for( index = 0; index < op->u.v.nr_vcpus; index++ )
>
> Coding style (more further down).
>
> > + {
> > + if ( copy_from_guest_offset(&local_sched,
> > + op->u.v.vcpus, index, 1) )
>
> Indentation.
>
> > + {
> > + rc = -EFAULT;
> > + break;
> > + }
> > + if ( local_sched.vcpuid >= d->max_vcpus
> > + || d->vcpu[local_sched.vcpuid] == NULL )
>
> || belongs at the end of the first line. Indentation.
>
> > + {
> > + rc = -EINVAL;
> > + break;
> > + }
> > + svc = rt_vcpu(d->vcpu[local_sched.vcpuid]);
> > +
> > + local_sched.vcpuid = svc->vcpu->vcpu_id;
>
> Why? If at all, this should be an ASSERT().
>
> > + local_sched.s.rtds.budget = svc->budget / MICROSECS(1);
> > + local_sched.s.rtds.period = svc->period / MICROSECS(1);
> > + if( index >= op->u.v.nr_vcpus ) /* not enough guest buffer*/
>
> Impossible due to the containing loop's condition.
>
> > + {
> > + rc = -ENOBUFS;
> > + break;
> > + }
> > + if ( copy_to_guest_offset(op->u.v.vcpus, index,
>
> __copy_to_guest_offset()
>
> > + case XEN_DOMCTL_SCHEDOP_putvcpuinfo:
> > + spin_lock_irqsave(&prv->lock, flags);
> > + for( index = 0; index < op->u.v.nr_vcpus; index++ )
> > + {
> > + if ( copy_from_guest_offset(&local_sched,
> > + op->u.v.vcpus, index, 1) )
> > + {
> > + rc = -EFAULT;
> > + break;
> > + }
> > + if ( local_sched.vcpuid >= d->max_vcpus
> > + || d->vcpu[local_sched.vcpuid] == NULL )
> > + {
> > + rc = -EINVAL;
> > + break;
> > + }
> > + svc = rt_vcpu(d->vcpu[local_sched.vcpuid]);
> > + svc->period = MICROSECS(local_sched.s.rtds.period);
> > + svc->budget = MICROSECS(local_sched.s.rtds.budget);
>
> Are all input values valid here?
>
> > --- a/xen/common/schedule.c
> > +++ b/xen/common/schedule.c
> > @@ -65,7 +65,6 @@ DEFINE_PER_CPU(struct schedule_data, schedule_data);
> > DEFINE_PER_CPU(struct scheduler *, scheduler);
> >
> > static const struct scheduler *schedulers[] = {
> > - &sched_sedf_def,
> > &sched_credit_def,
> > &sched_credit2_def,
> > &sched_arinc653_def,
>
> See above.
>
> > @@ -1054,7 +1053,9 @@ long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op)
> >
> > if ( (op->sched_id != DOM2OP(d)->sched_id) ||
> > ((op->cmd != XEN_DOMCTL_SCHEDOP_putinfo) &&
> > - (op->cmd != XEN_DOMCTL_SCHEDOP_getinfo)) )
> > + (op->cmd != XEN_DOMCTL_SCHEDOP_getinfo) &&
> > + (op->cmd != XEN_DOMCTL_SCHEDOP_putvcpuinfo) &&
> > + (op->cmd != XEN_DOMCTL_SCHEDOP_getvcpuinfo)) )
> > return -EINVAL;
>
> Convert to switch() please.
>
> > --- a/xen/include/public/domctl.h
> > +++ b/xen/include/public/domctl.h
> > @@ -330,31 +330,59 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
> > #define XEN_SCHEDULER_ARINC653 7
> > #define XEN_SCHEDULER_RTDS 8
> >
> > +typedef struct xen_domctl_sched_sedf {
> > + uint64_aligned_t period;
> > + uint64_aligned_t slice;
> > + uint64_aligned_t latency;
> > + uint32_t extratime;
> > + uint32_t weight;
> > +} xen_domctl_sched_sedf_t;
>
> Indentation.
>
> > +typedef union xen_domctl_schedparam {
> > + xen_domctl_sched_sedf_t sedf;
> > + xen_domctl_sched_credit_t credit;
> > + xen_domctl_sched_credit2_t credit2;
> > + xen_domctl_sched_rtds_t rtds;
> > +} xen_domctl_schedparam_t;
>
> I don't see the need for this extra wrapper type. Nor do I see the
> need for the typedef here and above - they're generally only
> created if you want to also define a matching guest handle type.
>
> > +typedef struct xen_domctl_schedparam_vcpu {
> > + union {
> > + xen_domctl_sched_credit_t credit;
> > + xen_domctl_sched_credit2_t credit2;
> > + xen_domctl_sched_rtds_t rtds;
> > + } s;
> > + uint16_t vcpuid;
>
> Explicit padding please.
>
> > +} xen_domctl_schedparam_vcpu_t;
> > +DEFINE_XEN_GUEST_HANDLE(xen_domctl_schedparam_vcpu_t);
> > +
> > /* Set or get info? */
> > #define XEN_DOMCTL_SCHEDOP_putinfo 0
> > #define XEN_DOMCTL_SCHEDOP_getinfo 1
> > +#define XEN_DOMCTL_SCHEDOP_putvcpuinfo 2
> > +#define XEN_DOMCTL_SCHEDOP_getvcpuinfo 3
> > 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;
> > - struct xen_domctl_sched_rtds {
> > - uint32_t period;
> > - uint32_t budget;
> > - } rtds;
> > + xen_domctl_schedparam_t d;
>
> With this type gone I'm not even sure we need to wrap this in
> another union; not doing so would eliminate some of the other
> changes in this patch.
>
So, Jan, just to be sure, do you mean (apart from the explicit padding)
something like this (attached, also)?
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index bc45ea5..8210ecb 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -330,31 +330,56 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
#define XEN_SCHEDULER_ARINC653 7
#define XEN_SCHEDULER_RTDS 8
+struct xen_domctl_sched_sedf {
+ uint64_aligned_t period;
+ uint64_aligned_t slice;
+ uint64_aligned_t latency;
+ uint32_t extratime;
+ uint32_t weight;
+};
+
+struct xen_domctl_sched_credit {
+ uint16_t weight;
+ uint16_t cap;
+};
+
+struct xen_domctl_sched_credit2 {
+ uint16_t weight;
+};
+
+struct xen_domctl_sched_rtds {
+ uint32_t period;
+ uint32_t budget;
+};
+
+typedef struct xen_domctl_schedparam_vcpu {
+ union {
+ struct xen_domctl_sched_sedf sedf;
+ struct xen_domctl_sched_credit credit;
+ struct xen_domctl_sched_credit2 credit2;
+ struct xen_domctl_sched_rtds rtds;
+ } s;
+ uint16_t vcpuid;
+} xen_domctl_schedparam_vcpu_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_schedparam_vcpu_t);
+
/* Set or get info? */
#define XEN_DOMCTL_SCHEDOP_putinfo 0
#define XEN_DOMCTL_SCHEDOP_getinfo 1
+#define XEN_DOMCTL_SCHEDOP_putvcpuinfo 2
+#define XEN_DOMCTL_SCHEDOP_getvcpuinfo 3
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;
- struct xen_domctl_sched_rtds {
- uint32_t period;
- uint32_t budget;
- } rtds;
+ struct xen_domctl_sched_sedf sedf;
+ struct xen_domctl_sched_credit credit;
+ struct xen_domctl_sched_credit2 credit2;
+ struct xen_domctl_sched_rtds rtds;
+ struct {
+ XEN_GUEST_HANDLE_64(xen_domctl_schedparam_vcpu_t) vcpus;
+ uint16_t nr_vcpus;
+ } v;
} u;
};
typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
If yes, I'd be fine with it too (George?)
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.1.2: rtds-domctl.patch --]
[-- Type: text/x-patch, Size: 2371 bytes --]
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index bc45ea5..8210ecb 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -330,31 +330,56 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
#define XEN_SCHEDULER_ARINC653 7
#define XEN_SCHEDULER_RTDS 8
+struct xen_domctl_sched_sedf {
+ uint64_aligned_t period;
+ uint64_aligned_t slice;
+ uint64_aligned_t latency;
+ uint32_t extratime;
+ uint32_t weight;
+};
+
+struct xen_domctl_sched_credit {
+ uint16_t weight;
+ uint16_t cap;
+};
+
+struct xen_domctl_sched_credit2 {
+ uint16_t weight;
+};
+
+struct xen_domctl_sched_rtds {
+ uint32_t period;
+ uint32_t budget;
+};
+
+typedef struct xen_domctl_schedparam_vcpu {
+ union {
+ struct xen_domctl_sched_sedf sedf;
+ struct xen_domctl_sched_credit credit;
+ struct xen_domctl_sched_credit2 credit2;
+ struct xen_domctl_sched_rtds rtds;
+ } s;
+ uint16_t vcpuid;
+} xen_domctl_schedparam_vcpu_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_schedparam_vcpu_t);
+
/* Set or get info? */
#define XEN_DOMCTL_SCHEDOP_putinfo 0
#define XEN_DOMCTL_SCHEDOP_getinfo 1
+#define XEN_DOMCTL_SCHEDOP_putvcpuinfo 2
+#define XEN_DOMCTL_SCHEDOP_getvcpuinfo 3
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;
- struct xen_domctl_sched_rtds {
- uint32_t period;
- uint32_t budget;
- } rtds;
+ struct xen_domctl_sched_sedf sedf;
+ struct xen_domctl_sched_credit credit;
+ struct xen_domctl_sched_credit2 credit2;
+ struct xen_domctl_sched_rtds rtds;
+ struct {
+ XEN_GUEST_HANDLE_64(xen_domctl_schedparam_vcpu_t) vcpus;
+ uint16_t nr_vcpus;
+ } v;
} u;
};
typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
[-- 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-07 14:55 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-29 2:44 [PATCH v3 for Xen 4.6 0/4] Enable per-VCPU parameter settings for RTDS scheduler Chong Li
2015-06-29 2:44 ` [PATCH v3 for Xen 4.6 1/4] xen: enable " Chong Li
2015-07-07 8:59 ` Jan Beulich
2015-07-07 14:39 ` Dario Faggioli
2015-07-08 6:06 ` Meng Xu
2015-07-08 8:33 ` Dario Faggioli
2015-07-09 1:16 ` Meng Xu
2015-07-10 9:51 ` Dario Faggioli
2015-07-07 14:55 ` Dario Faggioli [this message]
2015-07-07 16:09 ` Jan Beulich
2015-07-07 15:33 ` Chong Li
2015-07-07 15:41 ` Jan Beulich
2015-07-07 15:46 ` Dario Faggioli
2015-07-07 14:51 ` Dario Faggioli
2015-06-29 2:44 ` [PATCH v3 for Xen 4.6 2/4] libxc: " Chong Li
2015-06-30 12:22 ` Ian Campbell
2015-06-30 15:18 ` Chong Li
2015-06-30 15:32 ` Ian Campbell
2015-06-30 15:57 ` Chong Li
2015-06-30 16:04 ` Ian Campbell
2015-06-29 2:44 ` [PATCH v3 for Xen 4.6 3/4] libxl: " Chong Li
2015-06-30 12:26 ` Ian Campbell
2015-06-30 15:42 ` Chong Li
2015-06-30 15:57 ` Ian Campbell
2015-06-30 16:10 ` Chong Li
2015-06-30 16:19 ` Ian Campbell
2015-06-30 16:53 ` Chong Li
2015-07-01 0:54 ` Meng Xu
2015-07-01 8:48 ` Ian Campbell
2015-07-01 12:50 ` Dario Faggioli
2015-07-01 16:59 ` Chong Li
2015-07-07 16:23 ` Dario Faggioli
2015-07-08 14:35 ` Chong Li
2015-07-08 14:45 ` Dario Faggioli
2015-06-29 2:44 ` [PATCH v3 for Xen 4.6 4/4] xl: " Chong Li
2015-07-07 15:34 ` Dario Faggioli
2015-07-07 16:01 ` Chong Li
2015-07-07 15:16 ` [PATCH v3 for Xen 4.6 0/4] Enable " Dario Faggioli
2015-07-07 16:11 ` 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=1436280953.22672.119.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=JBeulich@suse.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=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).