Skip to contentSkip to conversation

Fix xm sched-sedf command to show a error message

PATCH Superseded Masaki Kanno 1 participant 1 message Feb 19, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix xm sched-sedf command to show a error message

Hi,

I tested the xm sched-sedf command with a wrong scheduler parameter. It did not show a error message though it did not change the scheduler parameter. (as follows)

# xm sched-sedf
Name                              ID Period(ms) Slice(ms) Lat(ms) Extra Weight
Domain-0                           0      20.0      15.0     0.0      1      0
vm1                                2     100.0       0.0     0.0      1      0
# xm sched-sedf vm1 -p 200.0
# xm sched-sedf
Name                              ID Period(ms) Slice(ms) Lat(ms) Extra Weight
Domain-0                           0      20.0      15.0     0.0      1      0
vm1                                2     100.0       0.0     0.0      1      0

I investigated the cause that the error message is not shown. The cause is in sched_adjust(). sched_adjust() ignores the value that sedf_adjust() returns, and always returns zero.

This patch fixes sched_adjust(). sched_adjust() receives the value that sedf_adjust() returns, and returns it to do_domctl().
The test result of this patch is as follows.

# xm sched-sedf
Name                              ID Period(ms) Slice(ms) Lat(ms) Extra Weight
Domain-0                           0      20.0      15.0     0.0      1      0
vm1                                1     100.0       0.0     0.0      1      0
# xm sched-sedf vm1 -p 200.0
Error: (22, 'Invalid argument')
Usage: xm sched-sedf <Domain> [options]

Get/set EDF parameters.
-p [MS], --period[=MS] Relative deadline(ms)
-s [MS], --slice[=MS] Worst-case execution time(ms). (slice <
period)
-l [MS], --latency[=MS] Scaled period (ms) when domain performs
heavy I/O
-e [FLAG], --extra[=FLAG] Flag (0 or 1) controls if domain can run
in extra time.
-w [FLOAT], --weight[=FLOAT] CPU Period/slice (do not set with

                                 --period/--slice)
# xm sched-sedf
Name                              ID Period(ms) Slice(ms) Lat(ms) Extra Weight
Domain-0                           0      20.0      15.0     0.0      1      0
vm1                                1     100.0       0.0     0.0      1      0

Best regards,
Kan

xen/common/sched_credit.c +1 -1
diff -r b5fc88aad1b0 xen/common/sched_credit.c
@@ -695,7 +695,7 @@ csched_vcpu_wake(struct vcpu *vc)
     __runq_tickle(cpu, svc);
 }
 
-static int
+static long
 csched_dom_cntl(
     struct domain *d,
     struct xen_domctl_scheduler_op *op)
xen/common/sched_sedf.c +1 -1
diff -r b5fc88aad1b0 xen/common/sched_sedf.c
@@ -1347,7 +1347,7 @@ static int sedf_adjust_weights(struct xe
 
 
 /* set or fetch domain scheduling parameters */
-static int sedf_adjust(struct domain *p, struct xen_domctl_scheduler_op *op)
+static long sedf_adjust(struct domain *p, struct xen_domctl_scheduler_op *op)
 {
     struct vcpu *v;
 
xen/common/schedule.c +4 -3
diff -r b5fc88aad1b0 xen/common/schedule.c
@@ -497,6 +497,7 @@ long sched_adjust(struct domain *d, stru
 long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op)
 {
     struct vcpu *v;
+    long ret;
     
     if ( (op->sched_id != ops.sched_id) ||
          ((op->cmd != XEN_DOMCTL_SCHEDOP_putinfo) &&
@@ -525,8 +526,8 @@ long sched_adjust(struct domain *d, stru
     if ( d == current->domain )
         vcpu_schedule_lock_irq(current);
 
-    SCHED_OP(adjust, d, op);
-    TRACE_1D(TRC_SCHED_ADJDOM, d->domain_id);
+    if ( (ret = SCHED_OP(adjust, d, op)) == 0 )
+        TRACE_1D(TRC_SCHED_ADJDOM, d->domain_id);
 
     if ( d == current->domain )
         vcpu_schedule_unlock_irq(current);
@@ -537,7 +538,7 @@ long sched_adjust(struct domain *d, stru
             vcpu_unpause(v);
     }
 
-    return 0;
+    return ret;
 }
 
 /* 
xen/include/xen/sched-if.h +1 -1
diff -r b5fc88aad1b0 xen/include/xen/sched-if.h
@@ -75,7 +75,7 @@ struct scheduler {
     struct task_slice (*do_schedule) (s_time_t);
 
     int          (*pick_cpu)       (struct vcpu *);
-    int          (*adjust)         (struct domain *,
+    long         (*adjust)         (struct domain *,
                                     struct xen_domctl_scheduler_op *);
     void         (*dump_settings)  (void);
     void         (*dump_cpu_state) (int);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel