From: Dieter Bloms <dieter@bloms.de>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "xen-users@lists.xen.org" <xen-users@lists.xen.org>,
Dieter Bloms <xensource.com@bloms.de>,
xen-devel <xen-devel@lists.xen.org>
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 [thread overview]
Message-ID: <20120423094623.GA13565@bloms.de> (raw)
In-Reply-To: <1334934791.28331.101.camel@zakaz.uk.xensource.com>
[-- Attachment #1: Type: text/plain, Size: 2644 bytes --]
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.
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,
>
> thanks for the report.
>
> 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.
>
> 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.
>
> Ian.
>
> On Fri, 2012-04-20 at 16:00 +0100, Dieter Bloms wrote:
> > Hi,
> >
> > I've installed xen-unstable 4.2 from actual git (last commit was
> > 4dc7dbef5400f0608321d579aebb57f933e8f707).
> >
> > When I start a domU with xm all is fine include the cpu_weight I
> > configured in my domU config.
> >
> > When I start the domU with xl then all my domU have the default
> > cpu_weight of 256 instead of the configured one.
> >
> > Was the name of cpu_weight being changed for xl command ?
> >
> > My domU config looks like this:
> >
> > --snip--
> > name="vdrserver"
> > description="vdrserver for my clients"
> > memory=768
> > maxmem=2048
> > vcpus=1
> > cpus="1"
> > cpu_weight = 128
> > on_poweroff="destroy"
> > on_reboot="restart"
> > on_crash="destroy"
> >
> > localtime=0
> > keymap="de"
> >
> > builder="linux"
> > bootloader="/usr/bin/pygrub"
> > bootargs=""
> > extra="console=hvc0 tmem cgroup_disable=memory independent_wallclock=1 iommu=soft"
> > nographic=1
> > keymap = 'de'
> >
> > disk=[
> > 'phy:/dev/mapper/xenimages-vdrserver,xvda1,w',
> > 'phy:/dev/mapper/xenimages-swap_vdrserver,xvda2,w',
> > ]
> > vif=[ 'mac=00:00:00:00:00:80,bridge=br0', ]
> >
> > pci = [ '06:00.0', '06:01.0', '00:12.2', '00:13.2']
> > --snip--
> >
> >
>
>
>
> _______________________________________________
> Xen-users mailing list
> Xen-users@lists.xen.org
> http://lists.xen.org/xen-users
--
Gruß
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
From field.
[-- Attachment #2: add_support_for_cpu_weight_config_in_xl.diff --]
[-- Type: text/x-diff, Size: 3621 bytes --]
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;
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2012-04-23 9:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20120420150012.GB3720@bloms.de>
2012-04-20 15:13 ` [Xen-users] xl doesn't honour the parameter cpu_weight from my config file while xm does honour it Ian Campbell
2012-04-20 15:23 ` Dieter Bloms
2012-04-23 9:46 ` Dieter Bloms [this message]
2012-04-23 12:04 ` Ian Campbell
2012-04-23 14:22 ` Dario Faggioli
2012-04-23 15:41 ` Dieter Bloms
2012-04-23 16:07 ` Dario Faggioli
2012-04-23 19:35 ` Dieter Bloms
2012-04-24 6:05 ` Dario Faggioli
2012-04-24 12:14 ` Dieter Bloms
2012-04-24 13:09 ` Ian Campbell
2012-04-24 14:33 ` Dieter Bloms
2012-04-24 14:51 ` Ian Campbell
2012-04-24 16:03 ` Ian Jackson
2012-04-24 16:15 ` Ian Campbell
2012-04-24 16:20 ` Ian Jackson
2012-04-24 16:27 ` Ian Campbell
2012-04-24 18:26 ` Dieter Bloms
2012-04-24 19:35 ` Dieter Bloms
2012-04-25 9:07 ` Ian Campbell
2012-04-25 10:40 ` Ian Jackson
2012-04-24 13:24 ` Ian Jackson
2012-04-24 13:27 ` Ian Campbell
2012-04-24 13:33 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120423094623.GA13565@bloms.de \
--to=dieter@bloms.de \
--cc=Ian.Campbell@citrix.com \
--cc=xen-devel@lists.xen.org \
--cc=xen-users@lists.xen.org \
--cc=xensource.com@bloms.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.