WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] xen: fix empty slice bug in sedf_adjdom()

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.

The attached patch adds a comments and additional sanity check to
prevent this case from crashing Xen.


-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@xxxxxxxxxx

diffstat output:
 sched_sedf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
diff -r 697fac283c9e xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c   Wed Feb 22 19:11:23 2006
+++ b/xen/common/sched_sedf.c   Wed Feb 22 15:02:21 2006
@@ -1610,10 +1610,10 @@
             /*time driven domains*/
             for_each_vcpu(p, v) {
                 /* sanity checking! */
-                if(cmd->u.sedf.slice > cmd->u.sedf.period )
+                if(!cmd->u.sedf.slice || cmd->u.sedf.slice > 
cmd->u.sedf.period)
                     return -EINVAL;
                 EDOM_INFO(v)->weight = 0;
-                EDOM_INFO(v)->extraweight = 0;
+                EDOM_INFO(v)->extraweight = 0; /* disabling extra weight 
requires non-zere slice */
                 EDOM_INFO(v)->period_orig = 
                     EDOM_INFO(v)->period   = cmd->u.sedf.period;
                 EDOM_INFO(v)->slice_orig  = 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>