[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xen-devel] [PATCH] xl: fix sedf parameters checking
- To: xen-devel@xxxxxxxxxxxxx
- From: Dario Faggioli <raistlin@xxxxxxxx>
- Date: Wed, 20 Jun 2012 19:09:56 +0200
- Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, "Keir \(Xen.org\)" <keir@xxxxxxx>, Ian Campbell <Ian.Campbell@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
- Delivery-date: Wed, 20 Jun 2012 17:10:17 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:content-transfer-encoding:subject :x-mercurial-node:message-id:user-agent:date:from:to:cc; bh=69QkJrXpS6qZAUBqpmKdXGGs+hvJKcQDbJNSTfT4kdA=; b=XZFTCHHRrmdEHETM9cTRZ8jmkgWHcRkq7AltosNTqzx12DlpEIr55uzYOoptarqy4a P96RVItkewT7nzhrPuslvI2H8rai7paImU8OO6DO8WDDnq2evTQIz+06dffMebeyd2r1 N3JIYfp96lUF6EkgE0unc/P4mcIaRJq7trr7bi6ZG6x7Lqs9DD1PZ+H9i0R3V8MyA/k3 rONCJWex+Kjfy+ImKoQdyab9I8Q3u2ltwQCSAPqX1cJFrluJ4jvtOGGeWnpXY7L00vfc mRS11ua3+am8Ha8Usaxi3HgqPgJaAW3YJyxtw3L/7lBVUYwTvUQPSyS7BSH/gJmypzZl Xsyw==
- List-id: Xen developer discussion <xen-devel.lists.xen.org>
9d1fd58ff602 was bogous in not letting a new domain being created
if its scheduling parameters --when running under the sedf scheduler--
were not fully specified, making creation fail like in this example
here below:
2012-06-16 07:37:47 Z executing ssh ... root@xxxxxxxxxxxxx xl create
/etc/xen/debian.guest.osstest.cfg
libxl: error: libxl.c:3619:sched_sedf_domain_set: setting domain sched sedf:
Invalid argument
libxl: error: libxl_create.c:710:domcreate_bootloader_done: cannot (re-)build
domain: -3
Parsing config from /etc/xen/debian.guest.osstest.cfg
This is due to the fact the values for period, slice, weight and
extratime should be consistent among each others, and if not all
are explicitly specified, someone has to make that happen. That
was right the purpose of the change in question, but it was failing
at achieving so.
This commit fixes things by forcing unspecified parameters to
sensible values, depending on the ones the user provided.
Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxx>
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -555,6 +555,8 @@ static int sched_params_valid(libxl_doma
int has_weight = scp->weight != LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT;
int has_period = scp->period != LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT;
int has_slice = scp->slice != LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT;
+ int has_extratime =
+ scp->extratime != LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT;
libxl_domain_sched_params sci;
libxl_domain_sched_params_get(ctx, domid, &sci);
@@ -563,12 +565,27 @@ static int sched_params_valid(libxl_doma
if (sci.sched == LIBXL_SCHEDULER_SEDF) {
if (has_weight && (has_period || has_slice))
return 0;
-
+ if (has_period != has_slice)
+ return 0;
+
+ /*
+ * Idea is, if we specify a weight, then both period and
+ * slice has to be zero. OTOH, if we do not specify a weight,
+ * that means we want a pure best effort domain or an actual
+ * real-time one. In the former case, it is period that needs
+ * to be zero, in the latter, weight should be.
+ */
if (has_weight) {
scp->slice = 0;
scp->period = 0;
}
- if (has_period || has_slice)
+ else if (!has_period) {
+ /* We can setup a proper best effort domain (extra time only)
+ * iff we either already have or are asking for some extra time. */
+ scp->weight = has_extratime ? scp->extratime : sci.extratime;
+ scp->period = 0;
+ }
+ if (has_period && has_slice)
scp->weight = 0;
}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel