Whenever the slice of a domU is set to 0, sedf_adjdom() sets extraweight

to 0.  Later, in desched_extra_dom(), if the extrawight is not set, the
vcpu's score is calculated with this:

 /*domain was running in L1 extraq => score is inverse of
   utilization and is used somewhat incremental!*/
   if ( !inf->extraweight )
       /*NB: use fixed point arithmetic with 10 bits*/
       inf->score[EXTRA_UTIL_Q] = (inf->period << 10) /
           inf->slice;

Which can result in a divide by zero.

This changeset adds a comments and additional sanity check to prevent this
case from crashing Xen.

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2006-02-23 11:31:01 +01:00
1 parent 2b3ef497e8
commit 224d655aba
1 file changed
+8 -4
+8 -4
View File
@@ -1609,15 +1609,19 @@ static int sedf_adjdom(struct domain *p, struct sched_adjdom_cmd *cmd)
else {
/*time driven domains*/
for_each_vcpu(p, v) {
/* sanity checking! */
if(cmd->u.sedf.slice > cmd->u.sedf.period )
/*
* Sanity checking: note that disabling extra weight requires
* that we set a non-zero slice.
*/
if ( (cmd->u.sedf.slice == 0) ||
(cmd->u.sedf.slice > cmd->u.sedf.period) )
return -EINVAL;
EDOM_INFO(v)->weight = 0;
EDOM_INFO(v)->extraweight = 0;
EDOM_INFO(v)->period_orig =
EDOM_INFO(v)->period = cmd->u.sedf.period;
EDOM_INFO(v)->period = cmd->u.sedf.period;
EDOM_INFO(v)->slice_orig =
EDOM_INFO(v)->slice = cmd->u.sedf.slice;
EDOM_INFO(v)->slice = cmd->u.sedf.slice;
}
}
if (sedf_adjust_weights(cmd))
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.