Skip to contentSkip to conversation

Add a global parameter adjustment to the switchable scheduler interface

RFC PATCH In review George Dunlap 4 participants 5 messages May 4, 2010 – May 5, 2010

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Add a global parameter adjustment to the switchable scheduler interface

...along with a new DOMCTL to call it directly. This is in order to support DornerWorks' new
ARINC653 scheduler.

A couple of notes:
* Modifies DOMCTL interface to overload the domid parameter for a cpupool parameter
* Adds cpupool_scheduler_from_pool_id() to cpupool interface

Based on code from Josh Holtrop and Kathy Hadley at DornerWorks, Ltd

Add a global parameter adjustment to the switchable scheduler interface ...along with a new DOMCTL to call it directly. This is in order to support DornerWorks' new ARINC653 scheduler.

A couple of notes:
* Modifies DOMCTL interface to overload the domid parameter for a cpupool parameter
* Adds cpupool_scheduler_from_pool_id() to cpupool interface

Based on code from Josh Holtrop and Kathy Hadley at DornerWorks, Ltd

xen/common/domctl.c +25 -12
diff -r 0aa4bb55fbb5 xen/common/domctl.c
@@ -597,22 +597,35 @@
 
     case XEN_DOMCTL_scheduler_op:
     {
-        struct domain *d;
+        if ( (op->u.scheduler_op.cmd == XEN_DOMCTL_SCHEDOP_put_global_info)
+          || (op->u.scheduler_op.cmd == XEN_DOMCTL_SCHEDOP_get_global_info) )
+        {
+            ret = sched_adjust_global(op->poolid, &op->u.scheduler_op);
+            if (op->u.scheduler_op.cmd == XEN_DOMCTL_SCHEDOP_get_global_info)
+            {
+                if ( copy_to_guest(u_domctl, op, 1) )
+                    ret = -EFAULT;
+            }
+        }
+        else
+        {
+            struct domain *d;
 
-        ret = -ESRCH;
-        if ( (d = rcu_lock_domain_by_id(op->domain)) == NULL )
-            break;
+            ret = -ESRCH;
+            if ( (d = rcu_lock_domain_by_id(op->domain)) == NULL )
+                break;
 
-        ret = xsm_scheduler(d);
-        if ( ret )
-            goto scheduler_op_out;
+            ret = xsm_scheduler(d);
+            if ( ret )
+                goto scheduler_op_out;
 
-        ret = sched_adjust(d, &op->u.scheduler_op);
-        if ( copy_to_guest(u_domctl, op, 1) )
-            ret = -EFAULT;
+            ret = sched_adjust(d, &op->u.scheduler_op);
+            if ( copy_to_guest(u_domctl, op, 1) )
+                ret = -EFAULT;
 
-    scheduler_op_out:
-        rcu_unlock_domain(d);
+        scheduler_op_out:
+            rcu_unlock_domain(d);
+        }
     }
     break;
 
xen/common/sched_credit.c +1 -0
diff -r 0aa4bb55fbb5 xen/common/sched_credit.c
@@ -1564,6 +1564,7 @@
     .wake           = csched_vcpu_wake,
 
     .adjust         = csched_dom_cntl,
+    .adjust_global  = NULL,
 
     .pick_cpu       = csched_cpu_pick,
     .do_schedule    = csched_schedule,
xen/common/sched_sedf.c +1 -0
diff -r 0aa4bb55fbb5 xen/common/sched_sedf.c
@@ -1518,6 +1518,7 @@
     .sleep          = sedf_sleep,
     .wake           = sedf_wake,
     .adjust         = sedf_adjust,
+    .adjust_global  = NULL,
 };
 
 /*
xen/common/schedule.c +21 -0
diff -r 0aa4bb55fbb5 xen/common/schedule.c
@@ -881,6 +881,27 @@
     return ret;
 }
 
+/* Adjust scheduling parameters globally */
+long sched_adjust_global(int poolid, struct xen_domctl_scheduler_op *op)
+{
+    long ret;
+    struct scheduler * sched;
+
+    if ( (op->sched_id != ops.sched_id)
+      || ( (op->cmd != XEN_DOMCTL_SCHEDOP_put_global_info)
+        && (op->cmd != XEN_DOMCTL_SCHEDOP_get_global_info) ) )
+        return -EINVAL;
+
+    sched = cpupool_scheduler_by_pool_id(poolid);
+
+    if ( sched == NULL )
+        return -ESRCH;
+
+    ret = SCHED_OP(sched, adjust_global, op);
+
+    return ret;
+}
+
 static void vcpu_periodic_timer_work(struct vcpu *v)
 {
     s_time_t now = NOW();
xen/include/public/domctl.h +6 -1
diff -r 0aa4bb55fbb5 xen/include/public/domctl.h
@@ -308,6 +308,8 @@
 /* Set or get info? */
 #define XEN_DOMCTL_SCHEDOP_putinfo 0
 #define XEN_DOMCTL_SCHEDOP_getinfo 1
+#define XEN_DOMCTL_SCHEDOP_put_global_info 2
+#define XEN_DOMCTL_SCHEDOP_get_global_info 3
 struct xen_domctl_scheduler_op {
     uint32_t sched_id;  /* XEN_SCHEDULER_* */
     uint32_t cmd;       /* XEN_DOMCTL_SCHEDOP_* */
@@ -877,7 +879,10 @@
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
 #define XEN_DOMCTL_gdbsx_domstatus             1003
     uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
-    domid_t  domain;
+    union {
+        domid_t  domain;
+        uint16_t poolid;
+    };
     union {
         struct xen_domctl_createdomain      createdomain;
         struct xen_domctl_getdomaininfo     getdomaininfo;
xen/include/xen/sched-if.h +2 -0
diff -r 0aa4bb55fbb5 xen/include/xen/sched-if.h
@@ -115,6 +115,8 @@
     int          (*pick_cpu)       (struct scheduler *, struct vcpu *);
     int          (*adjust)         (struct scheduler *, struct domain *,
                                     struct xen_domctl_scheduler_op *);
+    int          (*adjust_global)  (struct scheduler *,
+                                    struct xen_domctl_scheduler_op *);
     void         (*dump_settings)  (struct scheduler *);
     void         (*dump_cpu_state) (struct scheduler *, int);
 
xen/include/xen/sched.h +1 -0
diff -r 0aa4bb55fbb5 xen/include/xen/sched.h
@@ -468,6 +468,7 @@
 void sched_destroy_domain(struct domain *d);
 int sched_move_domain(struct domain *d, struct cpupool *c);
 long sched_adjust(struct domain *, struct xen_domctl_scheduler_op *);
+long sched_adjust_global(int poolid, struct xen_domctl_scheduler_op *);
 int  sched_id(void);
 void sched_tick_suspend(void);
 void sched_tick_resume(void);

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

#1 lore raw

I decided the new commands should be sysctl. As should the cpupool commands, so I moved those. A modified version of this patch is checked in as xen-unstable:21282.

-- Keir

Quoted 12 lines · George Dunlap

...along with a new DOMCTL to call it directly. This is in order to support DornerWorks' new
ARINC653 scheduler.

A couple of notes:
* Modifies DOMCTL interface to overload the domid parameter for a cpupool parameter
* Adds cpupool_scheduler_from_pool_id() to cpupool interface

Based on code from Josh Holtrop and Kathy Hadley at DornerWorks, Ltd

#2 lore raw

Keir & George,
Thank you for your help with this. I will work on modifying my other
patch (for the ARINC 653 scheduler) to reflect these changes and other comments received.

I just checked the mercurial repository for xen-unstable. The latest
changeset I see is 21278 (23 hours ago). I'm not familiar with mercurial - when will I be able to see the changes that Keir checked in?

Thank you,
Kathy Hadley
DornerWorks, Ltd.

Quoted 4 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Tuesday, May 04, 2010 5:52 PM
To: George Dunlap; [email protected]; Kathy Hadley;

Juergen

Quoted 26 lines

Gross
Subject: Re: [PATCH] [RFC] Add a global parameter adjustment to the switchable scheduler interface

I decided the new commands should be sysctl. As should the cpupool commands,
so I moved those. A modified version of this patch is checked in as xen-unstable:21282.

-- Keir

Quoted 12 lines · George Dunlap

...along with a new DOMCTL to call it directly. This is in order to support DornerWorks' new
ARINC653 scheduler.

A couple of notes:
* Modifies DOMCTL interface to overload the domid parameter for a cpupool parameter
* Adds cpupool_scheduler_from_pool_id() to cpupool interface

Based on code from Josh Holtrop and Kathy Hadley at DornerWorks, Ltd

#3 lore raw

It's not to do with mercurial; it's to do with our setup. There's an internal repository that Keir submits to. I believe that goes through some basic testing (like, "does it compile"), before being automatically pushed to the public repository (which is what you see).
Usually it doesn't take that long, unless something is broken. If
you still don't have it by tomorrow, something's definitely wrong.

-George

Quoted 51 lines · Kathy Hadley

Keir & George,
 Thank you for your help with this.  I will work on modifying my other patch (for the ARINC 653 scheduler) to reflect these changes and other comments received.

 I just checked the mercurial repository for xen-unstable.  The latest changeset I see is 21278 (23 hours ago).  I'm not familiar with mercurial - when will I be able to see the changes that Keir checked in?

 Thank you,
Kathy Hadley
DornerWorks, Ltd.

Quoted 4 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Tuesday, May 04, 2010 5:52 PM
To: George Dunlap; [email protected]; Kathy Hadley;

Juergen

Quoted 4 lines

Gross
Subject: Re: [PATCH] [RFC] Add a global parameter adjustment to the switchable scheduler interface

Quoted 22 lines

I decided the new commands should be sysctl. As should the cpupool commands,
so I moved those. A modified version of this patch is checked in as xen-unstable:21282.

 -- Keir

Quoted 12 lines · George Dunlap

...along with a new DOMCTL to call it directly.  This is in order to support DornerWorks' new
ARINC653 scheduler.

A couple of notes:
* Modifies DOMCTL interface to overload the domid parameter for a cpupool parameter
* Adds cpupool_scheduler_from_pool_id() to cpupool interface

Based on code from Josh Holtrop and Kathy Hadley at DornerWorks, Ltd

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

#4 lore raw

You can pick up the internal tree from
http://xenbits.xensource.com/staging/xen-unstable.hg

-- Keir

Quoted 67 lines · George Dunlap

It's not to do with mercurial; it's to do with our setup. There's an internal repository that Keir submits to. I believe that goes through some basic testing (like, "does it compile"), before being automatically pushed to the public repository (which is what you see).
Usually it doesn't take that long, unless something is broken. If
you still don't have it by tomorrow, something's definitely wrong.

-George

Quoted 42 lines · Kathy Hadley

Keir & George,
 Thank you for your help with this.  I will work on modifying my other patch (for the ARINC 653 scheduler) to reflect these changes and other comments received.

 I just checked the mercurial repository for xen-unstable.  The latest changeset I see is 21278 (23 hours ago).  I'm not familiar with mercurial - when will I be able to see the changes that Keir checked in?

 Thank you,
Kathy Hadley
DornerWorks, Ltd.

Quoted 4 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Tuesday, May 04, 2010 5:52 PM
To: George Dunlap; [email protected]; Kathy Hadley;

Juergen

Quoted 24 lines

Gross
Subject: Re: [PATCH] [RFC] Add a global parameter adjustment to the switchable scheduler interface

I decided the new commands should be sysctl. As should the cpupool commands,
so I moved those. A modified version of this patch is checked in as xen-unstable:21282.

 -- Keir

Quoted 11 lines · George Dunlap

...along with a new DOMCTL to call it directly.  This is in order to support DornerWorks' new
ARINC653 scheduler.

A couple of notes:
* Modifies DOMCTL interface to overload the domid parameter for a cpupool parameter
* Adds cpupool_scheduler_from_pool_id() to cpupool interface

Based on code from Josh Holtrop and Kathy Hadley at DornerWorks, Ltd

Quoted 9 lines
Quoted 2 lines
Quoted 1 line

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

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