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] 1/4 "nemesis" scheduling domains for Xen

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] 1/4 "nemesis" scheduling domains for Xen
From: "Mike D. Day" <ncmike@xxxxxxxxxx>
Date: Fri, 4 May 2007 18:21:27 -0400
Delivery-date: Fri, 04 May 2007 15:20:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
Reply-to: ncmike@xxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.13 (2006-08-11)
Implement a new domctl sub-operation to control scheduling
domains. The sub-op is hanged off the domctl-scheduling hypercall.
signed-off-by: Mike D. Day <ncmike@xxxxxxxxxx>

--

common/domctl.c         |   18 +++++++++++-------
common/schedule.c       |    8 ++++++++
include/public/domctl.h |   28 ++++++++++++++++++++++++++++
include/xen/sched-if.h  |    1 +
include/xen/sched.h     |    1 +
5 files changed, 49 insertions(+), 7 deletions(-)

--

diff -r 0f9b97523450 xen/common/domctl.c
--- a/xen/common/domctl.c       Sat Apr 28 09:44:24 2007 +0100
+++ b/xen/common/domctl.c       Fri May 04 17:52:18 2007 -0400
@@ -447,15 +447,19 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
    {
        struct domain *d;

-        ret = -ESRCH;
-        if ( (d = rcu_lock_domain_by_id(op->domain)) == NULL )
-            break;
-
-        ret = sched_adjust(d, &op->u.scheduler_op);
+        if (op->u.scheduler_op.cmd == XEN_DOMCTL_SCHEDOP_sdom)
+            ret = sched_sdom_op(&op->u.scheduler_op.u.sdom);
+        else
+        {
+            ret = -ESRCH;
+            if ( (d = rcu_lock_domain_by_id(op->domain)) == NULL )
+                break;
+            ret = sched_adjust(d, &op->u.scheduler_op);
+            rcu_unlock_domain(d);
+        }
+
        if ( copy_to_guest(u_domctl, op, 1) )
            ret = -EFAULT;
-
-        rcu_unlock_domain(d);
    }
    break;

diff -r 0f9b97523450 xen/common/schedule.c
--- a/xen/common/schedule.c     Sat Apr 28 09:44:24 2007 +0100
+++ b/xen/common/schedule.c     Fri May 04 11:21:36 2007 -0400
@@ -530,6 +530,14 @@ int sched_id(void)
    return ops.sched_id;
}

+int  sched_sdom_op(struct xen_domctl_sdom *op)
+{
+    if (ops.sdom_op)
+        return ops.sdom_op(op);
+    return -EINVAL;
+}
+
+
/* Adjust scheduling parameter for a given domain. */
long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op)
{
diff -r 0f9b97523450 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Sat Apr 28 09:44:24 2007 +0100
+++ b/xen/include/public/domctl.h       Fri May 04 17:51:11 2007 -0400
@@ -291,6 +291,26 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_v
/* Set or get info? */
#define XEN_DOMCTL_SCHEDOP_putinfo 0
#define XEN_DOMCTL_SCHEDOP_getinfo 1
+#define XEN_DOMCTL_SCHEDOP_sdom    2
+
+#define SDOM_get_flags             1
+#define SDOM_get_sdom              2
+#define SDOM_del_adom              3
+#define SDOM_add_adom              4
+
+/* flags for nemesis-sytle scheduling domains */
+#define SDOM_INACTIVE  0L
+#define SDOM_ACTIVE     1
+#define SDOM_IS_ADOM    (SDOM_ACTIVE << 1)
+
+/* reason codes for u.sdom.reason */
+#define SDOM_err_no_reason     0
+#define SDOM_err_already_adom  1
+#define SDOM_err_already_sdom  2
+#define SDOM_err_same_id       3
+#define SDOM_err_not_adom      4
+#define SDOM_err_inval         5
+
struct xen_domctl_scheduler_op {
    uint32_t sched_id;  /* XEN_SCHEDULER_* */
    uint32_t cmd;       /* XEN_DOMCTL_SCHEDOP_* */
@@ -306,6 +326,14 @@ struct xen_domctl_scheduler_op {
            uint16_t weight;
            uint16_t cap;
        } credit;
+        struct xen_domctl_sdom
+        {
+            uint16_t op;
+            uint16_t reason;
+            uint32_t flags;
+            domid_t sdom;
+            domid_t adom;
+        } sdom __attribute__ ((aligned));
    } u;
};
typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
diff -r 0f9b97523450 xen/include/xen/sched-if.h
--- a/xen/include/xen/sched-if.h        Sat Apr 28 09:44:24 2007 +0100
+++ b/xen/include/xen/sched-if.h        Fri May 04 11:21:36 2007 -0400
@@ -73,6 +73,7 @@ struct scheduler {
    struct task_slice (*do_schedule) (s_time_t);

    int          (*pick_cpu)       (struct vcpu *);
+    int          (*sdom_op)        (struct xen_domctl_sdom *);
    int          (*adjust)         (struct domain *,
                                    struct xen_domctl_scheduler_op *);
    void         (*dump_settings)  (void);
diff -r 0f9b97523450 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Sat Apr 28 09:44:24 2007 +0100
+++ b/xen/include/xen/sched.h   Fri May 04 11:21:36 2007 -0400
@@ -370,6 +370,7 @@ void sched_destroy_vcpu(struct vcpu *v);
void sched_destroy_vcpu(struct vcpu *v);
int  sched_init_domain(struct domain *d);
void sched_destroy_domain(struct domain *d);
+int  sched_sdom_op(struct xen_domctl_sdom *);
long sched_adjust(struct domain *, struct xen_domctl_scheduler_op *);
int  sched_id(void);
void vcpu_wake(struct vcpu *d);


--
Mike D. Day
IBM LTC
Cell: 919 412-3900
Sametime: ncmike@xxxxxxxxxx AIM: ncmikeday  Yahoo: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] 1/4 "nemesis" scheduling domains for Xen, Mike D. Day <=