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

Re: [Xen-devel] [PATCH] Scheduling groups, credit scheduler support

To: "Mike D. Day" <ncmike@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Scheduling groups, credit scheduler support
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Tue, 18 Dec 2007 11:50:28 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 18 Dec 2007 03:51:49 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20071129201959.GC12559@xxxxxxxxxxxxxxxxxxxxxx>
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>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, "Mike D. Day" <ncmike@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
References: <20071129201959.GC12559@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
Hi,

Here is a bunch of other fixes I had to use

Samuel

diff -r b968ee4f6b4f -r d8ed81d5dc55 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Mon Dec 17 12:05:18 2007 +0000
+++ b/tools/libxc/xc_domain.c   Tue Dec 18 11:45:05 2007 +0000
@@ -938,6 +938,7 @@ int xc_group_get_status(int handle, stru
     domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_group;
     domctl.u.scheduler_op.u.group.op = SGRP_get_status;
     domctl.u.scheduler_op.u.group.id_master = group->id_master;
+    domctl.u.scheduler_op.u.group.id_member = group->id_master;
     ret = do_domctl(handle, &domctl);
 
     if ( ret == 0 )

in xen's code, id_member is used for both get_status and get_master. The
code should probably be reworked there so that the fix above is not
needed.

diff -r b968ee4f6b4f -r d8ed81d5dc55 xen/common/domctl.c
--- a/xen/common/domctl.c       Mon Dec 17 12:05:18 2007 +0000
+++ b/xen/common/domctl.c       Tue Dec 18 11:45:05 2007 +0000
@@ -491,6 +491,8 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         if ( op->u.scheduler_op.cmd == XEN_DOMCTL_SCHEDOP_group ) {
             rcu_unlock_domain(d);
             ret = sched_group_op(&op->u.scheduler_op.u.group);
+            if ( copy_to_guest(u_domctl, op, 1) )
+                ret = -EFAULT;
             break;
         }
         
Else the userland doesn't get any value :)

diff -r b968ee4f6b4f -r d8ed81d5dc55 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Mon Dec 17 12:05:18 2007 +0000
+++ b/xen/common/sched_credit.c Tue Dec 18 11:45:05 2007 +0000
@@ -393,10 +393,12 @@ static inline void delegate_active_vcpus
         if ( !list_empty(&member->active_sdom_elem) )
         {
             list_del_init(&member->active_sdom_elem);
+            BUG_ON( csched_priv.weight < member->weight );
             csched_priv.weight -= member->weight;
         }
 
-        if ( list_empty(&master->active_sdom_elem) )
+        if ( !list_empty(&master->active_vcpu) &&
+             list_empty(&master->active_sdom_elem) )
         {
             list_add(&master->active_sdom_elem, &csched_priv.active_sdom);
             csched_priv.weight += master->weight;
@@ -429,6 +431,7 @@ static inline void reclaim_active_vcpus(
             !list_empty(&master->active_sdom_elem) )
         {
             list_del_init(&master->active_sdom_elem);
+            BUG_ON( csched_priv.weight < master->weight );
             csched_priv.weight -= master->weight;
         }
         if ( !list_empty(&member->active_vcpu) &&
@@ -913,7 +916,6 @@ static int csched_group_op(struct xen_do
         member = get_domain_by_id(op->id_member);
         if ( !member )
             goto release_master;
-        ret = 0;
         if ( op->op == SGRP_add_member )
             op->reason =
                 add_sanity_check(csched_dom(member), csched_dom(master));
@@ -922,6 +924,7 @@ static int csched_group_op(struct xen_do
                 rem_sanity_check(csched_dom(member), csched_dom(master));
         if ( op->reason )
             goto release_member;
+        ret = 0;
 
         spin_lock_irqsave(&csched_priv.lock, flags);
         if ( op->op == SGRP_add_member )
@@ -1193,6 +1196,7 @@ csched_acct(void)
         list_for_each_safe( iter_vcpu, next_vcpu, &sdom->active_vcpu )
         {
             svc = list_entry(iter_vcpu, struct csched_vcpu, active_vcpu_elem);
+            BUG_ON( sdom != master_dom(svc->sdom) );
 
             /* Increment credit */
             atomic_add(credit_fair, &svc->credit);

More safety.

diff -r b968ee4f6b4f -r d8ed81d5dc55 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Mon Dec 17 12:05:18 2007 +0000
+++ b/xen/include/public/domctl.h       Tue Dec 18 11:45:05 2007 +0000
@@ -333,7 +333,7 @@ struct xen_domctl_scheduler_op {
             uint8_t is_member;
             domid_t id_master;
             domid_t id_member;
-        } group __attribute__ (( aligned ));
+        } group;
     } u;
 };
 typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;

Aligned is of no use.

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