All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix xm sched-sedf command to show a error message
@ 2007-02-19  9:15 Masaki Kanno
  0 siblings, 0 replies; only message in thread
From: Masaki Kanno @ 2007-02-19  9:15 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 2350 bytes --]

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


Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>

Best regards,
 Kan


[-- Attachment #2: xm_sched-sedf.patch --]
[-- Type: application/octet-stream, Size: 2394 bytes --]

diff -r b5fc88aad1b0 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Sun Feb 18 15:29:40 2007 +0000
+++ b/xen/common/sched_credit.c	Mon Feb 19 14:05:49 2007 +0900
@@ -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)
diff -r b5fc88aad1b0 xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c	Sun Feb 18 15:29:40 2007 +0000
+++ b/xen/common/sched_sedf.c	Mon Feb 19 14:05:49 2007 +0900
@@ -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;
 
diff -r b5fc88aad1b0 xen/common/schedule.c
--- a/xen/common/schedule.c	Sun Feb 18 15:29:40 2007 +0000
+++ b/xen/common/schedule.c	Mon Feb 19 14:08:16 2007 +0900
@@ -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;
 }
 
 /* 
diff -r b5fc88aad1b0 xen/include/xen/sched-if.h
--- a/xen/include/xen/sched-if.h	Sun Feb 18 15:29:40 2007 +0000
+++ b/xen/include/xen/sched-if.h	Mon Feb 19 14:05:49 2007 +0900
@@ -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);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-19  9:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-19  9:15 [PATCH] Fix xm sched-sedf command to show a error message Masaki Kanno

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.