|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RFC v1 3/4] libxl for rt scheduler
On ven, 2014-07-11 at 00:49 -0400, Meng Xu wrote:
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> +static int sched_rt_domain_get(libxl__gc *gc, uint32_t domid,
> + libxl_domain_sched_params *scinfo)
> +{
> + struct xen_domctl_sched_rt_params sdom;
> + int rc, i;
> +
> + rc = xc_sched_rt_domain_get(CTX->xch, domid, &sdom);
> + if (rc != 0) {
> + LOGE(ERROR, "getting domain sched rt");
> + return ERROR_FAIL;
> + }
> +
> + libxl_domain_sched_params_init(scinfo);
> + scinfo->sched = LIBXL_SCHEDULER_RT;
> + scinfo->rt.max_vcpus = LIBXL_XEN_LEGACY_MAX_VCPUS;
> + /*TODO: alloc array with exact num of dom's vcpus; and use
> GCNEW_ARRAY()*/
>
Indeed. That, or just do an hypercall for each VCPU, at least as a first
step.
> + scinfo->rt.vcpus = (libxl_vcpu *)
> + malloc( sizeof(libxl_vcpu) * scinfo->rt.max_vcpus );
>
Yes, you said it yourself, I see: GCNEW_ARRAY() and no malloc() in
libxl.
> + if ( !scinfo->rt.vcpus ){
> + LOGE(ERROR, "Allocate lib_vcpu array fails\n");
> + return ERROR_INVAL;
> + }
> + scinfo->rt.num_vcpus = sdom.num_vcpus;
> + for( i = 0; i < sdom.num_vcpus; ++i)
> + {
> + scinfo->rt.vcpus[i].period = sdom.vcpus[i].period;
> + scinfo->rt.vcpus[i].budget = sdom.vcpus[i].budget;
> + }
> +
> + return 0;
> +}
> +
> +#define SCHED_RT_VCPU_PARAMS_MAX 4294967295 /* 2^32-1 */
> +
I don't like the name. I'd go for something like
SCHED_RT_VCPU_PERIOD_MAX and SCHED_RT_VCPU_BUDGET_MAX.
You well can define both to the same value, of course.
As per the value, yes, even if we turn the interface in usecs, 2^32
usecs is still ~4000 secs, which ought to be enough as a period or
budget for everyone! :-)
For the rest of this file, I think I'll wait for v2, as the interface is
subject to be changed.
Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
Attachment:
signature.asc _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |