Enable per-VCPU parameter settings for RTDS scheduler
v3 cover Enable per-VCPU parameter settings for RTDS scheduler
[Goal]
The current xl sched-rtds tool can only set the VCPUs of a domain to the same parameter although the scheduler supports VCPUs with different parameters. This patchset is to enable xl sched-rtds tool to configure the VCPUs of a domain with different parameters.
This per-VCPU settings can be used in many scenarios. For example, based on Dario's statement in our pervious discussion(http://lists.xen.org/archives/html/xen-devel/2014-09/msg00423.html), if there are two real-time applications, which have different timing requirements, running in a multi-VCPU guest domain, it is beneficial to pin these two applications to two seperate VCPUs with different scheduling parameters.
What this patchset includes is a wanted and planned feature for RTDS scheudler(http://wiki.xenproject.org/wiki/RTDS-Based-Scheduler) in Xen 4.6. The interface design of the xl sched-rtds tool is based on Meng's previous discussion with Dario, George and Wei(http://lists.xen.org/archives/html/xen-devel/2015-02/msg02606.html). Basically, there are two main changes:
1) in xl, we create an array that records all VCPUs whose parameters are about to modify or output.
2) in libxl, we receive the array and call different xc functions to handle it.
3) in xen and libxc, we use XEN_DOMCTL_SCHEDOP_getvcpuinfo/putvcpuinfo(introduced by this patchset) as the hypercall for per-VCPU operations(get/set method).
[Usage]
With this patchset in use, xl sched-rtds tool can:
1) show the budget and period of each VCPU of each domain, by using "xl sched-rtds -v all" command. An example would be like:
# xl sched-rtds -v all Cpupool Pool-0: sched=RTDS Name ID VCPU Period Budget Domain-0 0 0 10000 4000 vm1 1 0 300 150 vm1 1 1 400 200 vm1 1 2 10000 4000 vm1 1 3 1000 500 vm2 2 0 10000 4000 vm2 2 1 10000 4000
2) show the budget and period of each VCPU of a specific domain, by using, e.g., "xl sched-rtds -d vm1 -v all" command. The output would be like:
# xl sched-rtds -d vm1 -v all Name ID VCPU Period Budget vm1 1 0 300 150 vm1 1 1 400 200 vm1 1 2 10000 4000 vm1 1 3 1000 500
To show a subset of the parameters of the VCPUs of a specific domain, please use, e.g.,"xl sched-rtds -d vm1 -v 0 -v 3" command. The output would be:
# xl sched-rtds -d vm1 -v 0 -v 3 Name ID VCPU Period Budget vm1 1 0 300 150 vm1 1 3 1000 500
3) Users can set the budget and period of multiple VCPUs of a specific domain with only one command, e.g., "xl sched-rtds -d vm1 -v 0 -p 100 -b 50 -v 3 -p 300 -b 150".
Users can set all VCPUs with the same parameters, by one command. e.g., "xl sched-rtds -d vm1 -v all -p 500 -b 250".
---
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
Chong Li (4):
xen: enable per-VCPU parameter settings for RTDS scheduler
libxc: enable per-VCPU parameter settings for RTDS scheduler
libxl: enable per-VCPU parameter settings for RTDS scheduler
xl: enable per-VCPU parameter settings for RTDS scheduler
docs/man/xl.pod.1 | 4 + tools/libxc/include/xenctrl.h | 9 ++ tools/libxc/xc_csched.c | 4 +- tools/libxc/xc_csched2.c | 4 +- tools/libxc/xc_rt.c | 64 +++++++++- tools/libxc/xc_sedf.c | 4 +- tools/libxl/libxl.c | 209 +++++++++++++++++++++++++++---- tools/libxl/libxl.h | 17 +++ tools/libxl/libxl_types.idl | 16 +++ tools/libxl/xl_cmdimpl.c | 284 +++++++++++++++++++++++++++++++++++------- tools/libxl/xl_cmdtable.c | 10 +- xen/common/Makefile | 1 - xen/common/domctl.c | 3 + xen/common/sched_credit.c | 14 +-- xen/common/sched_credit2.c | 6 +- xen/common/sched_rt.c | 80 +++++++++++- xen/common/schedule.c | 5 +- xen/include/public/domctl.h | 64 +++++++--- 18 files changed, 680 insertions(+), 118 deletions(-)
Signature · 1 line
1.9.1
PATCH v3 1/4 xen: enable per-VCPU parameter settings for RTDS scheduler
Add two hypercalls(XEN_DOMCTL_SCHEDOP_getvcpuinfo/putvcpuinfo) to get/set a domain's per-VCPU parameters.
Changes on PATCH v2:
1) Change struct xen_domctl_scheduler_op, for transferring per-vcpu parameters between libxc and hypervisor.
2) Handler of XEN_DOMCTL_SCHEDOP_getinfo now just returns the default budget and period values of RTDS scheduler.
3) Handler of XEN_DOMCTL_SCHEDOP_getvcpuinfo now can return a random subset of the parameters of the VCPUs of a specific domain
---
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
--- xen/common/Makefile | 1 - xen/common/domctl.c | 3 ++ xen/common/sched_credit.c | 14 ++++---- xen/common/sched_credit2.c | 6 ++-- xen/common/sched_rt.c | 80 +++++++++++++++++++++++++++++++++++++++++---- xen/common/schedule.c | 5 +-- xen/include/public/domctl.h | 64 ++++++++++++++++++++++++++---------- 7 files changed, 136 insertions(+), 37 deletions(-)
xen/common/Makefile +0 -1
@@ -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
xen/common/domctl.c +3 -0
@@ -839,6 +839,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)case XEN_DOMCTL_scheduler_op: ret =sched_adjust (d, &op->u.scheduler_op); +if ( ret == -ERESTART ) + ret =hypercall_create_continuation ( + __HYPERVISOR_domctl,"h" , u_domctl); copyback =1 ;break ;
xen/common/sched_credit.c +7 -7
@@ -1039,25 +1039,25 @@ csched_dom_cntl(if ( op->cmd == XEN_DOMCTL_SCHEDOP_getinfo ) { - op->u.credit.weight = sdom->weight; - op->u.credit.cap = sdom->cap; + op->u.d.credit.weight = sdom->weight; + op->u.d.credit.cap = sdom->cap; }else {ASSERT (op->cmd == XEN_DOMCTL_SCHEDOP_putinfo); -if ( op->u.credit.weight !=0 ) +if ( op->u.d.credit.weight !=0 ) {if ( !list_empty (&sdom->active_sdom_elem) ) { prv->weight -= sdom->weight * sdom->active_vcpu_count; - prv->weight += op->u.credit.weight * sdom->active_vcpu_count; + prv->weight += op->u.d.credit.weight * sdom->active_vcpu_count; } - sdom->weight = op->u.credit.weight; + sdom->weight = op->u.d.credit.weight; } -if ( op->u.credit.cap != (uint16_t )~0U ) - sdom->cap = op->u.credit.cap; +if ( op->u.d.credit.cap != (uint16_t )~0U ) + sdom->cap = op->u.d.credit.cap; }
xen/common/sched_credit2.c +3 -3
@@ -1438,20 +1438,20 @@ csched2_dom_cntl(if ( op->cmd == XEN_DOMCTL_SCHEDOP_getinfo ) { - op->u.credit2.weight = sdom->weight; + op->u.d.credit2.weight = sdom->weight; }else {ASSERT (op->cmd == XEN_DOMCTL_SCHEDOP_putinfo); -if ( op->u.credit2.weight !=0 ) +if ( op->u.d.credit2.weight !=0 ) {struct list_head *iter;int old_weight; old_weight = sdom->weight; - sdom->weight = op->u.credit2.weight; + sdom->weight = op->u.d.credit2.weight;/* Update weights for vcpus, and max_weight for runqueues on which they reside */ list_for_each ( iter, &sdom->vcpu )
xen/common/sched_rt.c +74 -6
100 lines not on this page · raw message
xen/common/schedule.c +3 -2
@@ -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,
@@ -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 ;/* NB: the pluggable scheduler code needs to take care
xen/include/public/domctl.h +46 -18
77 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
xen/common/Makefile obj-y += rbtree.o · line 36
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 29.06.15 at 04:44, <[email protected]> wrote:
xen/common/Makefile +0
-1@@ -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.
Quoted 4 lines
xen/common/Makefile +0
-0@@ -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);
xen/common/Makefile rt_dom_cntl( · line 1168
Quoted 10 lines
xen/common/Makefile +8
-2- 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).
xen/common/Makefile rt_dom_cntl( · line 1171
Quoted 3 lines
xen/common/Makefile +3
-0+ { + if ( copy_from_guest_offset(&local_sched, + op->u.v.vcpus, index, 1) )
Indentation.
xen/common/Makefile rt_dom_cntl( · line 1177
Quoted 6 lines
xen/common/Makefile +6
-0+ { + 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.
xen/common/Makefile rt_dom_cntl( · line 1184
Quoted 7 lines
xen/common/Makefile +7
-0+ { + 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().
xen/common/Makefile rt_dom_cntl( · line 1187
Quoted 3 lines
xen/common/Makefile +3
-0+ 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.
xen/common/Makefile rt_dom_cntl( · line 1192
Quoted 5 lines
xen/common/Makefile +5
-0+ { + rc = -ENOBUFS; + break; + } + if ( copy_to_guest_offset(op->u.v.vcpus, index,
__copy_to_guest_offset()
Quoted 9 lines
xen/common/Makefile +9
-0+ 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;
xen/common/Makefile rt_dom_cntl( · line 1211
Quoted 10 lines
xen/common/Makefile +10
-0+ } + 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?
xen/common/schedule.c DEFINE_PER_CPU(struct schedule_data, schedule_data); · line 70
Quoted 10 lines
xen/common/schedule.c +0
-1@@ -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.
xen/common/schedule.c long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op) · line 1059
Quoted 9 lines
xen/common/schedule.c +3
-1@@ -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.
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 339
Quoted 13 lines
xen/include/public/domctl.h +7
-0@@ -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.
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 360
Quoted 6 lines
xen/include/public/domctl.h +6
-0+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.
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 368
Quoted 7 lines
xen/include/public/domctl.h +7
-0+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.
Quoted 21 lines
xen/include/public/domctl.h +5
-9+} 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 3struct 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;
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 381
Quoted 10 lines
xen/include/public/domctl.h +1
-9-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.
Jan
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
Quoted 16 lines · Jan Beulich
xen/common/Makefile obj-y += rbtree.o · line 36
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 29.06.15 at 04:44, <[email protected]> wrote:
xen/common/Makefile +0
-1@@ -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.oStray 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.
This indeed does not belong in here. And of course, things should build... So, Chong, either deal with SEDF as well, if basing your patches on a tree where it is still there, or base on top of my patches, ignore it, but state the dependency, as Jan is asking.
Quoted 22 lines
Quoted 11 lines
xen/common/Makefile +9
-0@@ -1157,8 +1158,75 @@ rt_dom_cntl( + 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;xen/common/Makefile rt_dom_cntl( · line 1177
Quoted 10 lines
xen/common/Makefile +10
-0+ } + 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);
Quoted 2 lines
Are all input values valid here?
That's a good point, actually. Right now, SEDF does some range enforcement, by means of these values:
#define PERIOD_MAX MILLISECS(10000) /* 10s */
#define PERIOD_MIN (MICROSECS(10)) /* 10us */
#define SLICE_MIN (MICROSECS(5)) /* 5us */
Chong, it probably makes sense to (in a separate patch), introduce something like this in RTDS too (with SLICE_MIN-->BUDGET_MIN), and then use them, in this patch, for sanity checking the input.
It also makes sense to check and enforce budget<=period, IMO.
About the specific values, I'm open to proposals. I think something like the SEDF's one is fine. Meng?
Thanks and Regards,
Dario
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
2015-07-07 7:39 GMT-07:00 Dario Faggioli <[email protected]>:
Quoted 53 lines · Jan Beulich
Quoted 16 lines
xen/common/Makefile obj-y += rbtree.o · line 36
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 29.06.15 at 04:44, <[email protected]> wrote:
xen/common/Makefile +0
-1@@ -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.oStray 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.
This indeed does not belong in here. And of course, things should build... So, Chong, either deal with SEDF as well, if basing your patches on a tree where it is still there, or base on top of my patches, ignore it, but state the dependency, as Jan is asking.
Quoted 22 lines
Quoted 11 lines
xen/common/Makefile +9
-0@@ -1157,8 +1158,75 @@ rt_dom_cntl( + 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;xen/common/Makefile rt_dom_cntl( · line 1177
Quoted 10 lines
xen/common/Makefile +10
-0+ } + 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);Quoted 2 lines
Are all input values valid here?
That's a good point, actually. Right now, SEDF does some range enforcement, by means of these values:
#define
PERIOD_MAXMILLISECS(10000) /* 10s */
#definePERIOD_MIN(MICROSECS(10)) /* 10us */
#defineSLICE_MIN(MICROSECS(5)) /* 5us */
Quoted 8 lines
Chong, it probably makes sense to (in a separate patch), introduce something like this in RTDS too (with SLICE_MIN-->BUDGET_MIN), and then use them, in this patch, for sanity checking the input.
It also makes sense to check and enforce budget<=period, IMO.
About the specific values, I'm open to proposals. I think something like the SEDF's one is fine. Meng?
We are trying to make some range enforcement for RTDS scheduler. Is my understanding correct? (It should be, but just in case. :-) )
As to the range of period, I think the max value can be as large as the type of period (ie. s_time_t) can represent. When we want a dedicated CPU for a guest, we will set budget=period and can set the period to a very very large value to avoid the unnecessarily invocation of the scheduler.
As to the min value of period, I think it should be >=100us. The scheduler overhead of running a large box could be 1us if the runq is long and competetion of the runq lock is heavy. If the scheduler is potentially invoked every 10us, the scheduler overhead will be 10% of total computation time, which seems a lot to me.
As to the range of budget, the min value can be 5us, the same with SEDF; the max value is the value of period of the same VCPU.
What do you think?
Thanks and best regards,
Meng
-----------
Meng Xu
PhD Student in Computer and Information Science
University of Pennsylvania
http://www.cis.upenn.edu/~mengxu/
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
Quoted 58 lines · Meng Xu
2015-07-07 7:39 GMT-07:00 Dario Faggioli <[email protected]>:
Quoted 57 lines · Jan Beulich
Quoted 16 lines
xen/common/Makefile obj-y += rbtree.o · line 36
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 29.06.15 at 04:44, <[email protected]> wrote:
xen/common/Makefile +0
-1@@ -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.oStray 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.
This indeed does not belong in here. And of course, things should build... So, Chong, either deal with SEDF as well, if basing your patches on a tree where it is still there, or base on top of my patches, ignore it, but state the dependency, as Jan is asking.
Quoted 22 lines
Quoted 11 lines
xen/common/Makefile +9
-0@@ -1157,8 +1158,75 @@ rt_dom_cntl( + 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;xen/common/Makefile rt_dom_cntl( · line 1177
Quoted 10 lines
xen/common/Makefile +10
-0+ } + 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);Quoted 2 lines
Are all input values valid here?
That's a good point, actually. Right now, SEDF does some range enforcement, by means of these values:
#define
PERIOD_MAXMILLISECS(10000) /* 10s */
#definePERIOD_MIN(MICROSECS(10)) /* 10us */
#defineSLICE_MIN(MICROSECS(5)) /* 5us */Chong, it probably makes sense to (in a separate patch), introduce something like this in RTDS too (with SLICE_MIN-->BUDGET_MIN), and then use them, in this patch, for sanity checking the input.
Quoted 8 lines
Quoted 4 lines
It also makes sense to check and enforce budget<=period, IMO.
About the specific values, I'm open to proposals. I think something like the SEDF's one is fine. Meng?
We are trying to make some range enforcement for RTDS scheduler. Is my understanding correct? (It should be, but just in case. :-) )
We are wondering whether that could be necessary/useful, and IMO, it would.
Quoted 6 lines
As to the range of period, I think the max value can be as large as the type of period (ie.
s_time_t) can represent. When we want a dedicated CPU for a guest, we will set budget=period and can set the period to a very very large value to avoid the unnecessarily invocation of the scheduler.
Makes sense. We do have STIME_MAX and, given that period is something that is added to current time during scheduling, STIME_DELTA_MAX.
Maybe, put something together basing on those?
Quoted 6 lines
As to the min value of period, I think it should be >=100us. The scheduler overhead of running a large box could be 1us if the runq is long and competetion of the runq lock is heavy. If the scheduler is potentially invoked every 10us, the scheduler overhead will be 10% of total computation time, which seems a lot to me.
Ok.
Quoted 3 lines
As to the range of budget, the min value can be 5us, the same with SEDF;
Well, wouldn't the above reasoning about overhead apply here too? Budgets of 5us mean the scheduler can be invoked every 5us for budget enforcement. If 10us was unreasonable, 5 is even more so.
Therefore, 100us here too? Or maybe let's allow for lower values (like 50us or 10us), but print a warning?
Quoted 2 lines
the max value is the value of period of the same VCPU.
Yep.
And, whatever the values, it would be useful to have comments somewhere (either when the values are defined or enforced), stating what you said above.
Regards,
Dario
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
2015-07-08 1:33 GMT-07:00 Dario Faggioli <[email protected]>:
Quoted 92 lines · Meng Xu
Quoted 58 lines
2015-07-07 7:39 GMT-07:00 Dario Faggioli <[email protected]>:
Quoted 57 lines · Jan Beulich
Quoted 16 lines
xen/common/Makefile obj-y += rbtree.o · line 36
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 29.06.15 at 04:44, <[email protected]> wrote:
xen/common/Makefile +0
-1@@ -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.oStray 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.
This indeed does not belong in here. And of course, things should build... So, Chong, either deal with SEDF as well, if basing your patches on a tree where it is still there, or base on top of my patches, ignore it, but state the dependency, as Jan is asking.
Quoted 22 lines
Quoted 11 lines
xen/common/Makefile +9
-0@@ -1157,8 +1158,75 @@ rt_dom_cntl( + 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;xen/common/Makefile rt_dom_cntl( · line 1177
Quoted 10 lines
xen/common/Makefile +10
-0+ } + 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);Quoted 2 lines
Are all input values valid here?
That's a good point, actually. Right now, SEDF does some range enforcement, by means of these values:
#define
PERIOD_MAXMILLISECS(10000) /* 10s */
#definePERIOD_MIN(MICROSECS(10)) /* 10us */
#defineSLICE_MIN(MICROSECS(5)) /* 5us */Chong, it probably makes sense to (in a separate patch), introduce something like this in RTDS too (with SLICE_MIN-->BUDGET_MIN), and then use them, in this patch, for sanity checking the input.
Quoted 8 lines
Quoted 4 lines
It also makes sense to check and enforce budget<=period, IMO.
About the specific values, I'm open to proposals. I think something like the SEDF's one is fine. Meng?
We are trying to make some range enforcement for RTDS scheduler. Is my understanding correct? (It should be, but just in case. :-) )
We are wondering whether that could be necessary/useful, and IMO, it would.
Quoted 6 lines
As to the range of period, I think the max value can be as large as the type of period (ie.
s_time_t) can represent. When we want a dedicated CPU for a guest, we will set budget=period and can set the period to a very very large value to avoid the unnecessarily invocation of the scheduler.Makes sense. We do have
STIME_MAXand, given that period is something that is added to current time during scheduling,STIME_DELTA_MAX.Maybe, put something together basing on those?
Quoted 6 lines
As to the min value of period, I think it should be >=100us. The scheduler overhead of running a large box could be 1us if the runq is long and competetion of the runq lock is heavy. If the scheduler is potentially invoked every 10us, the scheduler overhead will be 10% of total computation time, which seems a lot to me.
Ok.
Quoted 3 lines
As to the range of budget, the min value can be 5us, the same with SEDF;
Quoted 6 lines
Well, wouldn't the above reasoning about overhead apply here too? Budgets of 5us mean the scheduler can be invoked every 5us for budget enforcement. If 10us was unreasonable, 5 is even more so.
Therefore, 100us here too? Or maybe let's allow for lower values (like 50us or 10us), but print a warning?
Right. we can use 100us as a threadhold for budget too. Maybe printing warning is a better idea?
If users know what they are doing and expecting, it is ok. But too small value (<1us) will potentially cause system freeze.
Quoted 8 lines
Quoted 3 lines
the max value is the value of period of the same VCPU.
Yep.
And, whatever the values, it would be useful to have comments somewhere (either when the values are defined or enforced), stating what you said above.
right.
Thanks,
Meng
Signature · 5 lines
----------- Meng Xu PhD Student in Computer and Information Science University of Pennsylvania http://www.cis.upenn.edu/~mengxu/
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
Quoted 5 lines · Meng Xu
2015-07-08 1:33 GMT-07:00 Dario Faggioli <[email protected]>:
Quoted 4 lines
Well, wouldn't the above reasoning about overhead apply here too? Budgets of 5us mean the scheduler can be invoked every 5us for budget enforcement. If 10us was unreasonable, 5 is even more so.
Quoted 8 lines
Quoted 2 lines
Therefore, 100us here too? Or maybe let's allow for lower values (like 50us or 10us), but print a warning?
Right. we can use 100us as a threadhold for budget too. Maybe printing warning is a better idea?
If users know what they are doing and expecting, it is ok. But too small value (<1us) will potentially cause system freeze.
I'd be ok with printing a warning for vales below 100us, and rejecting values below 1us, or even below 10us (I don't think it would be that practical to go below that anyway).
Regards,
Dario
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
In reply to Jan BeulichQuoted 183 lines · Jan Beulich
xen/common/Makefile obj-y += rbtree.o · line 36
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 29.06.15 at 04:44, <[email protected]> wrote:
xen/common/Makefile +0
-1@@ -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.oStray 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.
Quoted 4 lines
xen/common/Makefile +0
-0@@ -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);xen/common/Makefile rt_dom_cntl( · line 1168
Quoted 10 lines
xen/common/Makefile +8
-2- 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).
xen/common/Makefile rt_dom_cntl( · line 1171
Quoted 3 lines
xen/common/Makefile +3
-0+ { + if ( copy_from_guest_offset(&local_sched, + op->u.v.vcpus, index, 1) )Indentation.
xen/common/Makefile rt_dom_cntl( · line 1177
Quoted 6 lines
xen/common/Makefile +6
-0+ { + 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.
xen/common/Makefile rt_dom_cntl( · line 1184
Quoted 7 lines
xen/common/Makefile +7
-0+ { + 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().xen/common/Makefile rt_dom_cntl( · line 1187
Quoted 3 lines
xen/common/Makefile +3
-0+ 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.
xen/common/Makefile rt_dom_cntl( · line 1192
Quoted 5 lines
xen/common/Makefile +5
-0+ { + rc = -ENOBUFS; + break; + } + if ( copy_to_guest_offset(op->u.v.vcpus, index,
__copy_to_guest_offset()Quoted 9 lines
xen/common/Makefile +9
-0+ 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;xen/common/Makefile rt_dom_cntl( · line 1211
Quoted 10 lines
xen/common/Makefile +10
-0+ } + 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?
xen/common/schedule.c DEFINE_PER_CPU(struct schedule_data, schedule_data); · line 70
Quoted 10 lines
xen/common/schedule.c +0
-1@@ -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.
xen/common/schedule.c long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op) · line 1059
Quoted 9 lines
xen/common/schedule.c +3
-1@@ -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.xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 339
Quoted 13 lines
xen/include/public/domctl.h +7
-0@@ -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.
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 345
Quoted 6 lines
xen/include/public/domctl.h +6
-0+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.
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 352
Quoted 7 lines
xen/include/public/domctl.h +7
-0+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.
Quoted 27 lines
xen/include/public/domctl.h +5
-15+} 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 3struct 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 {
Quoted 9 lines
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 365
Quoted 4 lines
xen/include/public/domctl.h +1
-3-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)?
xen/include/public/domctl.h +43 -18
@@ -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 3struct 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
Signature · 4 lines
<<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)
xen/include/public/domctl.h +43 -18
74 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
Quoted 73 lines
Quoted 1 line
Quoted 1 line · On 07.07.15 at 16:55, <[email protected]> wrote:
So, Jan, just to be sure, do you mean (apart from the explicit padding) something like this (attached, also)?
xen/include/public/domctl.h +36
-18@@ -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 3struct 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;
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 385
Quoted 10 lines
xen/include/public/domctl.h +7
-0+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 ;
Yes.
Jan
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
In reply to Jan BeulichQuoted 26 lines · Jan Beulich
xen/common/Makefile obj-y += rbtree.o · line 36
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 29.06.15 at 04:44, <[email protected]> wrote:
xen/common/Makefile +0
-1@@ -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.oStray 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.
xen/common/Makefile rt_dom_cntl( · line 1165
Quoted 9 lines
xen/common/Makefile +7
-0@@ -1157,8 +1158,75 @@ rt_dom_cntl( + { + rc = -EINVAL; + break; + } + svc = rt_vcpu(d->vcpu[local_sched.vcpuid]); + + local_sched.vcpuid = svc->vcpu->vcpu_id;
Quoted 1 line
Why? If at all, this should be an
ASSERT().
My bad. This should not be there.
Quoted 6 lines
xen/common/Makefile rt_dom_cntl( · line 1168
Quoted 4 lines
xen/common/Makefile +3
-0+ 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.
Yes, you're right.
Quoted 29 lines
xen/common/Makefile rt_dom_cntl( · line 1173
Quoted 6 lines
xen/common/Makefile +5
-0+ { + rc = -ENOBUFS; + break; + } + if ( copy_to_guest_offset(op->u.v.vcpus, index,
__copy_to_guest_offset()Quoted 9 lines
xen/common/Makefile +9
-0+ 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;xen/common/Makefile rt_dom_cntl( · line 1192
Quoted 10 lines
xen/common/Makefile +10
-0+ } + 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);
Quoted 1 line
Are all input values valid here?
Vcpuid, Period and budget have been validated in libxl. But we can still repeat that validation here, if it's needed.
Quoted 65 lines
Quoted 4 lines
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 339
Quoted 10 lines
xen/include/public/domctl.h +7
-0@@ -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.
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 360
Quoted 6 lines
xen/include/public/domctl.h +6
-0+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.
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 368
Quoted 7 lines
xen/include/public/domctl.h +7
-0+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.
Quoted 27 lines
xen/include/public/domctl.h +5
-15+} 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 3struct 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 {
Quoted 8 lines
xen/include/public/domctl.h DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t); · line 381
Quoted 4 lines
xen/include/public/domctl.h +1
-3-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.
I see your point. Because of xen_domctl_schedparam_vcpu_t, we still need to define struct xen_domctl_sched_sedf/credit/credit2/rtds outside of struct xen_domctl_scheduler_op. Then the struct would be like:
struct xen_domctl_scheduler_op {
uint32_t sched_id; /* XEN_SCHEDULER_* */
uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */
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;
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;
This design is good for compatibility. Dario, what do you think?
Chong
Quoted 2 lines
Jan
Signature · 3 lines
Chong Li Department of Computer Science and Engineering Washington University in St.louis
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 07.07.15 at 17:33, <[email protected]> wrote:
Quoted 21 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 29.06.15 at 04:44, <[email protected]> wrote:
xen/common/sched_rt.c +19
-0+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);
Quoted 4 lines
Quoted 1 line
Are all input values valid here?
Vcpuid, Period and budget have been validated in libxl. But we can still repeat that validation here, if it's needed.
Yes, absolutely. Tool stacks may not be fully trusted (namely in disaggregated setups).
Jan
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
In reply to Chong LiQuoted 24 lines · Chong Li
Quoted 4 lines · Jan Beulich
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.
I see your point. Because of
xen_domctl_schedparam_vcpu_t, we still need to define struct xen_domctl_sched_sedf/credit/credit2/rtds outside of structxen_domctl_scheduler_op. Then the struct would be like:struct xen_domctl_scheduler_op { uint32_t sched_id; /* XEN_SCHEDULER_* */ uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */ 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; struct { XEN_GUEST_HANDLE_64(xen_domctl_schedparam_vcpu_t) vcpus; uint16_t nr_vcpus; } v; } u;
Quoted 5 lines
};
typedef structxen_domctl_scheduler_opxen_domctl_scheduler_op_t;This design is good for compatibility. Dario, what do you think?
I understood Jan's suggestion in the same exact way as you, as you can see in my own email, and I like it.
Sorry for being a bit out-of-sync, I've been having internet issues today (now things are working, but I'm not sure it'd be permanent! :-/).
Dario
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 for Xen 4.6 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler
In reply to Chong LiSo, about the structure of the patch/changelog/etc, taking this patch as an example.
Quoted 3 lines · Chong Li
Add two
hypercalls(XEN_DOMCTL_SCHEDOP_getvcpuinfo/putvcpuinfo)to get/set a domain's per-VCPU parameters.
This is almost ok. Line should be shorter (try a `git log' with this patch committed, and check how it looks).
Also, I'd rephrase it as "Add XEN_DOMCTL_SCHEDOP_getvcpuinfo and _putvcpuinfo hypercalls to independently get and set the scheduling parameters of each vCPU of a domain"
Or something like this.
Quoted 2 lines
Changes on PATCH v2:
So, this kind of summary goes below the '---', as we don't want it in the final history. And what it should contain what actually changed between previous versions and this one, while this...
Quoted 7 lines
1) Change struct
xen_domctl_scheduler_op, for transferring per-vcpu parameters between libxc and hypervisor.2) Handler of
XEN_DOMCTL_SCHEDOP_getinfonow just returns the default budget and period values of RTDS scheduler.3) Handler of
XEN_DOMCTL_SCHEDOP_getvcpuinfonow can return a random subset of the parameters of the VCPUs of a specific domain
... looks more like something that could actually be in the actual changelog (so not under any 'Changes on PATCH v2' preamble), as it dscribes how the hypercall interface looks like.
Regards,
Dario
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v3 2/4 libxc: enable per-VCPU parameter settings for RTDS scheduler
In reply to Chong LiAdd xc_sched_rtds_vcpu_get/set functions to interact with Xen to get/set a domain's per-VCPU parameters.
Changes on PATCH v2:
1) Minor modifications due to the change of struct xen_domctl_scheduler_op.
---
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
--- tools/libxc/include/xenctrl.h | 9 ++++++ tools/libxc/xc_csched.c | 4 +-- tools/libxc/xc_csched2.c | 4 +-- tools/libxc/xc_rt.c | 64 +++++++++++++++++++++++++++++++++++++++---- tools/libxc/xc_sedf.c | 4 +-- 5 files changed, 74 insertions(+), 11 deletions(-)
tools/libxc/include/xenctrl.h +9 -0
@@ -915,6 +915,15 @@ int xc_sched_rtds_domain_get(xc_interface *xch,uint32_t domid, struct xen_domctl_sched_rtds *sdom); +int xc_sched_rtds_vcpu_set (xc_interface *xch, +uint32_t domid, +xen_domctl_schedparam_vcpu_t *vcpus, +uint16_t num_vcpus); +int xc_sched_rtds_vcpu_get (xc_interface *xch, +uint32_t domid, +xen_domctl_schedparam_vcpu_t *vcpus, +uint16_t num_vcpus); + int xc_sched_arinc653_schedule_set( xc_interface *xch,
tools/libxc/xc_csched.c +2 -2
@@ -36,7 +36,7 @@ xc_sched_credit_domain_set( domctl.domain = (domid_t ) domid; domctl.u.scheduler_op.sched_id =XEN_SCHEDULER_CREDIT ; domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo; - domctl.u.scheduler_op.u.credit = *sdom; + domctl.u.scheduler_op.u.d.credit = *sdom;return do_domctl (xch, &domctl); }
@@ -57,7 +57,7 @@ xc_sched_credit_domain_get( err =do_domctl (xch, &domctl);if ( err ==0 ) - *sdom = domctl.u.scheduler_op.u.credit; + *sdom = domctl.u.scheduler_op.u.d.credit;return err; }
tools/libxc/xc_csched2.c +2 -2
@@ -36,7 +36,7 @@ xc_sched_credit2_domain_set( domctl.domain = (domid_t ) domid; domctl.u.scheduler_op.sched_id =XEN_SCHEDULER_CREDIT2 ; domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo; - domctl.u.scheduler_op.u.credit2 = *sdom; + domctl.u.scheduler_op.u.d.credit2 = *sdom;return do_domctl (xch, &domctl); }
@@ -57,7 +57,7 @@ xc_sched_credit2_domain_get( err =do_domctl (xch, &domctl);if ( err ==0 ) - *sdom = domctl.u.scheduler_op.u.credit2; + *sdom = domctl.u.scheduler_op.u.d.credit2;return err; }
tools/libxc/xc_rt.c +59 -5
88 lines not on this page · raw message
tools/libxc/xc_sedf.c +2 -2
@@ -34,7 +34,7 @@ int xc_sedf_domain_set( uint16_t weight) {DECLARE_DOMCTL ; -struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf; +struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.d.sedf; domctl.cmd = XEN_DOMCTL_scheduler_op; domctl.domain = (domid_t )domid;
@@ -60,7 +60,7 @@ int xc_sedf_domain_get( {DECLARE_DOMCTL ;int ret; -struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf; +struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.d.sedf; domctl.cmd = XEN_DOMCTL_scheduler_op; domctl.domain = (domid_t )domid;
Signature · 1 line
1.9.1
Re: [PATCH v3 for Xen 4.6 2/4] libxc: enable per-VCPU parameter settings for RTDS scheduler
Quoted 6 lines · Chong Li
Add xc_sched_rtds_vcpu_get/set functions to interact with Xen to get/set a domain's per-VCPU parameters.
Changes on PATCH v2:
1) Minor modifications due to the change of struct
xen_domctl_scheduler_op.
This intra-version changelog should go after the -- so it doesn't appear in the final commit message.
tools/libxc/xc_csched.c xc_sched_credit_domain_set( · line 39
Quoted 10 lines
tools/libxc/xc_csched.c +1
-1@@ -36,7 +36,7 @@ xc_sched_credit_domain_set( domctl.domain = (domid_t ) domid; domctl.u.scheduler_op.sched_id =XEN_SCHEDULER_CREDIT ; domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo; - domctl.u.scheduler_op.u.credit = *sdom; + domctl.u.scheduler_op.u.d.credit = *sdom;
I don't see any change to any types in this series, which makes me suspect it is in another patch and that bisectability is therefore not maintained through the series. Each patch in the series needs to build when they are applied one by one.
This probably means that at to at least some degree hypercall interface changes need to be done in the same time as the libxc adjustments. You can still keep the _new_ functionality in a separate patch of course (if that makes sense in this case).
Ian.
Re: [PATCH v3 for Xen 4.6 2/4] libxc: enable per-VCPU parameter settings for RTDS scheduler
Quoted 10 lines · Ian Campbell
Quoted 6 lines · Chong Li
Add xc_sched_rtds_vcpu_get/set functions to interact with Xen to get/set a domain's per-VCPU parameters.
Changes on PATCH v2:
1) Minor modifications due to the change of struct
xen_domctl_scheduler_op.This intra-version changelog should go after the -- so it doesn't appear in the final commit message.
Ok, I see.
Quoted 17 lines
tools/libxc/xc_csched.c xc_sched_credit_domain_set( · line 39
Quoted 11 lines
tools/libxc/xc_csched.c +1
-1@@ -36,7 +36,7 @@ xc_sched_credit_domain_set( domctl.domain = (domid_t ) domid; domctl.u.scheduler_op.sched_id =XEN_SCHEDULER_CREDIT ; domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo; - domctl.u.scheduler_op.u.credit = *sdom; + domctl.u.scheduler_op.u.d.credit = *sdom;I don't see any change to any types in this series, which makes me suspect it is in another patch and that bisectability is therefore not maintained through the series. Each patch in the series needs to build when they are applied one by one.
Quoted 4 lines
This probably means that at to at least some degree hypercall interface changes need to be done in the same time as the libxc adjustments. You can still keep the _new_ functionality in a separate patch of course (if that makes sense in this case).
Because both per-domain and per-vcpu parameters are now unioned in struct xen_domctl_scheduler_op, we need to specify per-domain or per-vcpu when using domctl.u.scheduler_op.u (.d means per-domain, .v means per-vcpu). This change also happens to the XEN_DOMCTL_SCHEDOP_* handlers (of all schedulers), where the domctl.u.scheduler_op.u.* is passed to.
Chong
Quoted 3 lines
Ian.
Signature · 3 lines
Chong Li Department of Computer Science and Engineering Washington University in St.louis
Re: [PATCH v3 for Xen 4.6 2/4] libxc: enable per-VCPU parameter settings for RTDS scheduler
Quoted 35 lines · Chong Li
Quoted 10 lines · Ian Campbell
Quoted 6 lines · Chong Li
Add xc_sched_rtds_vcpu_get/set functions to interact with Xen to get/set a domain's per-VCPU parameters.
Changes on PATCH v2:
1) Minor modifications due to the change of struct
xen_domctl_scheduler_op.This intra-version changelog should go after the -- so it doesn't appear in the final commit message.
Ok, I see.
Quoted 17 lines
tools/libxc/xc_csched.c xc_sched_credit_domain_set( · line 39
Quoted 11 lines
tools/libxc/xc_csched.c +1
-1@@ -36,7 +36,7 @@ xc_sched_credit_domain_set( domctl.domain = (domid_t ) domid; domctl.u.scheduler_op.sched_id =XEN_SCHEDULER_CREDIT ; domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo; - domctl.u.scheduler_op.u.credit = *sdom; + domctl.u.scheduler_op.u.d.credit = *sdom;I don't see any change to any types in this series, which makes me suspect it is in another patch and that bisectability is therefore not maintained through the series. Each patch in the series needs to build when they are applied one by one.
Quoted 4 lines
This probably means that at to at least some degree hypercall interface changes need to be done in the same time as the libxc adjustments. You can still keep the _new_ functionality in a separate patch of course (if that makes sense in this case).
Quoted 6 lines
Because both per-domain and per-vcpu parameters are now unioned in struct
xen_domctl_scheduler_op, we need to specify per-domain or per-vcpu when using domctl.u.scheduler_op.u (.d means per-domain, .v means per-vcpu). This change also happens to the XEN_DOMCTL_SCHEDOP_* handlers (of all schedulers), where the domctl.u.scheduler_op.u.* is passed to.
I understand the interface change, but the problem is that the interface change and the change ot the users of that interface seem to be in different patches, which breaks bisectability.
Does this series compile and work at every step?
i.e. the following combinations of patches from this 4 patch series all need to build and work successfully:
Patch #1
Patch #1+#2
Patch #1+#2+#3
Patch #1+#2+#3+#4
Is that the case?
Ian.
Re: [PATCH v3 for Xen 4.6 2/4] libxc: enable per-VCPU parameter settings for RTDS scheduler
Quoted 41 lines · Ian Campbell
Quoted 24 lines · Chong Li
Quoted 18 lines · Ian Campbell
tools/libxc/xc_csched.c xc_sched_credit_domain_set( · line 39
Quoted 10 lines · Chong Li
tools/libxc/xc_csched.c +1
-1@@ -36,7 +36,7 @@ xc_sched_credit_domain_set( domctl.domain = (domid_t ) domid; domctl.u.scheduler_op.sched_id =XEN_SCHEDULER_CREDIT ; domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo; - domctl.u.scheduler_op.u.credit = *sdom; + domctl.u.scheduler_op.u.d.credit = *sdom;I don't see any change to any types in this series, which makes me suspect it is in another patch and that bisectability is therefore not maintained through the series. Each patch in the series needs to build when they are applied one by one.
Quoted 4 lines
This probably means that at to at least some degree hypercall interface changes need to be done in the same time as the libxc adjustments. You can still keep the _new_ functionality in a separate patch of course (if that makes sense in this case).
Quoted 6 lines
Because both per-domain and per-vcpu parameters are now unioned in struct
xen_domctl_scheduler_op, we need to specify per-domain or per-vcpu when using domctl.u.scheduler_op.u (.d means per-domain, .v means per-vcpu). This change also happens to the XEN_DOMCTL_SCHEDOP_* handlers (of all schedulers), where the domctl.u.scheduler_op.u.* is passed to.I understand the interface change, but the problem is that the interface change and the change ot the users of that interface seem to be in different patches, which breaks bisectability.
Does this series compile and work at every step?
i.e. the following combinations of patches from this 4 patch series all need to build and work successfully:
Quoted 6 lines
Patch #1
Patch #1+#2
Patch #1+#2+#3
Patch #1+#2+#3+#4Is that the case?
I see your point. Do you mean the change of struct xen_domctl_scheduler_op, the change of XEN_DOMCTL_SCHEDOP_* handlers (in xen) and the change of libxc (just shown above) should be in the same patch? Should the title of that patch be something like "xen+libxc: enable per-vcpu parameter settings for RTDS scheduler" ?
Chong
Quoted 3 lines
Ian.
Signature · 3 lines
Chong Li Department of Computer Science and Engineering Washington University in St.louis
Re: [PATCH v3 for Xen 4.6 2/4] libxc: enable per-VCPU parameter settings for RTDS scheduler
Quoted 47 lines · Chong Li
Quoted 46 lines · Ian Campbell
Quoted 24 lines · Chong Li
Quoted 18 lines · Ian Campbell
tools/libxc/xc_csched.c xc_sched_credit_domain_set( · line 39
Quoted 10 lines · Chong Li
tools/libxc/xc_csched.c +1
-1@@ -36,7 +36,7 @@ xc_sched_credit_domain_set( domctl.domain = (domid_t ) domid; domctl.u.scheduler_op.sched_id =XEN_SCHEDULER_CREDIT ; domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo; - domctl.u.scheduler_op.u.credit = *sdom; + domctl.u.scheduler_op.u.d.credit = *sdom;I don't see any change to any types in this series, which makes me suspect it is in another patch and that bisectability is therefore not maintained through the series. Each patch in the series needs to build when they are applied one by one.
Quoted 4 lines
This probably means that at to at least some degree hypercall interface changes need to be done in the same time as the libxc adjustments. You can still keep the _new_ functionality in a separate patch of course (if that makes sense in this case).
Quoted 6 lines
Because both per-domain and per-vcpu parameters are now unioned in struct
xen_domctl_scheduler_op, we need to specify per-domain or per-vcpu when using domctl.u.scheduler_op.u (.d means per-domain, .v means per-vcpu). This change also happens to the XEN_DOMCTL_SCHEDOP_* handlers (of all schedulers), where the domctl.u.scheduler_op.u.* is passed to.I understand the interface change, but the problem is that the interface change and the change ot the users of that interface seem to be in different patches, which breaks bisectability.
Does this series compile and work at every step?
i.e. the following combinations of patches from this 4 patch series all need to build and work successfully:
Patch #1
Patch #1+#2
Patch #1+#2+#3
Patch #1+#2+#3+#4
Quoted 7 lines
Quoted 1 line
Is that the case?
I see your point. Do you mean the change of struct
xen_domctl_scheduler_op, the change of XEN_DOMCTL_SCHEDOP_* handlers (in xen) and the change of libxc (just shown above) should be in the same patch? Should the title of that patch be something like "xen+libxc: enable per-vcpu parameter settings for RTDS scheduler" ?
Ah I said, you should be able to do the nop interface change in one patch and then add the bindings for the new scheduler in a separate one.
Ian.
Quoted 8 lines
Chong
Quoted 3 lines
Ian.
PATCH v3 3/4 libxl: enable per-VCPU parameter settings for RTDS scheduler
In reply to Chong LiAdd libxl_vcpu_sched_params_get/set and sched_rtds_vcpu_get/set functions to support per-VCPU settings.
Changes on PATCH v2:
1) New data structure (libxl_vcpu_sched_params and libxl_sched_params) to help per-VCPU settings.
2) sched_rtds_vcpu_get now can return a random subset of the parameters of the VCPUs of a specific domain.
---
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
--- tools/libxl/libxl.c | 209 +++++++++++++++++++++++++++++++++++++++----- tools/libxl/libxl.h | 17 ++++ tools/libxl/libxl_types.idl | 16 ++++ 3 files changed, 220 insertions(+), 22 deletions(-)
tools/libxl/libxl.c +187 -22
@@ -5854,6 +5854,144 @@ static int sched_sedf_domain_set(libxl__gc *gc, uint32_t domid,return 0 ; } +static int sched_rtds_validate_params (libxl__gc *gc,int period, +int budget,uint32_t *sdom_period, +uint32_t *sdom_budget) +{ +if (period !=LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT ) { +if (period <1 ) { +LOG (ERROR ,"VCPU period is not set or out of range, " +"valid values are larger than or equal to 1" ); +return 1 ; + } + *sdom_period = period; + } + +if (budget !=LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT ) { +if (budget <1 ) { +LOG (ERROR ,"VCPU budget is not set or out of range, " +"valid values are larger than or equal to 1" ); +return 1 ; + } + *sdom_budget = budget; + } + +if (budget > period) { +LOG (ERROR ,"VCPU budget is larger than VCPU period" ); +return 1 ; + } + +return 0 ; +} + +static int sched_rtds_vcpu_get (libxl__gc *gc,uint32_t domid, +libxl_vcpu_sched_params *scinfo) +{ +uint16_t num_vcpus; +int rc, i; +xc_dominfo_t info; +xen_domctl_schedparam_vcpu_t *vcpus; + +if (scinfo->num_vcpus ==0 ) { + rc =xc_domain_getinfo (CTX ->xch, domid,1 , &info); +if (rc <0 ) { +LOGE (ERROR ,"getting domain info" ); +return ERROR_FAIL ; + } + num_vcpus = info.max_vcpu_id +1 ; + }else + num_vcpus = scinfo->num_vcpus; + +GCNEW_ARRAY (vcpus, num_vcpus); + +if (scinfo->num_vcpus >0 ) +for (i=0 ; i < num_vcpus; i++) + vcpus[i].vcpuid = scinfo->vcpus[i].vcpuid; +else +for (i=0 ; i < num_vcpus; i++) + vcpus[i].vcpuid = i; + + rc =xc_sched_rtds_vcpu_get (CTX ->xch, domid, vcpus, num_vcpus); +if (rc !=0 ) { +LOGE (ERROR ,"getting vcpu sched rtds" ); +return ERROR_FAIL ; + } + + scinfo->sched =LIBXL_SCHEDULER_RTDS ; +if (scinfo->num_vcpus ==0 ) { + scinfo->num_vcpus = num_vcpus; + scinfo->vcpus =libxl__calloc (NOGC , num_vcpus,sizeof (libxl_sched_params)); + } +for (i =0 ; i < num_vcpus; i++) { + scinfo->vcpus[i].period = vcpus[i].s.rtds.period; + scinfo->vcpus[i].budget = vcpus[i].s.rtds.budget; + scinfo->vcpus[i].vcpuid = vcpus[i].vcpuid; + } + +return 0 ; +} + +static int sched_rtds_vcpu_set (libxl__gc *gc,uint32_t domid, +const libxl_vcpu_sched_params *scinfo) +{ +int rc; +int i; +uint16_t max_vcpuid; +xc_dominfo_t info; +xen_domctl_schedparam_vcpu_t *vcpus; +int num_vcpus; + + rc =xc_domain_getinfo (CTX ->xch, domid,1 , &info); +if (rc <0 ) { +LOGE (ERROR ,"getting domain info" ); +return ERROR_FAIL ; + } + max_vcpuid = info.max_vcpu_id; + +if (scinfo->num_vcpus >0 ) { + num_vcpus = scinfo->num_vcpus; +GCNEW_ARRAY (vcpus, num_vcpus); +for (i =0 ; i < num_vcpus; i++) { +if (scinfo->vcpus[i].vcpuid <0 || + scinfo->vcpus[i].vcpuid > max_vcpuid) { +LOG (ERROR ,"VCPU index is out of range, " +"valid values are within range from 0 to %d" , + max_vcpuid); +return ERROR_INVAL ; + } + vcpus[i].vcpuid = scinfo->vcpus[i].vcpuid; + + rc =sched_rtds_validate_params (gc, + scinfo->vcpus[i].period, scinfo->vcpus[i].budget, + &vcpus[i].s.rtds.period, &vcpus[i].s.rtds.budget); +if (rc) +return ERROR_INVAL ; + } + }else { + num_vcpus = max_vcpuid +1 ; +GCNEW_ARRAY (vcpus, num_vcpus); + rc =sched_rtds_validate_params (gc, + scinfo->vcpus[0 ].period, scinfo->vcpus[0 ].budget, + &vcpus[0 ].s.rtds.period, &vcpus[0 ].s.rtds.budget); +if (rc) +return ERROR_INVAL ; +for (i =0 ; i < num_vcpus; i++) { + vcpus[i].vcpuid = i; + vcpus[i].s.rtds.period = scinfo->vcpus[0 ].period; + vcpus[i].s.rtds.budget = scinfo->vcpus[0 ].budget; + } + } + + rc =xc_sched_rtds_vcpu_set (CTX ->xch, domid, + vcpus, num_vcpus); +if (rc !=0 ) { +LOGE (ERROR ,"setting vcpu sched rtds" ); +return ERROR_FAIL ; + } + +return rc; +} +static int sched_rtds_domain_get (libxl__gc *gc,uint32_t domid,libxl_domain_sched_params *scinfo) {
@@ -5887,29 +6025,10 @@ static int sched_rtds_domain_set(libxl__gc *gc, uint32_t domid,return ERROR_FAIL ; } -if (scinfo->period !=LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT ) { -if (scinfo->period <1 ) { -LOG (ERROR ,"VCPU period is not set or out of range, " -"valid values are larger than 1" ); -return ERROR_INVAL ; - } - sdom.period = scinfo->period; - } - -if (scinfo->budget !=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" ); -return ERROR_INVAL ; - } - sdom.budget = scinfo->budget; - } - -if (sdom.budget > sdom.period) { -LOG (ERROR ,"VCPU budget is larger than VCPU period, " -"VCPU budget should be no larger than VCPU period" ); + rc =sched_rtds_validate_params (gc, scinfo->period, scinfo->budget, + &sdom.period, &sdom.budget); +if (rc)return ERROR_INVAL ; - } rc =xc_sched_rtds_domain_set (CTX ->xch, domid, &sdom);if (rc <0 ) {
@@ -5956,6 +6075,30 @@ int libxl_domain_sched_params_set(libxl_ctx *ctx, uint32_t domid,return ret; } +int libxl_vcpu_sched_params_set (libxl_ctx *ctx,uint32_t domid, +const libxl_vcpu_sched_params *scinfo) +{ +GC_INIT (ctx); +libxl_scheduler sched = scinfo->sched; +int ret; + +if (sched ==LIBXL_SCHEDULER_UNKNOWN ) + sched =libxl__domain_scheduler (gc, domid); + +switch (sched) { +case LIBXL_SCHEDULER_RTDS : + ret =sched_rtds_vcpu_set (gc, domid, scinfo); +break ; +default : +LOG (ERROR ,"Unknown scheduler" ); + ret =ERROR_INVAL ; +break ; + } + +GC_FREE ; +return ret; +} +int libxl_domain_sched_params_get (libxl_ctx *ctx,uint32_t domid,libxl_domain_sched_params *scinfo) {
@@ -5989,6 +6132,28 @@ int libxl_domain_sched_params_get(libxl_ctx *ctx, uint32_t domid,return ret; } +int libxl_vcpu_sched_params_get (libxl_ctx *ctx,uint32_t domid, +libxl_vcpu_sched_params *scinfo) +{ +GC_INIT (ctx); +int ret; + + scinfo->sched =libxl__domain_scheduler (gc, domid); + +switch (scinfo->sched) { +case LIBXL_SCHEDULER_RTDS : + ret =sched_rtds_vcpu_get (gc, domid, scinfo); +break ; +default : +LOG (ERROR ,"Unknown scheduler" ); + ret =ERROR_INVAL ; +break ; + } + +GC_FREE ; +return ret; +} +static int libxl__domain_s3_resume (libxl__gc *gc,int domid) {int rc =0 ;
tools/libxl/libxl.h +17 -0
@@ -200,6 +200,16 @@#define LIBXL_HAVE_DEVICETREE_PASSTHROUGH 1/* +* libxl_vcpu_sched_params is used to get/set per-vcpu params +*/ +#define LIBXL_HAVE_VCPU_SCHED_PARAMS 1 + +/* +* libxl_sched_params is used to store per-vcpu params +*/ +#define LIBXL_SCHED_PARAMS 1 + +/* * libxl ABI compatibility * * The only guarantee which libxl makes regarding ABI compatibility
@@ -1554,10 +1564,17 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid,#define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1#define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT -1 +/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1 +int libxl_domain_sched_params_get (libxl_ctx *ctx,uint32_t domid,libxl_domain_sched_params *params);int libxl_domain_sched_params_set (libxl_ctx *ctx,uint32_t domid,const libxl_domain_sched_params *params); +int libxl_vcpu_sched_params_get (libxl_ctx *ctx,uint32_t domid, +libxl_vcpu_sched_params *params); +int libxl_vcpu_sched_params_set (libxl_ctx *ctx,uint32_t domid, +const libxl_vcpu_sched_params *params);int libxl_send_trigger (libxl_ctx *ctx,uint32_t domid,libxl_trigger trigger,uint32_t vcpuid);
tools/libxl/libxl_types.idl +16 -0
@@ -351,6 +351,22 @@ libxl_domain_restore_params = Struct("domain_restore_params", [ ("checkpointed_stream", integer), ]) +libxl_sched_params = Struct("sched_params",[ + ("vcpuid", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT'}), + ("weight", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT'}), + ("cap", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_CAP_DEFAULT'}), + ("period", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT'}), + ("slice", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT'}), + ("latency", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_LATENCY_DEFAULT'}), + ("extratime", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}), + ("budget", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT'}), + ]) + +libxl_vcpu_sched_params = Struct("vcpu_sched_params",[ + ("sched", libxl_scheduler), + ("vcpus", Array(libxl_sched_params, "num_vcpus")), + ]) + libxl_domain_sched_params = Struct("domain_sched_params",[ ("sched", libxl_scheduler), ("weight", integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT'}),
Signature · 1 line
1.9.1
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
tools/libxl/libxl.c int libxl_domain_sched_params_set(libxl_ctx *ctx, uint32_t domid, · line 6093
Quoted 13 lines · Chong Li
tools/libxl/libxl.c +13
-0+GC_INIT (ctx); +libxl_scheduler sched = scinfo->sched; +int ret; + +if (sched ==LIBXL_SCHEDULER_UNKNOWN ) + sched =libxl__domain_scheduler (gc, domid); + +switch (sched) { +case LIBXL_SCHEDULER_RTDS : + ret =sched_rtds_vcpu_set (gc, domid, scinfo); +break ; +default : +LOG (ERROR ,"Unknown scheduler" );
There are several other known schedulers, I don't think the fact that they don't have any need for per-vcpu variables should result in this error message, they should get something more specific to that situation. Only truly unknown values for the scheduler should result in this message.
[...]
tools/libxl/libxl.h line 210
Quoted 9 lines
/*
+ *libxl_vcpu_sched_paramsis used to get/set per-vcpu paramstools/libxl/libxl.h +7
-0+*/ +#define LIBXL_HAVE_VCPU_SCHED_PARAMS 1 + +/* +* libxl_sched_params is used to store per-vcpu params +*/ +#define LIBXL_SCHED_PARAMS 1
Do we need both of these? In particular I'm not sure what the second one is indicating has changed.
tools/libxl/libxl.h int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1568
Quoted 11 lines
tools/libxl/libxl.h +4
-0+ +/* * libxl ABI compatibility * * The only guarantee which libxl makes regarding ABI compatibility @@ -1554,10 +1564,17 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid,#define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1#define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT -1 +/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1
What is the effect of passing vcpuid == -1 to this interface?
Ian.
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 13 lines · Ian Campbell
Quoted 11 lines · Chong Li
tools/libxl/libxl.c +11
-0+GC_INIT (ctx); +libxl_scheduler sched = scinfo->sched; +int ret; + +if (sched ==LIBXL_SCHEDULER_UNKNOWN ) + sched =libxl__domain_scheduler (gc, domid); + +switch (sched) { +case LIBXL_SCHEDULER_RTDS : + ret =sched_rtds_vcpu_set (gc, domid, scinfo); +break ;
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ default: + LOG(ERROR, "Unknown scheduler");There are several other known schedulers, I don't think the fact that they don't have any need for per-vcpu variables should result in this error message, they should get something more specific to that situation. Only truly unknown values for the scheduler should result in this message.
Right, I'll change it.
Quoted 14 lines
[...]
tools/libxl/libxl.h line 210
Quoted 9 lines
/*
+ *libxl_vcpu_sched_paramsis used to get/set per-vcpu paramstools/libxl/libxl.h +7
-0+*/ +#define LIBXL_HAVE_VCPU_SCHED_PARAMS 1 + +/* +* libxl_sched_params is used to store per-vcpu params +*/ +#define LIBXL_SCHED_PARAMS 1Do we need both of these? In particular I'm not sure what the second one is indicating has changed.
Sorry for the vague description there, and there is an error there. The right way should be:
/* libxl_sched_params is introduced to store per-vcpu params. */ #define LIBXL_HAVE_SCHED_PARAMS
/* libxl_vcpu_sched_params is introduced to store the array of libxl_sched_params (per-vcpu params). */
#define LIBXL_HAVE_VCPU_SCHED_PARAMS
Actually, now I'm not sure if both them should be there, because I've not found "LIBXL_HAVE_DOMAIN_SCHED_PARAMS" there.
Quoted 10 lines
Quoted 10 lines
tools/libxl/libxl.h +2
-0+ +/* * libxl ABI compatibility * * The only guarantee which libxl makes regarding ABI compatibility @@ -1554,10 +1564,17 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid,#define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1#define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT -1
Quoted 4 lines
tools/libxl/libxl.h int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1568
Quoted 2 lines
tools/libxl/libxl.h +2
-0+/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1What is the effect of passing vcpuid == -1 to this interface?
I think the right way should be:
#define LIBXL_SCHED_PARAM_VCPU_INDEX_DEFAULT -1
which is the default value for the vcpuid in libxl_sched_params. Even though libxl_sched_params is used for per-vcpu settings, all the other fields (except vcpuid) would still use LIBXL_DOMAIN_SCHED_PARAM_*_DEFAULT values, just for convenience.
Chong
Quoted 3 lines
Ian.
Signature · 3 lines
Chong Li Department of Computer Science and Engineering Washington University in St.louis
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 9 lines · Chong Li
Quoted 8 lines
tools/libxl/libxl.h int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1568
Quoted 6 lines
tools/libxl/libxl.h +2
-0@@ -1554,10 +1564,17 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid,#define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1#define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT -1 +/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1What is the effect of passing vcpuid == -1 to this interface?
Quoted 8 lines
I think the right way should be:
#define
LIBXL_SCHED_PARAM_VCPU_INDEX_DEFAULT-1which is the default value for the vcpuid in
libxl_sched_params. Even thoughlibxl_sched_paramsis used for per-vcpu settings, all the other fields (except vcpuid) would still use LIBXL_DOMAIN_SCHED_PARAM_*_DEFAULT values, just for convenience.
My question is what does the concept of vcpu==-1 mean in this interface?
Ian.
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 12 lines · Ian Campbell
Quoted 11 lines · Chong Li
Quoted 8 lines
tools/libxl/libxl.h int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1568
Quoted 6 lines
tools/libxl/libxl.h +2
-0@@ -1554,10 +1564,17 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid,#define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1#define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT -1 +/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1What is the effect of passing vcpuid == -1 to this interface?
I think the right way should be:
Quoted 8 lines
Quoted 6 lines
#define
LIBXL_SCHED_PARAM_VCPU_INDEX_DEFAULT-1which is the default value for the vcpuid in
libxl_sched_params. Even thoughlibxl_sched_paramsis used for per-vcpu settings, all the other fields (except vcpuid) would still use LIBXL_DOMAIN_SCHED_PARAM_*_DEFAULT values, just for convenience.My question is what does the concept of vcpu==-1 mean in this interface?
We need a default value for vcpuid when initiating libxl_sched_params, just like other fields (e.g., budget, weight ...) in the struct. But the default value could be others, maybe "0". I'm not sure.
Quoted 3 lines
Ian.
Signature · 3 lines
Chong Li Department of Computer Science and Engineering Washington University in St.louis
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 20 lines · Chong Li
Quoted 19 lines · Ian Campbell
Quoted 17 lines · Chong Li
Quoted 8 lines
tools/libxl/libxl.h int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1568
Quoted 6 lines
tools/libxl/libxl.h +2
-0@@ -1554,10 +1564,17 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid,#define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1#define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT -1 +/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1What is the effect of passing vcpuid == -1 to this interface?
I think the right way should be:
#define
LIBXL_SCHED_PARAM_VCPU_INDEX_DEFAULT-1which is the default value for the vcpuid in
libxl_sched_params. Even thoughlibxl_sched_paramsis used for per-vcpu settings, all the other fields (except vcpuid) would still use LIBXL_DOMAIN_SCHED_PARAM_*_DEFAULT values, just for convenience.
Quoted 5 lines
Quoted 1 line
My question is what does the concept of vcpu==-1 mean in this interface?
We need a default value for vcpuid when initiating
libxl_sched_params, just like other fields (e.g., budget, weight ...) in the struct. But the default value could be others, maybe "0". I'm not sure.
What will you do if you come across a -1 in this field? What are the semantics of the interface WRT this field.
Note that this field is not the same as the others in this struct, it is in effect part of the "key" while the others are the "values".
Ian.
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 27 lines · Ian Campbell
Quoted 20 lines · Chong Li
Quoted 19 lines · Ian Campbell
Quoted 17 lines · Chong Li
Quoted 8 lines
tools/libxl/libxl.h int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1568
Quoted 6 lines
tools/libxl/libxl.h +2
-0@@ -1554,10 +1564,17 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid,#define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1#define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT -1 +/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1What is the effect of passing vcpuid == -1 to this interface?
I think the right way should be:
#define
LIBXL_SCHED_PARAM_VCPU_INDEX_DEFAULT-1which is the default value for the vcpuid in
libxl_sched_params. Even thoughlibxl_sched_paramsis used for per-vcpu settings, all the other fields (except vcpuid) would still use LIBXL_DOMAIN_SCHED_PARAM_*_DEFAULT values, just for convenience.Quoted 5 lines
Quoted 1 line
My question is what does the concept of vcpu==-1 mean in this interface?
We need a default value for vcpuid when initiating
libxl_sched_params, just like other fields (e.g., budget, weight ...) in the struct. But the default value could be others, maybe "0". I'm not sure.
Quoted 6 lines
What will you do if you come across a -1 in this field? What are the semantics of the interface WRT this field.
Note that this field is not the same as the others in this struct, it is in effect part of the "key" while the others are the "values".
For example, if vm1 has 4 VCPUs, and the user types in:
"xl rtds -d vm1 -v 1 -v 3"
to get (output) the per-vcpu information of VCPU 1 and VCPU 3. In libxl.c, we create an array (say vcpus), which has two elements (each one is a libxl_sched_params). Then we do:
vcpus[0].vcpuid = 1; vcpus[1].vcpuid = 3;
and all the other fields in each libxl_sched_params keep empty, but will be filled in by the hypercall handler.
So vcpuid == -1 only exists during initiation, and it will be definitely given a valid value later.
Chong
Quoted 2 lines
Ian.
Signature · 3 lines
Chong Li Department of Computer Science and Engineering Washington University in St.louis
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
In reply to Ian CampbellHi Ian,
2015-06-30 9:19 GMT-07:00 Ian Campbell <[email protected]>:
Quoted 27 lines · Chong Li
Quoted 20 lines · Ian Campbell
Quoted 19 lines · Chong Li
Quoted 17 lines
Quoted 8 lines
tools/libxl/libxl.h int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1568
Quoted 6 lines
tools/libxl/libxl.h +2
-0@@ -1554,10 +1564,17 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid,#define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1#define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT -1 +/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1What is the effect of passing vcpuid == -1 to this interface?
I think the right way should be:
#define
LIBXL_SCHED_PARAM_VCPU_INDEX_DEFAULT-1which is the default value for the vcpuid in
libxl_sched_params. Even thoughlibxl_sched_paramsis used for per-vcpu settings, all the other fields (except vcpuid) would still use LIBXL_DOMAIN_SCHED_PARAM_*_DEFAULT values, just for convenience.Quoted 5 lines
Quoted 1 line
My question is what does the concept of vcpu==-1 mean in this interface?
We need a default value for vcpuid when initiating
libxl_sched_params, just like other fields (e.g., budget, weight ...) in the struct. But the default value could be others, maybe "0". I'm not sure.
Quoted 6 lines
What will you do if you come across a -1 in this field? What are the semantics of the interface WRT this field.
Note that this field is not the same as the others in this struct, it is in effect part of the "key" while the others are the "values".
vcpuid in the libxl is not the key but the value.
When it is passed into hypervisor, vcpuid acts as the key to identify which VCPU. vcpuid should be be negative when it is passed to hypervisor.
Do you have any concerns about assigning the initial value of vcpuid as -1?
Thanks,
Meng
-----------
Meng Xu
PhD Student in Computer and Information Science
University of Pennsylvania
http://www.cis.upenn.edu/~mengxu/
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 37 lines · Meng Xu
Hi Ian,
2015-06-30 9:19 GMT-07:00 Ian Campbell <[email protected]>:
Quoted 27 lines · Chong Li
Quoted 20 lines · Ian Campbell
Quoted 19 lines · Chong Li
Quoted 17 lines
Quoted 8 lines
Review int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1568
Quoted 6 lines
(quoted diff) +2
-0@@ -1554,10 +1564,17 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, #define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1 #define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT -1 +/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1What is the effect of passing vcpuid == -1 to this interface?
I think the right way should be:
#define
LIBXL_SCHED_PARAM_VCPU_INDEX_DEFAULT-1which is the default value for the vcpuid in
libxl_sched_params. Even thoughlibxl_sched_paramsis used for per-vcpu settings, all the other fields (except vcpuid) would still use LIBXL_DOMAIN_SCHED_PARAM_*_DEFAULT values, just for convenience.Quoted 5 lines
Quoted 1 line
My question is what does the concept of vcpu==-1 mean in this interface?
We need a default value for vcpuid when initiating
libxl_sched_params, just like other fields (e.g., budget, weight ...) in the struct. But the default value could be others, maybe "0". I'm not sure.Quoted 6 lines
What will you do if you come across a -1 in this field? What are the semantics of the interface WRT this field.
Note that this field is not the same as the others in this struct, it is in effect part of the "key" while the others are the "values".
Quoted 7 lines
vcpuid in the libxl is not the key but the value.
When it is passed into hypervisor, vcpuid acts as the key to identify which VCPU. vcpuid should be be negative when it is passed to hypervisor.
Do you have any concerns about assigning the initial value of vcpuid as -1?
libxl needs to do _something_ if it is passed a vcpuid=-1. What is that something?
Ian.
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 8 lines · Ian Campbell
Quoted 7 lines · Meng Xu
2015-06-30 9:19 GMT-07:00 Ian Campbell <[email protected]>:
Quoted 3 lines
Note that this field is not the same as the others in this struct, it is in effect part of the "key" while the others are the "values".
vcpuid in the libxl is not the key but the value.
Quoted 9 lines
Quoted 5 lines
When it is passed into hypervisor, vcpuid acts as the key to identify which VCPU. vcpuid should be be negative when it is passed to hypervisor.
Do you have any concerns about assigning the initial value of vcpuid as -1?
libxl needs to do _something_ if it is passed a vcpuid=-1. What is that something?
Exactly.
Meng, Chong, maybe what you are missing from Ian's point is the fact that libxl is a library on top of which to build more advanced toolstack, it is not just something that the xl command line tool links to.
Therefore, it has to work even when it is not xl that makes the API calls. Actually, I better say that --not only it has to work-- it has to be easy and comfortable to use from high level components different than xl.
The outcome of this reasoning is that, you can't just assume that a default value does not matter much, because every code path in _xl_ overrides it. Everything that is in libxl must make sense in libxl per-se, even without bringing xl into the picture.
So, in this case, you need to think whether it is convenient _in_general_, not only wrt xl, to have -1 as default value for vcpuid and, if yes, what happens if such default is not overridden and libxl gets to deal with it!
Hope this helps... If this was not the issue, sorry for the noise. :-)
Regards,
Dario
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 35 lines · Dario Faggioli
Quoted 8 lines · Ian Campbell
Quoted 7 lines · Meng Xu
2015-06-30 9:19 GMT-07:00 Ian Campbell <[email protected]>:
Quoted 3 lines
Note that this field is not the same as the others in this struct, it is in effect part of the "key" while the others are the "values".
vcpuid in the libxl is not the key but the value.
Quoted 9 lines
Quoted 5 lines
When it is passed into hypervisor, vcpuid acts as the key to identify which VCPU. vcpuid should be be negative when it is passed to hypervisor.
Do you have any concerns about assigning the initial value of vcpuid as -1?
libxl needs to do _something_ if it is passed a vcpuid=-1. What is that something?
Exactly.
Meng, Chong, maybe what you are missing from Ian's point is the fact that libxl is a library on top of which to build more advanced toolstack, it is not just something that the xl command line tool links to.
Therefore, it has to work even when it is not xl that makes the API calls. Actually, I better say that --not only it has to work-- it has to be easy and comfortable to use from high level components different than xl.
The outcome of this reasoning is that, you can't just assume that a default value does not matter much, because every code path in _xl_ overrides it. Everything that is in libxl must make sense in libxl per-se, even without bringing xl into the picture.
Quoted 6 lines
So, in this case, you need to think whether it is convenient _in_general_, not only wrt xl, to have -1 as default value for vcpuid and, if yes, what happens if such default is not overridden and libxl gets to deal with it!
Hope this helps... If this was not the issue, sorry for the noise. :-)
I did some sanity check about the vcpuid in hypervisor. Maybe that's not enough. I'll add other check on vcpuid in libxl (sched_rtds_vcpu_get/set) to ensure vcpuid has a valid value.
Chong
Quoted 9 lines
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)
Signature · 3 lines
Chong Li Department of Computer Science and Engineering Washington University in St.louis
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
In reply to Chong LiQuoted 5 lines · Chong Li
Add libxl_vcpu_sched_params_get/set and sched_rtds_vcpu_get/set functions to support per-VCPU settings.
Changes on PATCH v2:
Quoted 8 lines
1) New data structure (
libxl_vcpu_sched_paramsandlibxl_sched_params) to help per-VCPU settings.2)
sched_rtds_vcpu_getnow can return a random subset of the parameters of the VCPUs of a specific domain.Signed-off-by Chong Li <[email protected]>Signed-off-by Meng Xu <[email protected]>Signed-off-by Sisu Xi <[email protected]>
So, apart from what IanC said already, I think this patch is mostly fine, apart from:
- the changelog needing to improve, as explained already while reviewing one other patch in the series (that, in fact, applies to all of them)
- comments/documentation about the new behavior of per domain scheduling API calls looks to be missing to me...
- some coding style issues (see below).
Quoted 12 lines
tools/libxl/libxl.c +12
-0+static int sched_rtds_vcpu_get (libxl__gc *gc,uint32_t domid, +libxl_vcpu_sched_params *scinfo) +{ +uint16_t num_vcpus; +int rc, i; +xc_dominfo_t info; +xen_domctl_schedparam_vcpu_t *vcpus; + +if (scinfo->num_vcpus ==0 ) { + rc =xc_domain_getinfo (CTX ->xch, domid,1 , &info); +if (rc <0 ) { +LOGE (ERROR ,"getting domain info" );
tools/libxl/libxl.c static int sched_sedf_domain_set(libxl__gc *gc, uint32_t domid, · line 5908
Quoted 10 lines
tools/libxl/libxl.c +10
-0+return ERROR_FAIL ; + } + num_vcpus = info.max_vcpu_id +1 ; + }else + num_vcpus = scinfo->num_vcpus; + +GCNEW_ARRAY (vcpus, num_vcpus); + +if (scinfo->num_vcpus >0 ) +for (i=0 ; i < num_vcpus; i++)
spaces ("for (...")
Quoted 30 lines
tools/libxl/libxl.c +29
-0+static int sched_rtds_vcpu_set (libxl__gc *gc,uint32_t domid, +const libxl_vcpu_sched_params *scinfo) +{ +int rc; +int i; +uint16_t max_vcpuid; +xc_dominfo_t info; +xen_domctl_schedparam_vcpu_t *vcpus; +int num_vcpus; + + rc =xc_domain_getinfo (CTX ->xch, domid,1 , &info); +if (rc <0 ) { +LOGE (ERROR ,"getting domain info" ); +return ERROR_FAIL ; + } + max_vcpuid = info.max_vcpu_id; + +if (scinfo->num_vcpus >0 ) { + num_vcpus = scinfo->num_vcpus; +GCNEW_ARRAY (vcpus, num_vcpus); +for (i =0 ; i < num_vcpus; i++) { +if (scinfo->vcpus[i].vcpuid <0 || + scinfo->vcpus[i].vcpuid > max_vcpuid) { +LOG (ERROR ,"VCPU index is out of range, " +"valid values are within range from 0 to %d" , + max_vcpuid); +return ERROR_INVAL ; + } + vcpus[i].vcpuid = scinfo->vcpus[i].vcpuid;
tools/libxl/libxl.c static int sched_sedf_domain_set(libxl__gc *gc, uint32_t domid, · line 5972
Quoted 10 lines
tools/libxl/libxl.c +10
-0+ + rc =sched_rtds_validate_params (gc, + scinfo->vcpus[i].period, scinfo->vcpus[i].budget, + &vcpus[i].s.rtds.period, &vcpus[i].s.rtds.budget); +if (rc) +return ERROR_INVAL ; + } + }else { + num_vcpus = max_vcpuid +1 ; +GCNEW_ARRAY (vcpus, num_vcpus);
Indentation.
Quoted 25 lines
tools/libxl/libxl.h +12
-0@@ -200,6 +200,16 @@#define LIBXL_HAVE_DEVICETREE_PASSTHROUGH 1/* +* libxl_vcpu_sched_params is used to get/set per-vcpu params +*/ +#define LIBXL_HAVE_VCPU_SCHED_PARAMS 1 + +/* +* libxl_sched_params is used to store per-vcpu params +*/ +#define LIBXL_SCHED_PARAMS 1 + +/* * libxl ABI compatibility * * The only guarantee which libxl makes regarding ABI compatibility @@ -1554,10 +1564,17 @@ int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid,#define LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT -1#define LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT -1 +/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1
tools/libxl/libxl.h int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1578
Quoted 10 lines
tools/libxl/libxl.h +5
-0+int libxl_domain_sched_params_get (libxl_ctx *ctx,uint32_t domid,libxl_domain_sched_params *params);int libxl_domain_sched_params_set (libxl_ctx *ctx,uint32_t domid,const libxl_domain_sched_params *params); +int libxl_vcpu_sched_params_get (libxl_ctx *ctx,uint32_t domid, +libxl_vcpu_sched_params *params); +int libxl_vcpu_sched_params_set (libxl_ctx *ctx,uint32_t domid, +const libxl_vcpu_sched_params *params);
Didn't we say that we wanted the fact that now, at least for RTDS, libxl_domain_sched_params_*() deals with default parameters to be documented in a comment somewhere? Have I missed it?
I appreciate that this is happening in lower levels, and that libxl is just reporting it, but, still, it is something that I would like to find in the headers of the library, in order to be able to tell the differences between libxl_vcpu_sched_params_* and libxl_domain_sched_params_* ... Ian?
Regards,
Dario
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 6 lines · Dario Faggioli
Quoted 5 lines · Chong Li
Add libxl_vcpu_sched_params_get/set and sched_rtds_vcpu_get/set functions to support per-VCPU settings.
Quoted 15 lines
tools/libxl/libxl.h int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1577
Quoted 12 lines
tools/libxl/libxl.h +7
-0+/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1 +int libxl_domain_sched_params_get (libxl_ctx *ctx,uint32_t domid,libxl_domain_sched_params *params);int libxl_domain_sched_params_set (libxl_ctx *ctx,uint32_t domid,const libxl_domain_sched_params *params); +int libxl_vcpu_sched_params_get (libxl_ctx *ctx,uint32_t domid, +libxl_vcpu_sched_params *params); +int libxl_vcpu_sched_params_set (libxl_ctx *ctx,uint32_t domid, +const libxl_vcpu_sched_params *params);Didn't we say that we wanted the fact that now, at least for RTDS, libxl_domain_sched_params_*() deals with default parameters to be documented in a comment somewhere? Have I missed it?
I'll implement it in the next version.
Do both get/set deal with default parameters? I can easily implement it in hypervisor, because default parameters (RTDS_DEFAULT_PERIOD/BUDGET) are just defined there. But for libxl, how do I deal with it without knowing the default values?
Quoted 16 lines
I appreciate that this is happening in lower levels, and that libxl is just reporting it, but, still, it is something that I would like to find in the headers of the library, in order to be able to tell the differences between libxl_vcpu_sched_params_* and libxl_domain_sched_params_* ... Ian?
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)
Signature · 3 lines
Chong Li Department of Computer Science and Engineering Washington University in St.louis
Re: [PATCH v3 for Xen 4.6 3/4] libxl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 19 lines · Chong Li
On Tue, Jul 7, 2015 at 11:23 AM, Dario Faggioli
Quoted 16 lines
tools/libxl/libxl.h int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, · line 1577
Quoted 13 lines
tools/libxl/libxl.h +7
-0+/* Per-VCPU parameters*/ +#define LIBXL_DOMAIN_SCHED_PARAM_VCPU_INDEX_DEFAULT -1 +int libxl_domain_sched_params_get (libxl_ctx *ctx,uint32_t domid,libxl_domain_sched_params *params);int libxl_domain_sched_params_set (libxl_ctx *ctx,uint32_t domid,const libxl_domain_sched_params *params); +int libxl_vcpu_sched_params_get (libxl_ctx *ctx,uint32_t domid, +libxl_vcpu_sched_params *params); +int libxl_vcpu_sched_params_set (libxl_ctx *ctx,uint32_t domid, +const libxl_vcpu_sched_params *params);Didn't we say that we wanted the fact that now, at least for RTDS, libxl_domain_sched_params_*() deals with default parameters to be documented in a comment somewhere? Have I missed it?
Quoted 7 lines
I'll implement it in the next version.
Do both get/set deal with default parameters? I can easily implement it in hypervisor, because default parameters (RTDS_DEFAULT_PERIOD/BUDGET) are just defined there. But for libxl, how do I deal with it without knowing the default values?
What I meant was that I am ok with this being implemented in the hypervisor, but I think we want a comment explaining the difference between the two sets of operations (the _domain_ one and the _vcpu_ one) here in the library too.
And in such a comment, it would be good to mention what the _domain_ call does for a scheduler that supports per-vcpu parameters (and the vice-versa, which, yes, is rather trivial, but still).
The aim would be to give an libxl user an idea of what function he/she wants, depending on what scheduler and on which parameter, to achieve its purposes, and what (kind of error/behavior) should be expected if the wrong one is used.
Regards,
Dario
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v3 4/4 xl: enable per-VCPU parameter settings for RTDS scheduler
In reply to Chong LiChange main_sched_rtds and related output functions to support per-VCPU settings.
Changes on PATCH v2:
1) Remove per-domain output functions for RTDS scheduler.
2) Users now use '-v all' to specify all VCPUs.
3) Support outputting a subset of the parameters of the VCPUs of a specific domain.
4) When setting all VCPUs with the same parameters (by only one command), no per-domain function is invoked.
---
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
--- docs/man/xl.pod.1 | 4 + tools/libxl/xl_cmdimpl.c | 284 +++++++++++++++++++++++++++++++++++++++------- tools/libxl/xl_cmdtable.c | 10 +- 3 files changed, 250 insertions(+), 48 deletions(-)
docs/man/xl.pod.1 +4 -0
@@ -1093,6 +1093,10 @@ B<OPTIONS> Specify domain for which scheduler parameters are to be modified or retrieved. Mandatory for modifying scheduler parameters. +=item B<-v VCPUID/all>, B<--vcpuid=VCPUID/all> + +Specify vcpu for which scheduler parameters are to be modified or retrieved. + =item B<-p PERIOD>, B<--period=PERIOD> Period of time, in microseconds, over which to replenish the budget.
tools/libxl/xl_cmdimpl.c +240 -44
361 lines not on this page · raw message
tools/libxl/xl_cmdtable.c +6 -4
@@ -284,10 +284,12 @@ struct cmd_spec cmd_table[] = { {"sched-rtds" , &main_sched_rtds,0 ,1 ,"Get/set rtds scheduler parameters" , -"[-d <Domain> [-p[=PERIOD]] [-b[=BUDGET]]]" , -"-d DOMAIN, --domain=DOMAIN Domain to modify\n" -"-p PERIOD, --period=PERIOD Period (us)\n" -"-b BUDGET, --budget=BUDGET Budget (us)\n" +"[-d <Domain> [-v[=VCPUID]] [-p[=PERIOD]] [-b[=BUDGET]]]" , +"-d DOMAIN, --domain=DOMAIN Domain to modify\n" +"-v VCPUID/all, --vcpuid=VCPUID/all VCPU to modify or output;\n" +" Using '-v all' to modify/output all vcpus\n" +"-p PERIOD, --period=PERIOD Period (us)\n" +"-b BUDGET, --budget=BUDGET Budget (us)\n" }, { "domid", &main_domid, 0, 0,
Signature · 1 line
1.9.1
Re: [PATCH v3 for Xen 4.6 4/4] xl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 8 lines · Chong Li
Change
main_sched_rtdsand related output functions to support per-VCPU settings.Changes on PATCH v2:
1) Remove per-domain output functions for RTDS scheduler.
2) Users now use '-v all' to specify all VCPUs.
Quoted 8 lines
3) Support outputting a subset of the parameters of the VCPUs of a specific domain.
4) When setting all VCPUs with the same parameters (by only one command), no per-domain function is invoked.
Signed-off-by Chong Li <[email protected]>Signed-off-by Meng Xu <[email protected]>Signed-off-by Sisu Xi <[email protected]>
I think this patch is fine. I've asked already, when replying to the cover message, what happens if one uses just:
# xl sched-rtds
or
# xl sched-rtds -d vm1
and it looks to me that, instead of getting rid of sched_rtds_domain_output(), you can leave it there and make it respond to the above calls, with the effect of returning the default values, as agreed and implemented.
What do you think? If not done like this (and if I'm not missing something), is there a way to retrieve those values from xl?
Dario
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 for Xen 4.6 4/4] xl: enable per-VCPU parameter settings for RTDS scheduler
Quoted 22 lines · Dario Faggioli
Quoted 8 lines · Chong Li
Change
main_sched_rtdsand related output functions to support per-VCPU settings.Changes on PATCH v2:
1) Remove per-domain output functions for RTDS scheduler.
2) Users now use '-v all' to specify all VCPUs.
Quoted 8 lines
3) Support outputting a subset of the parameters of the VCPUs of a specific domain.
4) When setting all VCPUs with the same parameters (by only one command), no per-domain function is invoked.
Signed-off-by Chong Li <[email protected]>Signed-off-by Meng Xu <[email protected]>Signed-off-by Sisu Xi <[email protected]>I think this patch is fine. I've asked already, when replying to the cover message, what happens if one uses just:
# xl sched-rtds
Quoted 8 lines
or
# xl sched-rtds -d vm1and it looks to me that, instead of getting rid of
sched_rtds_domain_output(), you can leave it there and make it respond to the above calls, with the effect of returning the default values, as agreed and implemented.
I agree. I'll do that in the next version.
Chong
Quoted 7 lines
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)
Signature · 3 lines
Chong Li Department of Computer Science and Engineering Washington University in St.louis
Quoted 5 lines · Chong Li
[Usage]
With this patchset in use, xl sched-rtds tool can:1) show the budget and period of each VCPU of each domain, by using "xl sched-rtds -v all" command. An example would be like:
Ok. Thanks for this summary, and for including the actual output.
Quoted 11 lines
# xl sched-rtds -v all Cpupool Pool-0: sched=RTDS Name ID VCPU Period Budget Domain-0 0 0 10000 4000 vm1 1 0 300 150 vm1 1 1 400 200 vm1 1 2 10000 4000 vm1 1 3 1000 500 vm2 2 0 10000 4000 vm2 2 1 10000 4000
Right. What happens with just `xl sched-rtds'?
Quoted 11 lines
2) show the budget and period of each VCPU of a specific domain, by using, e.g., "xl sched-rtds -d vm1 -v all" command. The output would be like:
# xl sched-rtds -d vm1 -v all Name ID VCPU Period Budget vm1 1 0 300 150 vm1 1 1 400 200 vm1 1 2 10000 4000 vm1 1 3 1000 500
Same as above: what happens with just `xl sched-rtds -d vm1'?
Quoted 8 lines
To show a subset of the parameters of the VCPUs of a specific domain, please use, e.g.,"xl sched-rtds -d vm1 -v 0 -v 3" command. The output would be:
# xl sched-rtds -d vm1 -v 0 -v 3 Name ID VCPU Period Budget vm1 1 0 300 150 vm1 1 3 1000 500
Quoted 6 lines
3) Users can set the budget and period of multiple VCPUs of a specific domain with only one command, e.g., "xl sched-rtds -d vm1 -v 0 -p 100 -b 50 -v 3 -p 300 -b 150".
Users can set all VCPUs with the same parameters, by one command. e.g., "xl sched-rtds -d vm1 -v all -p 500 -b 250".
Forgive me for asking, as I really think it's rather obvious you've done this, but I guess you've stress tested this by feeding the various switches with arbitrary bad arguments, and checked that things do not explode?
If you've done it, then fine. It's not necessary that you include (all) the results of that too in here... I just wanted do double check because this is certainly not the easiest piece of interface we have in xl.
Anyway, I'll give it a go too.
Regards,
Dario
Quoted 39 lines
---
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>Chong Li (4):
xen: enable per-VCPU parameter settings for RTDS scheduler
libxc: enable per-VCPU parameter settings for RTDS scheduler
libxl: enable per-VCPU parameter settings for RTDS scheduler
xl: enable per-VCPU parameter settings for RTDS schedulerdocs/man/xl.pod.1 | 4 + tools/libxc/include/xenctrl.h | 9 ++ tools/libxc/xc_csched.c | 4 +- tools/libxc/xc_csched2.c | 4 +- tools/libxc/xc_rt.c | 64 +++++++++- tools/libxc/xc_sedf.c | 4 +- tools/libxl/libxl.c | 209 +++++++++++++++++++++++++++---- tools/libxl/libxl.h | 17 +++ tools/libxl/libxl_types.idl | 16 +++ tools/libxl/xl_cmdimpl.c | 284 +++++++++++++++++++++++++++++++++++------- tools/libxl/xl_cmdtable.c | 10 +- xen/common/Makefile | 1 - xen/common/domctl.c | 3 + xen/common/sched_credit.c | 14 +-- xen/common/sched_credit2.c | 6 +- xen/common/sched_rt.c | 80 +++++++++++- xen/common/schedule.c | 5 +- xen/include/public/domctl.h | 64 +++++++--- 18 files changed, 680 insertions(+), 118 deletions(-)
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 25 lines · Dario Faggioli
Quoted 5 lines · Chong Li
[Usage]
With this patchset in use, xl sched-rtds tool can:1) show the budget and period of each VCPU of each domain, by using "xl sched-rtds -v all" command. An example would be like:
Ok. Thanks for this summary, and for including the actual output.
Quoted 11 lines
# xl sched-rtds -v all Cpupool Pool-0: sched=RTDS Name ID VCPU Period Budget Domain-0 0 0 10000 4000 vm1 1 0 300 150 vm1 1 1 400 200 vm1 1 2 10000 4000 vm1 1 3 1000 500 vm2 2 0 10000 4000 vm2 2 1 10000 4000Right. What happens with just `xl sched-rtds'?
Quoted 4 lines
2) show the budget and period of each VCPU of a specific domain, by using, e.g., "xl sched-rtds -d vm1 -v all" command. The output would be like:
Quoted 8 lines
Quoted 7 lines
# xl sched-rtds -d vm1 -v all Name ID VCPU Period Budget vm1 1 0 300 150 vm1 1 1 400 200 vm1 1 2 10000 4000 vm1 1 3 1000 500Same as above: what happens with just `xl sched-rtds -d vm1'?
'xl sched-rtds ( -d vm1)' will return an error message. As you
suggested, I'll make it return per-domain default parameters in the next version.
Quoted 15 lines
Quoted 9 lines
To show a subset of the parameters of the VCPUs of a specific domain, please use, e.g.,"xl sched-rtds -d vm1 -v 0 -v 3" command. The output would be:
# xl sched-rtds -d vm1 -v 0 -v 3 Name ID VCPU Period Budget vm1 1 0 300 150 vm1 1 3 1000 500Quoted 6 lines
3) Users can set the budget and period of multiple VCPUs of a specific domain with only one command, e.g., "xl sched-rtds -d vm1 -v 0 -p 100 -b 50 -v 3 -p 300 -b 150".
Users can set all VCPUs with the same parameters, by one command. e.g., "xl sched-rtds -d vm1 -v all -p 500 -b 250".
Quoted 8 lines
Forgive me for asking, as I really think it's rather obvious you've done this, but I guess you've stress tested this by feeding the various switches with arbitrary bad arguments, and checked that things do not explode?
If you've done it, then fine. It's not necessary that you include (all) the results of that too in here... I just wanted do double check because this is certainly not the easiest piece of interface we have in xl.
Yes, I've done stress test.
Quoted 51 lines
Anyway, I'll give it a go too.
Regards,
DarioQuoted 30 lines
---
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>Chong Li (4):
xen: enable per-VCPU parameter settings for RTDS scheduler
libxc: enable per-VCPU parameter settings for RTDS scheduler
libxl: enable per-VCPU parameter settings for RTDS scheduler
xl: enable per-VCPU parameter settings for RTDS schedulerdocs/man/xl.pod.1 | 4 + tools/libxc/include/xenctrl.h | 9 ++ tools/libxc/xc_csched.c | 4 +- tools/libxc/xc_csched2.c | 4 +- tools/libxc/xc_rt.c | 64 +++++++++- tools/libxc/xc_sedf.c | 4 +- tools/libxl/libxl.c | 209 +++++++++++++++++++++++++++---- tools/libxl/libxl.h | 17 +++ tools/libxl/libxl_types.idl | 16 +++ tools/libxl/xl_cmdimpl.c | 284 +++++++++++++++++++++++++++++++++++------- tools/libxl/xl_cmdtable.c | 10 +-Quoted 9 lines
xen/common/Makefile | 1 - xen/common/domctl.c | 3 + xen/common/sched_credit.c | 14 +-- xen/common/sched_credit2.c | 6 +- xen/common/sched_rt.c | 80 +++++++++++- xen/common/schedule.c | 5 +- xen/include/public/domctl.h | 64 +++++++--- 18 files changed, 680 insertions(+), 118 deletions(-)--
<<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)
Signature · 3 lines
Chong Li Department of Computer Science and Engineering Washington University in St.louis