From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dieter Bloms Subject: Re: [Xen-users] xl doesn't honour the parameter cpu_weight from my config file while xm does honour it Date: Mon, 23 Apr 2012 11:46:23 +0200 Message-ID: <20120423094623.GA13565@bloms.de> References: <20120420150012.GB3720@bloms.de> <1334934791.28331.101.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="bg08WKrSYDhXBjb5" Return-path: Content-Disposition: inline In-Reply-To: <1334934791.28331.101.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "xen-users@lists.xen.org" , Dieter Bloms , xen-devel List-Id: xen-devel@lists.xenproject.org --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Ian, I've made a little patch to set the cpu_weight for credit, credit2 and sedf scheduler from the config file. Btw.: for the sedf scheduler there seems to be some type mismatch. =20 The functions xc_sedf_domain_set and xc_sedf_domain_get expect the type 'uint16_t' for variables 'extratime' and 'weight' while the structure 'xen_domctl_sched_sedf' defines the type uint32_t for them. I think they should be the same, or not ? Anyway, I've tested this patch for the credit scheduler and it works so far. On Fri, Apr 20, Ian Campbell wrote: > Hi Dieter,=20 >=20 > thanks for the report. >=20 > It seems that support for this config file variable is not present in xl > at the moment. We should try and add this for 4.2 IMHO. >=20 > If you know a little bit of C (or are interested in learning) then this > should be a pretty simple thing to implement -- please let me know if > you want more details. >=20 > Ian. >=20 > On Fri, 2012-04-20 at 16:00 +0100, Dieter Bloms wrote: > > Hi, > >=20 > > I've installed xen-unstable 4.2 from actual git (last commit was > > 4dc7dbef5400f0608321d579aebb57f933e8f707). > >=20 > > When I start a domU with xm all is fine include the cpu_weight I > > configured in my domU config. > >=20 > > When I start the domU with xl then all my domU have the default > > cpu_weight of 256 instead of the configured one. > >=20 > > Was the name of cpu_weight being changed for xl command ? > >=20 > > My domU config looks like this: > >=20 > > --snip-- > > name=3D"vdrserver" > > description=3D"vdrserver for my clients" > > memory=3D768 > > maxmem=3D2048 > > vcpus=3D1 > > cpus=3D"1" > > cpu_weight =3D 128 > > on_poweroff=3D"destroy" > > on_reboot=3D"restart" > > on_crash=3D"destroy" > >=20 > > localtime=3D0 > > keymap=3D"de" > >=20 > > builder=3D"linux" > > bootloader=3D"/usr/bin/pygrub" > > bootargs=3D"" > > extra=3D"console=3Dhvc0 tmem cgroup_disable=3Dmemory independent_wallcl= ock=3D1 iommu=3Dsoft" > > nographic=3D1 > > keymap =3D 'de' > >=20 > > disk=3D[=20 > > 'phy:/dev/mapper/xenimages-vdrserver,xvda1,w', > > 'phy:/dev/mapper/xenimages-swap_vdrserver,xvda2,w', > > ] > > vif=3D[ 'mac=3D00:00:00:00:00:80,bridge=3Dbr0', ] > >=20 > > pci =3D [ '06:00.0', '06:01.0', '00:12.2', '00:13.2'] > > --snip-- > >=20 > >=20 >=20 >=20 >=20 > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xen.org > http://lists.xen.org/xen-users --=20 Gru=DF Dieter -- I do not get viruses because I do not use MS software. If you use Outlook then please do not put my email address in your address-book so that WHEN you get a virus it won't use my address in the =46rom field. --bg08WKrSYDhXBjb5 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="add_support_for_cpu_weight_config_in_xl.diff" diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index e63c7bd..706e282 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -110,6 +110,10 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, return ERROR_INVAL; } + if (!b_info->weight) + b_info->weight = 256; + if (!b_info->cap) + b_info->cap = 0; if (!b_info->max_vcpus) b_info->max_vcpus = 1; if (!b_info->cur_vcpus) diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 0bdd654..f858a42 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -65,9 +65,38 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid, libxl_ctx *ctx = libxl__gc_owner(gc); int tsc_mode; char *xs_domid, *con_domid; + libxl_scheduler sched; + struct xen_domctl_scheduler_op sched_op; + xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus); libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap); xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT); + + sched = libxl_get_scheduler (ctx); + + switch (sched) { + case LIBXL_SCHEDULER_SEDF: + xc_sedf_domain_get (ctx->xch, domid, &(sched_op.u.sedf.period), &(sched_op.u.sedf.slice), &(sched_op.u.sedf.latency), (uint16_t *) &(sched_op.u.sedf.extratime), (uint16_t *) &(sched_op.u.sedf.weight)); + sched_op.u.sedf.weight = info->weight; + xc_sedf_domain_set (ctx->xch, domid, sched_op.u.sedf.period, sched_op.u.sedf.slice, sched_op.u.sedf.latency, (uint16_t) sched_op.u.sedf.extratime, (uint16_t) sched_op.u.sedf.weight); + break; + case LIBXL_SCHEDULER_CREDIT: +// struct xen_domctl_sched_credit sdom; + sched_op.u.credit.weight = info->weight; + sched_op.u.credit.cap = info->cap; + xc_sched_credit_domain_set(ctx->xch, domid, &(sched_op.u.credit)); + break; + case LIBXL_SCHEDULER_CREDIT2: + sched_op.u.credit2.weight = info->weight; + xc_sched_credit2_domain_set(ctx->xch, domid, &(sched_op.u.credit2)); + break; + case LIBXL_SCHEDULER_ARINC653: + /* not implemented */ + break; + default: + abort(); + } + if (info->type == LIBXL_DOMAIN_TYPE_PV) xc_domain_set_memmap_limit(ctx->xch, domid, (info->max_memkb + info->u.pv.slack_memkb)); diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 5cf9708..f185d4c 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -232,6 +232,8 @@ MemKB = UInt(64, init_val = "LIBXL_MEMKB_DEFAULT") libxl_domain_build_info = Struct("domain_build_info",[ ("max_vcpus", integer), ("cur_vcpus", integer), + ("weight", integer), + ("cap", integer), ("cpumap", libxl_cpumap), ("tsc_mode", libxl_tsc_mode), ("max_memkb", MemKB), diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 5703512..d7dcb84 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -587,6 +587,11 @@ static void parse_config_data(const char *configfile_filename_report, libxl_domain_build_info_init_type(b_info, c_info->type); /* the following is the actual config parsing with overriding values in the structures */ + if (!xlu_cfg_get_long (config, "cpu_weight", &l, 0)) + b_info->weight = l; + if (!xlu_cfg_get_long (config, "cap", &l, 0)) + b_info->cap = l; + if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) { b_info->max_vcpus = l; b_info->cur_vcpus = (1 << l) - 1; --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --bg08WKrSYDhXBjb5--