direct-io.hg

changeset 2676:c084a63b2b64

bitkeeper revision 1.1159.1.250 (41778fccML9t77yAOOuhoIJlCQGgKQ)

Remove fbvt scheduler.
author cl349@freefall.cl.cam.ac.uk
date Thu Oct 21 10:30:36 2004 +0000 (2004-10-21)
parents 15749c9317e9
children 6ef02dbe3f30
files .rootkeys tools/libxc/Makefile tools/libxc/xc.h tools/libxc/xc_domain.c tools/libxc/xc_fbvtsched.c tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/XendClient.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendNode.py tools/python/xen/xend/server/SrvDomain.py tools/python/xen/xend/server/SrvNode.py tools/python/xen/xm/main.py xen/common/sched_fair_bvt.c xen/common/schedule.c xen/include/hypervisor-ifs/sched_ctl.h
line diff
     1.1 --- a/.rootkeys	Thu Oct 21 06:54:28 2004 +0000
     1.2 +++ b/.rootkeys	Thu Oct 21 10:30:36 2004 +0000
     1.3 @@ -333,7 +333,6 @@ 3fbba6dbEVkVMX0JuDFzap9jeaucGA tools/lib
     1.4  3fbba6dbasJQV-MVElDC0DGSHMiL5w tools/libxc/xc_domain.c
     1.5  40278d99BLsfUv3qxv0I8C1sClZ0ow tools/libxc/xc_elf.h
     1.6  403e0977Bjsm_e82pwvl9VvaJxh8Gg tools/libxc/xc_evtchn.c
     1.7 -40ec1922Nq_Rur5KUH0MvRNKczPGxg tools/libxc/xc_fbvtsched.c
     1.8  40e03333Eegw8czSWvHsbKxrRZJjRA tools/libxc/xc_io.c
     1.9  40e03333vrWGbLAhyJjXlqCHaJt7eA tools/libxc/xc_io.h
    1.10  3fbba6dbNCU7U6nsMYiXzKkp3ztaJg tools/libxc/xc_linux_build.c
    1.11 @@ -640,7 +639,6 @@ 4051bcecFeq4DE70p4zGO5setf47CA xen/commo
    1.12  3ddb79bdHqdQpATqC0rmUZNbsb6L6A xen/common/resource.c
    1.13  4064773cJ31vZt-zhbSoxqft1Jaw0w xen/common/sched_atropos.c
    1.14  40589968dD2D1aejwSOvrROg7fOvGQ xen/common/sched_bvt.c
    1.15 -40ec1922He_dRhVJdOicTcHvT8v1NQ xen/common/sched_fair_bvt.c
    1.16  40589968be_t_n0-w6ggceW7h-sx0w xen/common/sched_rrobin.c
    1.17  3e397e6619PgAfBbw2XFbXkewvUWgw xen/common/schedule.c
    1.18  3ddb79bdB9RNMnkQnUyZ5C9hhMSQQw xen/common/slab.c
     2.1 --- a/tools/libxc/Makefile	Thu Oct 21 06:54:28 2004 +0000
     2.2 +++ b/tools/libxc/Makefile	Thu Oct 21 10:30:36 2004 +0000
     2.3 @@ -20,7 +20,6 @@ INCLUDES += -I $(XEN_LIBXUTIL)
     2.4  SRCS     :=
     2.5  SRCS     += xc_atropos.c
     2.6  SRCS     += xc_bvtsched.c
     2.7 -SRCS     += xc_fbvtsched.c
     2.8  SRCS     += xc_domain.c
     2.9  SRCS     += xc_evtchn.c
    2.10  SRCS     += xc_io.c
     3.1 --- a/tools/libxc/xc.h	Thu Oct 21 06:54:28 2004 +0000
     3.2 +++ b/tools/libxc/xc.h	Thu Oct 21 10:30:36 2004 +0000
     3.3 @@ -120,26 +120,6 @@ int xc_bvtsched_domain_get(int xc_handle
     3.4                             long long *warpl,
     3.5                             long long *warpu);
     3.6  
     3.7 -int xc_fbvtsched_global_set(int xc_handle,
     3.8 -                           unsigned long ctx_allow);
     3.9 -
    3.10 -int xc_fbvtsched_domain_set(int xc_handle,
    3.11 -                           u32 domid,
    3.12 -                           unsigned long mcuadv,
    3.13 -                           unsigned long warp,
    3.14 -                           unsigned long warpl,
    3.15 -                           unsigned long warpu);
    3.16 -
    3.17 -int xc_fbvtsched_global_get(int xc_handle,
    3.18 -                           unsigned long *ctx_allow);
    3.19 -
    3.20 -int xc_fbvtsched_domain_get(int xc_handle,
    3.21 -                           u32 domid,
    3.22 -                           unsigned long *mcuadv,
    3.23 -                           unsigned long *warp,
    3.24 -                           unsigned long *warpl,
    3.25 -                           unsigned long *warpu);
    3.26 -
    3.27  int xc_atropos_domain_set(int xc_handle,
    3.28                            u32 domid,
    3.29                            u64 period, u64 slice, u64 latency,
     4.1 --- a/tools/libxc/xc_domain.c	Thu Oct 21 06:54:28 2004 +0000
     4.2 +++ b/tools/libxc/xc_domain.c	Thu Oct 21 10:30:36 2004 +0000
     4.3 @@ -213,11 +213,6 @@ int xc_domain_setcpuweight(int xc_handle
     4.4              break;
     4.5          }
     4.6          
     4.7 -        case SCHED_FBVT:
     4.8 -        {
     4.9 -            // TODO
    4.10 -            break;
    4.11 -        }
    4.12          case SCHED_RROBIN:
    4.13          {
    4.14              /* The weight cannot be set for RRobin */
     5.1 --- a/tools/libxc/xc_fbvtsched.c	Thu Oct 21 06:54:28 2004 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,89 +0,0 @@
     5.4 -/******************************************************************************
     5.5 - * xc_fbvtsched.c
     5.6 - * 
     5.7 - * API for manipulating parameters of the Fair Borrowed Virtual Time scheduler.
     5.8 - * 
     5.9 - * Copyright (c) 2004, G. Milos
    5.10 - * Based on K. Fraiser's xc_bvtsched.c
    5.11 - */
    5.12 -
    5.13 -#include "xc_private.h"
    5.14 -
    5.15 -int xc_fbvtsched_global_set(int xc_handle,
    5.16 -                           unsigned long ctx_allow)
    5.17 -{
    5.18 -    dom0_op_t op;
    5.19 -
    5.20 -    op.cmd = DOM0_SCHEDCTL;
    5.21 -    op.u.schedctl.sched_id = SCHED_FBVT;
    5.22 -    op.u.schedctl.direction = SCHED_INFO_PUT;
    5.23 -    op.u.schedctl.u.fbvt.ctx_allow = ctx_allow;
    5.24 -
    5.25 -    return do_dom0_op(xc_handle, &op);
    5.26 -}
    5.27 -
    5.28 -int xc_fbvtsched_global_get(int xc_handle,
    5.29 -                           unsigned long *ctx_allow)
    5.30 -{
    5.31 -    dom0_op_t op;
    5.32 -    int ret;
    5.33 -    
    5.34 -    op.cmd = DOM0_SCHEDCTL;
    5.35 -    op.u.schedctl.sched_id = SCHED_FBVT;
    5.36 -    op.u.schedctl.direction = SCHED_INFO_GET;
    5.37 -
    5.38 -    ret = do_dom0_op(xc_handle, &op);
    5.39 -
    5.40 -    *ctx_allow = op.u.schedctl.u.fbvt.ctx_allow;
    5.41 -
    5.42 -    return ret;
    5.43 -}
    5.44 -
    5.45 -int xc_fbvtsched_domain_set(int xc_handle,
    5.46 -                           u32 domid,
    5.47 -                           unsigned long mcuadv,
    5.48 -                           unsigned long warp,
    5.49 -                           unsigned long warpl,
    5.50 -                           unsigned long warpu)
    5.51 -{
    5.52 -    dom0_op_t op;
    5.53 -    struct fbvt_adjdom *fbvtadj = &op.u.adjustdom.u.fbvt;
    5.54 -
    5.55 -    op.cmd = DOM0_ADJUSTDOM;
    5.56 -    op.u.adjustdom.domain  = (domid_t)domid;
    5.57 -    op.u.adjustdom.sched_id = SCHED_FBVT;
    5.58 -    op.u.adjustdom.direction = SCHED_INFO_PUT;
    5.59 -
    5.60 -    fbvtadj->mcu_adv = mcuadv;
    5.61 -    fbvtadj->warp    = warp;
    5.62 -    fbvtadj->warpl   = warpl;
    5.63 -    fbvtadj->warpu   = warpu;
    5.64 -    return do_dom0_op(xc_handle, &op);
    5.65 -}
    5.66 -
    5.67 -
    5.68 -int xc_fbvtsched_domain_get(int xc_handle,
    5.69 -                           u32 domid,
    5.70 -                           unsigned long *mcuadv,
    5.71 -                           unsigned long *warp,
    5.72 -                           unsigned long *warpl,
    5.73 -                           unsigned long *warpu)
    5.74 -{
    5.75 -    
    5.76 -    dom0_op_t op;
    5.77 -    int ret;
    5.78 -    struct fbvt_adjdom *adjptr = &op.u.adjustdom.u.fbvt;
    5.79 -
    5.80 -    op.cmd = DOM0_ADJUSTDOM;
    5.81 -    op.u.adjustdom.domain  = (domid_t)domid;
    5.82 -    op.u.adjustdom.sched_id = SCHED_FBVT;
    5.83 -    op.u.adjustdom.direction = SCHED_INFO_GET;
    5.84 -
    5.85 -    ret = do_dom0_op(xc_handle, &op);
    5.86 -
    5.87 -    *mcuadv = adjptr->mcu_adv;
    5.88 -    *warp   = adjptr->warp;
    5.89 -    *warpl  = adjptr->warpl;
    5.90 -    *warpu  = adjptr->warpu;
    5.91 -    return ret;
    5.92 -}
     6.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Thu Oct 21 06:54:28 2004 +0000
     6.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Thu Oct 21 10:30:36 2004 +0000
     6.3 @@ -491,92 +491,6 @@ static PyObject *pyxc_bvtsched_domain_ge
     6.4                           "warpu", warpu);
     6.5  }
     6.6  
     6.7 -static PyObject *pyxc_fbvtsched_global_set(PyObject *self,
     6.8 -                                          PyObject *args,
     6.9 -                                          PyObject *kwds)
    6.10 -{
    6.11 -    XcObject *xc = (XcObject *)self;
    6.12 -
    6.13 -    unsigned long ctx_allow;
    6.14 -
    6.15 -    static char *kwd_list[] = { "ctx_allow", NULL };
    6.16 -
    6.17 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "l", kwd_list, &ctx_allow) )
    6.18 -        return NULL;
    6.19 -
    6.20 -    if ( xc_fbvtsched_global_set(xc->xc_handle, ctx_allow) != 0 )
    6.21 -        return PyErr_SetFromErrno(xc_error);
    6.22 -    
    6.23 -    Py_INCREF(zero);
    6.24 -    return zero;
    6.25 -}
    6.26 -
    6.27 -static PyObject *pyxc_fbvtsched_global_get(PyObject *self,
    6.28 -                                          PyObject *args,
    6.29 -                                          PyObject *kwds)
    6.30 -{
    6.31 -    XcObject *xc = (XcObject *)self;
    6.32 -    
    6.33 -    unsigned long ctx_allow;
    6.34 -    
    6.35 -    if ( !PyArg_ParseTuple(args, "") )
    6.36 -        return NULL;
    6.37 -    
    6.38 -    if ( xc_fbvtsched_global_get(xc->xc_handle, &ctx_allow) != 0 )
    6.39 -        return PyErr_SetFromErrno(xc_error);
    6.40 -    
    6.41 -    return Py_BuildValue("s:l", "ctx_allow", ctx_allow);
    6.42 -}
    6.43 -
    6.44 -static PyObject *pyxc_fbvtsched_domain_set(PyObject *self,
    6.45 -                                          PyObject *args,
    6.46 -                                          PyObject *kwds)
    6.47 -{
    6.48 -    XcObject *xc = (XcObject *)self;
    6.49 -
    6.50 -    u32           dom;
    6.51 -    unsigned long mcuadv, warp, warpl, warpu;
    6.52 -
    6.53 -    static char *kwd_list[] = { "dom", "mcuadv", "warp", "warpl",
    6.54 -                                "warpu", NULL };
    6.55 -
    6.56 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illll", kwd_list,
    6.57 -                                      &dom, &mcuadv, &warp, &warpl, &warpu) )
    6.58 -        return NULL;
    6.59 -
    6.60 -    if ( xc_fbvtsched_domain_set(xc->xc_handle, dom, mcuadv, 
    6.61 -                                warp, warpl, warpu) != 0 )
    6.62 -        return PyErr_SetFromErrno(xc_error);
    6.63 -    
    6.64 -    Py_INCREF(zero);
    6.65 -    return zero;
    6.66 -}
    6.67 -
    6.68 -static PyObject *pyxc_fbvtsched_domain_get(PyObject *self,
    6.69 -                                          PyObject *args,
    6.70 -                                          PyObject *kwds)
    6.71 -{
    6.72 -    XcObject *xc = (XcObject *)self;
    6.73 -    u32 dom;
    6.74 -    unsigned long mcuadv, warp, warpl, warpu;
    6.75 -    
    6.76 -    static char *kwd_list[] = { "dom", NULL };
    6.77 -
    6.78 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
    6.79 -        return NULL;
    6.80 -    
    6.81 -    if ( xc_fbvtsched_domain_get(xc->xc_handle, dom, &mcuadv, &warp,
    6.82 -                                &warpl, &warpu) != 0 )
    6.83 -        return PyErr_SetFromErrno(xc_error);
    6.84 -
    6.85 -    return Py_BuildValue("{s:i,s:l,s:l,s:l,s:l}",
    6.86 -                         "domain", dom,
    6.87 -                         "mcuadv", mcuadv,
    6.88 -                         "warp",   warp,
    6.89 -                         "warpl",  warpl,
    6.90 -                         "warpu",  warpu);
    6.91 -}
    6.92 -
    6.93  static PyObject *pyxc_evtchn_bind_interdomain(PyObject *self,
    6.94                                                PyObject *args,
    6.95                                                PyObject *kwds)
    6.96 @@ -1074,44 +988,6 @@ static PyMethodDef pyxc_methods[] = {
    6.97        " warpl  [long]: Warp limit,\n"
    6.98      },
    6.99  
   6.100 -    { "fbvtsched_global_set",
   6.101 -      (PyCFunction)pyxc_fbvtsched_global_set,
   6.102 -      METH_VARARGS | METH_KEYWORDS, "\n"
   6.103 -      "Set global tuning parameters for Fair Borrowed Virtual Time scheduler.\n"
   6.104 -      " ctx_allow [int]: Minimal guaranteed quantum.\n\n"
   6.105 -      "Returns: [int] 0 on success; -1 on error.\n" },
   6.106 -
   6.107 -    { "fbvtsched_global_get",
   6.108 -      (PyCFunction)pyxc_fbvtsched_global_get,
   6.109 -      METH_KEYWORDS, "\n"
   6.110 -      "Get global tuning parameters for FBVT scheduler.\n"
   6.111 -      "Returns: [dict]:\n"
   6.112 -      " ctx_allow [int]: context switch allowance\n" },
   6.113 -
   6.114 -    { "fbvtsched_domain_set",
   6.115 -      (PyCFunction)pyxc_fbvtsched_domain_set,
   6.116 -      METH_VARARGS | METH_KEYWORDS, "\n"
   6.117 -      "Set per-domain tuning parameters for Fair Borrowed Virtual Time scheduler.\n"
   6.118 -      " dom    [int]: Identifier of domain to be tuned.\n"
   6.119 -      " mcuadv [int]: Proportional to the inverse of the domain's weight.\n"
   6.120 -      " warp   [int]: How far to warp domain's EVT on unblock.\n"
   6.121 -      " warpl  [int]: How long the domain can run warped.\n"
   6.122 -      " warpu  [int]: How long before the domain can warp again.\n\n"
   6.123 -      "Returns: [int] 0 on success; -1 on error.\n" },
   6.124 -
   6.125 -    { "fbvtsched_domain_get",
   6.126 -      (PyCFunction)pyxc_fbvtsched_domain_get,
   6.127 -      METH_KEYWORDS, "\n"
   6.128 -      "Get per-domain tuning parameters under the FBVT scheduler.\n"
   6.129 -      " dom [int]: Identifier of domain to be queried.\n"
   6.130 -      "Returns [dict]:\n"
   6.131 -      " domain [int]:  Domain ID.\n"
   6.132 -      " mcuadv [long]: MCU Advance.\n"
   6.133 -      " warp   [long]: Warp.\n"
   6.134 -      " warpu  [long]: Unwarp requirement.\n"
   6.135 -      " warpl  [long]: Warp limit,\n"
   6.136 -    },
   6.137 -
   6.138      { "atropos_domain_set",
   6.139        (PyCFunction)pyxc_atropos_domain_set,
   6.140        METH_KEYWORDS, "\n"
     7.1 --- a/tools/python/xen/xend/XendClient.py	Thu Oct 21 06:54:28 2004 +0000
     7.2 +++ b/tools/python/xen/xend/XendClient.py	Thu Oct 21 10:30:36 2004 +0000
     7.3 @@ -195,11 +195,6 @@ class Xend:
     7.4                               {'op'      : 'cpu_bvt_slice_set',
     7.5                                'ctx_allow' : ctx_allow })
     7.6  
     7.7 -    def xend_node_cpu_fbvt_slice_set(self, ctx_allow):
     7.8 -        return self.xendPost(self.nodeurl(),
     7.9 -                             {'op'      : 'cpu_fbvt_slice_set',
    7.10 -                              'ctx_allow' : ctx_allow })
    7.11 -
    7.12      def xend_domains(self):
    7.13          return self.xendGet(self.domainurl())
    7.14  
    7.15 @@ -264,14 +259,6 @@ class Xend:
    7.16                                'warpl'    : warpl,
    7.17                                'warpu'    : warpu })
    7.18  
    7.19 -    def xend_domain_cpu_fbvt_set(self, id, mcuadv, warp, warpl, warpu):
    7.20 -        return self.xendPost(self.domainurl(id),
    7.21 -                             {'op'      : 'cpu_fbvt_set',
    7.22 -                              'mcuadv'  : mcuadv,
    7.23 -                              'warp'    : warp,
    7.24 -                              'warpl'   : warpl,
    7.25 -                              'warpu'   : warpu })
    7.26 -
    7.27      def xend_domain_cpu_atropos_set(self, id, period, slice, latency, xtratime):
    7.28          return self.xendPost(self.domainurl(id),
    7.29                               {'op'      : 'cpu_atropos_set',
     8.1 --- a/tools/python/xen/xend/XendDomain.py	Thu Oct 21 06:54:28 2004 +0000
     8.2 +++ b/tools/python/xen/xend/XendDomain.py	Thu Oct 21 10:30:36 2004 +0000
     8.3 @@ -651,25 +651,6 @@ class XendDomain:
     8.4          except Exception, ex:
     8.5              raise XendError(str(ex))
     8.6      
     8.7 -    def domain_cpu_fbvt_set(self, id, mcuadv, warp, warpl, warpu):
     8.8 -        """Set FBVT (Fair Borrowed Virtual Time) scheduler parameters for a domain.
     8.9 -        """
    8.10 -        dominfo = self.domain_lookup(id)
    8.11 -        try:
    8.12 -            return xc.fbvtsched_domain_set(dom=dominfo.dom, mcuadv=mcuadv,
    8.13 -                                           warp=warp, warpl=warpl, warpu=warpu)
    8.14 -        except Exception, ex:
    8.15 -            raise XendError(str(ex))
    8.16 -
    8.17 -    def domain_cpu_fbvt_get(self, id):
    8.18 -        """Get FBVT (Fair Borrowed Virtual Time) scheduler parameters for a domain.
    8.19 -        """
    8.20 -        dominfo = self.domain_lookup(id)
    8.21 -        try:
    8.22 -            return xc.fbvtsched_domain_get(dominfo.dom)
    8.23 -        except Exception, ex:
    8.24 -            raise XendError(str(ex))
    8.25 -        
    8.26      def domain_cpu_atropos_set(self, id, period, slice, latency, xtratime):
    8.27          """Set Atropos scheduler parameters for a domain.
    8.28          """
     9.1 --- a/tools/python/xen/xend/XendNode.py	Thu Oct 21 06:54:28 2004 +0000
     9.2 +++ b/tools/python/xen/xend/XendNode.py	Thu Oct 21 10:30:36 2004 +0000
     9.3 @@ -30,12 +30,6 @@ class XendNode:
     9.4      def cpu_bvt_slice_get(self):
     9.5          return self.xc.bvtsched_global_get()
     9.6      
     9.7 -    def cpu_fbvt_slice_set(self, ctx_allow):
     9.8 -        return self.xc.bvtsched_global_set(ctx_allow=ctx_allow)
     9.9 -
    9.10 -    def cpu_fbvt_slice_get(self):
    9.11 -        return self.xc.bvtsched_global_get()
    9.12 -    
    9.13      def cpu_rrobin_slice_set(self, slice):
    9.14          return self.xc.rrobin_global_set(slice=slice)
    9.15  
    10.1 --- a/tools/python/xen/xend/server/SrvDomain.py	Thu Oct 21 06:54:28 2004 +0000
    10.2 +++ b/tools/python/xen/xend/server/SrvDomain.py	Thu Oct 21 10:30:36 2004 +0000
    10.3 @@ -122,16 +122,6 @@ class SrvDomain(SrvDir):
    10.4          val = fn(req.args, {'dom': self.dom.id})
    10.5          return val
    10.6      
    10.7 -    def op_cpu_fbvt_set(self, op, req):
    10.8 -        fn = FormFn(self.xd.domain_cpu_fbvt_set,
    10.9 -                    [['dom', 'str'],
   10.10 -                     ['mcuadv', 'int'],
   10.11 -                     ['warp', 'int'],
   10.12 -                     ['warpl', 'int'],
   10.13 -                     ['warpu', 'int']])
   10.14 -        val = fn(req.args, {'dom': self.dom.id})
   10.15 -        return val
   10.16 -
   10.17      def op_cpu_atropos_set(self, op, req):
   10.18          fn = FormFn(self.xd.domain_cpu_atropos_set,
   10.19                      [['dom', 'str'],
    11.1 --- a/tools/python/xen/xend/server/SrvNode.py	Thu Oct 21 06:54:28 2004 +0000
    11.2 +++ b/tools/python/xen/xend/server/SrvNode.py	Thu Oct 21 10:30:36 2004 +0000
    11.3 @@ -37,12 +37,6 @@ class SrvNode(SrvDir):
    11.4          val = fn(req.args, {})
    11.5          return val
    11.6      
    11.7 -    def op_cpu_fbvt_slice_set(self, op, req):
    11.8 -        fn = FormFn(self.xn.cpu_fbvt_slice_set,
    11.9 -                    [['ctx_allow', 'int']])
   11.10 -        val = fn(req.args, {})
   11.11 -        return val
   11.12 -
   11.13      def render_POST(self, req):
   11.14          return self.perform(req)
   11.15  
    12.1 --- a/tools/python/xen/xm/main.py	Thu Oct 21 06:54:28 2004 +0000
    12.2 +++ b/tools/python/xen/xm/main.py	Thu Oct 21 10:30:36 2004 +0000
    12.3 @@ -552,40 +552,6 @@ class ProgBvtslice(Prog):
    12.4  
    12.5  xm.prog(ProgBvtslice)
    12.6  
    12.7 -class ProgFbvt(Prog):
    12.8 -    group = 'scheduler'
    12.9 -    name = "fbvt"
   12.10 -    info = """Set FBVT scheduler parameters."""
   12.11 -    
   12.12 -    def help(self, args):
   12.13 -        print args[0], "DOM MCUADV WARP WARPL WARPU"
   12.14 -        print '\nSet Fair Borrowed Virtual Time scheduler parameters.'
   12.15 -
   12.16 -    def main(self, args):
   12.17 -        if len(args) != 6: self.err("%s: Invalid argument(s)" % args[0])
   12.18 -        dom = args[1]
   12.19 -        v = map(int, args[2:6])
   12.20 -        server.xend_domain_cpu_fbvt_set(dom, *v)
   12.21 -
   12.22 -xm.prog(ProgFbvt)
   12.23 -
   12.24 -class ProgFbvtslice(Prog):
   12.25 -    group = 'scheduler'
   12.26 -    name = "fbvt_ctxallow"
   12.27 -    info = """Set the FBVT scheduler context switch allowance."""
   12.28 -
   12.29 -    def help(self, args):
   12.30 -        print args[0], 'CTX_ALLOW'
   12.31 -        print '\nSet Fair Borrowed Virtual Time scheduler context switch allowance.'
   12.32 -
   12.33 -    def main(self, args):
   12.34 -        if len(args) < 2: self.err('%s: Missing context switch allowance.' 
   12.35 -                                                                % args[0])
   12.36 -        ctx_allow = int(args[1])
   12.37 -        server.xend_node_cpu_fbvt_slice_set(ctx_allow)
   12.38 -
   12.39 -xm.prog(ProgFbvtslice)
   12.40 -
   12.41  
   12.42  class ProgAtropos(Prog):
   12.43      group = 'scheduler'
    13.1 --- a/xen/common/sched_fair_bvt.c	Thu Oct 21 06:54:28 2004 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,621 +0,0 @@
    13.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
    13.5 - ****************************************************************************
    13.6 - * (C) 2004      Grzegorz Milos - University of Cambridge
    13.7 - * Based on the implementation of the BVT scheduler by Rolf Neugebauer
    13.8 - * and Mark Williamson (look in sched_bvt.c)
    13.9 - ****************************************************************************
   13.10 - *
   13.11 - *        File: common/sched_fair_bvt.c
   13.12 - *      Author: Grzegorz Milos
   13.13 - *
   13.14 - * Description: CPU scheduling
   13.15 - *              implements Fair Borrowed Virtual Time Scheduler.
   13.16 - *              FBVT is modification of BVT (see Duda & Cheriton SOSP'99)
   13.17 - *              which tries to allocate fair shares of processor even 
   13.18 - *              when there is mix between CPU and I/O bound domains.
   13.19 - *              TODO - more information about the scheduler in TODO
   13.20 - */
   13.21 -#include <xen/config.h>
   13.22 -#include <xen/init.h>
   13.23 -#include <xen/lib.h>
   13.24 -#include <xen/sched.h>
   13.25 -#include <xen/delay.h>
   13.26 -#include <xen/event.h>
   13.27 -#include <xen/time.h>
   13.28 -#include <xen/ac_timer.h>
   13.29 -#include <xen/perfc.h>
   13.30 -#include <xen/sched-if.h>
   13.31 -#include <xen/slab.h>
   13.32 -#include <xen/softirq.h>
   13.33 -#include <xen/trace.h>
   13.34 -
   13.35 -/* For tracing - TODO - put all the defines in some common hearder file */
   13.36 -#define TRC_SCHED_FBVT_DO_SCHED             0x00020000
   13.37 -#define TRC_SCHED_FBVT_DO_SCHED_UPDATE      0x00020001
   13.38 -
   13.39 -/* all per-domain BVT-specific scheduling info is stored here */
   13.40 -struct fbvt_dom_info
   13.41 -{
   13.42 -    struct domain       *domain;          /* domain this info belongs to */
   13.43 -    struct list_head    run_list;         /* runqueue pointers */
   13.44 -    unsigned long       mcu_advance;      /* inverse of weight */
   13.45 -    u32                 avt;              /* actual virtual time */
   13.46 -    u32                 evt;              /* effective virtual time */
   13.47 -    u32                 time_slept;       /* amount of time slept */
   13.48 -    int                 warpback;         /* warp?  */
   13.49 -    long                warp;             /* virtual time warp */
   13.50 -    long                warpl;            /* warp limit */
   13.51 -    long                warpu;            /* unwarp time requirement */
   13.52 -    s_time_t            warped;           /* time it ran warped last time */
   13.53 -    s_time_t            uwarped;          /* time it ran unwarped last time */
   13.54 -};
   13.55 -
   13.56 -struct fbvt_cpu_info
   13.57 -{
   13.58 -    struct list_head    runqueue;
   13.59 -    unsigned long       svt;
   13.60 -    u32                 vtb;       /* virtual time bonus */
   13.61 -    u32                 r_time;    /* last time to run */  
   13.62 -};
   13.63 -
   13.64 -
   13.65 -#define FBVT_INFO(p)  ((struct fbvt_dom_info *)(p)->sched_priv)
   13.66 -#define CPU_INFO(cpu) ((struct fbvt_cpu_info *)(schedule_data[cpu]).sched_priv)
   13.67 -#define RUNLIST(p)    ((struct list_head *)&(FBVT_INFO(p)->run_list))
   13.68 -#define RUNQUEUE(cpu) ((struct list_head *)&(CPU_INFO(cpu)->runqueue))
   13.69 -#define CPU_SVT(cpu)  (CPU_INFO(cpu)->svt)
   13.70 -#define LAST_VTB(cpu) (CPU_INFO(cpu)->vtb)
   13.71 -#define R_TIME(cpu)   (CPU_INFO(cpu)->r_time) 
   13.72 -
   13.73 -#define MCU            (s32)MICROSECS(100)    /* Minimum unit */
   13.74 -#define MCU_ADVANCE    10                     /* default weight */
   13.75 -#define TIME_SLOP      (s32)MICROSECS(50)     /* allow time to slip a bit */
   13.76 -static s32 ctx_allow = (s32)MILLISECS(5);     /* context switch allowance */
   13.77 -static s32 max_vtb   = (s32)MILLISECS(5);
   13.78 -
   13.79 -static xmem_cache_t *dom_info_cache;
   13.80 -
   13.81 -static inline void __add_to_runqueue_head(struct domain *d)
   13.82 -{
   13.83 -    list_add(RUNLIST(d), RUNQUEUE(d->processor));
   13.84 -}
   13.85 -
   13.86 -static inline void __add_to_runqueue_tail(struct domain *d)
   13.87 -{
   13.88 -    list_add_tail(RUNLIST(d), RUNQUEUE(d->processor));
   13.89 -}
   13.90 -
   13.91 -static inline void __del_from_runqueue(struct domain *d)
   13.92 -{
   13.93 -    struct list_head *runlist = RUNLIST(d);
   13.94 -    list_del(runlist);
   13.95 -    runlist->next = NULL;
   13.96 -}
   13.97 -
   13.98 -static inline int __task_on_runqueue(struct domain *d)
   13.99 -{
  13.100 -    return (RUNLIST(d))->next != NULL;
  13.101 -}
  13.102 -
  13.103 -/*
  13.104 - * Calculate the effective virtual time for a domain. Take into account 
  13.105 - * warping limits
  13.106 - */
  13.107 -static void __calc_evt(struct fbvt_dom_info *inf)
  13.108 -{
  13.109 -    s_time_t now = NOW();
  13.110 -
  13.111 -    if ( inf->warpback ) 
  13.112 -    {
  13.113 -        if ( ((now - inf->warped) < inf->warpl) &&
  13.114 -             ((now - inf->uwarped) > inf->warpu) )
  13.115 -        {
  13.116 -            /* allowed to warp */
  13.117 -            inf->evt = inf->avt - inf->warp;
  13.118 -        } 
  13.119 -        else 
  13.120 -        {
  13.121 -            /* warped for too long -> unwarp */
  13.122 -            inf->evt      = inf->avt;
  13.123 -            inf->uwarped  = now;
  13.124 -            inf->warpback = 0;
  13.125 -        }
  13.126 -    } 
  13.127 -    else 
  13.128 -    {
  13.129 -        inf->evt = inf->avt;
  13.130 -    }
  13.131 -}
  13.132 -
  13.133 -/**
  13.134 - * fbvt_alloc_task - allocate FBVT private structures for a task
  13.135 - * @p:              task to allocate private structures for
  13.136 - *
  13.137 - * Returns non-zero on failure.
  13.138 - */
  13.139 -int fbvt_alloc_task(struct domain *d)
  13.140 -{
  13.141 -    if ( (d->sched_priv = xmem_cache_alloc(dom_info_cache)) == NULL )
  13.142 -        return -1;
  13.143 -    memset(d->sched_priv, 0, sizeof(struct fbvt_dom_info));
  13.144 -    return 0;
  13.145 -}
  13.146 -
  13.147 -/*
  13.148 - * Add and remove a domain
  13.149 - */
  13.150 -void fbvt_add_task(struct domain *p) 
  13.151 -{
  13.152 -    struct fbvt_dom_info *inf = FBVT_INFO(p);
  13.153 -
  13.154 -    ASSERT(inf != NULL);
  13.155 -    ASSERT(p   != NULL);
  13.156 -
  13.157 -    inf->mcu_advance = MCU_ADVANCE;
  13.158 -    inf->domain = p;
  13.159 -    if ( p->domain == IDLE_DOMAIN_ID )
  13.160 -    {
  13.161 -        inf->avt = inf->evt = ~0U;
  13.162 -    } 
  13.163 -    else 
  13.164 -    {
  13.165 -        /* Set avt and evt to system virtual time. */
  13.166 -        inf->avt         = CPU_SVT(p->processor);
  13.167 -        inf->evt         = CPU_SVT(p->processor);
  13.168 -        /* Set some default values here. */
  13.169 -        inf->time_slept  = 0;
  13.170 -        inf->warpback    = 0;
  13.171 -        inf->warp        = 0;
  13.172 -        inf->warpl       = 0;
  13.173 -        inf->warpu       = 0;
  13.174 -    }
  13.175 -
  13.176 -    return;
  13.177 -}
  13.178 -
  13.179 -int fbvt_init_idle_task(struct domain *p)
  13.180 -{
  13.181 -    if ( fbvt_alloc_task(p) < 0 )
  13.182 -        return -1;
  13.183 -
  13.184 -    fbvt_add_task(p);
  13.185 -
  13.186 -    set_bit(DF_RUNNING, &p->flags);
  13.187 -    if ( !__task_on_runqueue(p) )
  13.188 -        __add_to_runqueue_head(p);
  13.189 -
  13.190 -    return 0;
  13.191 -}
  13.192 -                                        
  13.193 -static void fbvt_wake(struct domain *d)
  13.194 -{
  13.195 -    struct fbvt_dom_info *inf = FBVT_INFO(d);
  13.196 -    struct domain        *curr;
  13.197 -    s_time_t             now, min_time;
  13.198 -    int                  cpu = d->processor;
  13.199 -    s32                  io_warp;
  13.200 -
  13.201 -    if ( unlikely(__task_on_runqueue(d)) )
  13.202 -        return;
  13.203 -
  13.204 -    __add_to_runqueue_head(d);
  13.205 - 
  13.206 -    now = NOW();
  13.207 -
  13.208 -    /* Set the BVT parameters. */
  13.209 -    if ( inf->avt < CPU_SVT(cpu) )
  13.210 -    {
  13.211 -        /*
  13.212 -         * We want IO bound processes to gain dispatch precedence. It is 
  13.213 -         * especially for device driver domains. Therefore AVT 
  13.214 -         * not be updated to SVT but to a value marginally smaller.
  13.215 -         * Since frequently sleeping domains have high time_slept
  13.216 -         * values, the virtual time can be determined as:
  13.217 -         * SVT - const * TIME_SLEPT
  13.218 -         */
  13.219 -        io_warp = inf->time_slept/2;
  13.220 -        if ( io_warp > 1000 )
  13.221 -            io_warp = 1000;
  13.222 -
  13.223 -        ASSERT(inf->time_slept + CPU_SVT(cpu) > inf->avt + io_warp);
  13.224 -        inf->time_slept += CPU_SVT(cpu) - inf->avt - io_warp;
  13.225 -        inf->avt = CPU_SVT(cpu) - io_warp;
  13.226 -    }
  13.227 -
  13.228 -    /* Deal with warping here. */
  13.229 -    inf->warpback  = 1;
  13.230 -    inf->warped    = now;
  13.231 -    __calc_evt(inf);
  13.232 - 
  13.233 -    curr = schedule_data[cpu].curr;
  13.234 - 
  13.235 -    /* Currently-running domain should run at least for ctx_allow. */
  13.236 -    min_time = curr->lastschd + ctx_allow;
  13.237 -    
  13.238 -    if ( is_idle_task(curr) || (min_time <= now) )
  13.239 -        cpu_raise_softirq(cpu, SCHEDULE_SOFTIRQ);
  13.240 -    else if ( schedule_data[cpu].s_timer.expires > (min_time + TIME_SLOP) )
  13.241 -        mod_ac_timer(&schedule_data[cpu].s_timer, min_time);
  13.242 -}
  13.243 -
  13.244 -
  13.245 -static void fbvt_sleep(struct domain *d)
  13.246 -{
  13.247 -    if ( test_bit(DF_RUNNING, &d->flags) )
  13.248 -        cpu_raise_softirq(d->processor, SCHEDULE_SOFTIRQ);
  13.249 -    else if ( __task_on_runqueue(d) )
  13.250 -        __del_from_runqueue(d);
  13.251 -}
  13.252 -
  13.253 -
  13.254 -/**
  13.255 - * fbvt_free_task - free FBVT private structures for a task
  13.256 - * @d:             task
  13.257 - */
  13.258 -void fbvt_free_task(struct domain *d)
  13.259 -{
  13.260 -    ASSERT(d->sched_priv != NULL);
  13.261 -    xmem_cache_free(dom_info_cache, d->sched_priv);
  13.262 -}
  13.263 -
  13.264 -/* 
  13.265 - * Block the currently-executing domain until a pertinent event occurs.
  13.266 - */
  13.267 -static void fbvt_do_block(struct domain *d)
  13.268 -{
  13.269 -    FBVT_INFO(d)->warpback = 0; 
  13.270 -}
  13.271 -
  13.272 -/* Control the scheduler. */
  13.273 -int fbvt_ctl(struct sched_ctl_cmd *cmd)
  13.274 -{
  13.275 -    struct fbvt_ctl *params = &cmd->u.fbvt;
  13.276 -
  13.277 -    if ( cmd->direction == SCHED_INFO_PUT )
  13.278 -    { 
  13.279 -        ctx_allow = params->ctx_allow;
  13.280 -        /* The max_vtb should be of the order o the ctx_allow */
  13.281 -        max_vtb = ctx_allow;
  13.282 -    }
  13.283 -    else
  13.284 -    {
  13.285 -        params->ctx_allow = ctx_allow;
  13.286 -    }
  13.287 -    
  13.288 -    return 0;
  13.289 -}
  13.290 -
  13.291 -/* Adjust scheduling parameter for a given domain. */
  13.292 -int fbvt_adjdom(struct domain *p,
  13.293 -                struct sched_adjdom_cmd *cmd)
  13.294 -{
  13.295 -    struct fbvt_adjdom *params = &cmd->u.fbvt;
  13.296 -
  13.297 -    if ( cmd->direction == SCHED_INFO_PUT )
  13.298 -    {
  13.299 -        unsigned long mcu_adv = params->mcu_adv,
  13.300 -            warp  = params->warp,
  13.301 -            warpl = params->warpl,
  13.302 -            warpu = params->warpu;
  13.303 -        
  13.304 -        struct fbvt_dom_info *inf = FBVT_INFO(p);
  13.305 -        
  13.306 -        DPRINTK("Get domain %u fbvt mcu_adv=%ld, warp=%ld, "
  13.307 -                "warpl=%ld, warpu=%ld\n",
  13.308 -                p->domain, inf->mcu_advance, inf->warp,
  13.309 -                inf->warpl, inf->warpu );
  13.310 -
  13.311 -        /* Sanity -- this can avoid divide-by-zero. */
  13.312 -        if ( mcu_adv == 0 )
  13.313 -            return -EINVAL;
  13.314 -        
  13.315 -        inf->mcu_advance = mcu_adv;
  13.316 -        inf->warp = warp;
  13.317 -        inf->warpl = warpl;
  13.318 -        inf->warpu = warpu;
  13.319 -
  13.320 -        DPRINTK("Set domain %u fbvt mcu_adv=%ld, warp=%ld, "
  13.321 -                "warpl=%ld, warpu=%ld\n",
  13.322 -                p->domain, inf->mcu_advance, inf->warp,
  13.323 -                inf->warpl, inf->warpu );
  13.324 -    }
  13.325 -    else if ( cmd->direction == SCHED_INFO_GET )
  13.326 -    {
  13.327 -        struct fbvt_dom_info *inf = FBVT_INFO(p);
  13.328 -        params->mcu_adv = inf->mcu_advance;
  13.329 -        params->warp    = inf->warp;
  13.330 -        params->warpl   = inf->warpl;
  13.331 -        params->warpu   = inf->warpu;
  13.332 -    }
  13.333 -    
  13.334 -    return 0;
  13.335 -}
  13.336 -
  13.337 -
  13.338 -/* 
  13.339 - * The main function
  13.340 - * - deschedule the current domain.
  13.341 - * - pick a new domain.
  13.342 - *   i.e., the domain with lowest EVT.
  13.343 - *   The runqueue should be ordered by EVT so that is easy.
  13.344 - */
  13.345 -static task_slice_t fbvt_do_schedule(s_time_t now)
  13.346 -{
  13.347 -    struct domain *prev = current, *next = NULL, *next_prime, *p;
  13.348 -    struct list_head   *tmp;
  13.349 -    int                 cpu = prev->processor;
  13.350 -    s32                 r_time;     /* time for new dom to run */
  13.351 -    s32                 ranfor;     /* assume we never run longer than 2.1s! */
  13.352 -    s32                 mcus;
  13.353 -    u32                 next_evt, next_prime_evt, min_avt;
  13.354 -    u32                 sl_decrement;
  13.355 -    struct fbvt_dom_info *prev_inf       = FBVT_INFO(prev);
  13.356 -    struct fbvt_dom_info *p_inf          = NULL;
  13.357 -    struct fbvt_dom_info *next_inf       = NULL;
  13.358 -    struct fbvt_dom_info *next_prime_inf = NULL;
  13.359 -    task_slice_t        ret;
  13.360 -
  13.361 -    ASSERT(prev->sched_priv != NULL);
  13.362 -    ASSERT(prev_inf != NULL);
  13.363 -    ASSERT(__task_on_runqueue(prev));
  13.364 -
  13.365 -    if ( likely(!is_idle_task(prev)) ) 
  13.366 -    {
  13.367 -        ranfor = (s32)(now - prev->lastschd);
  13.368 -        /* Calculate mcu and update avt. */
  13.369 -        mcus = (ranfor + MCU - 1) / MCU;
  13.370 -        
  13.371 -        TRACE_3D(TRC_SCHED_FBVT_DO_SCHED_UPDATE, prev->domain, 
  13.372 -                 mcus, LAST_VTB(cpu));
  13.373 -    
  13.374 -        sl_decrement = mcus * LAST_VTB(cpu) / R_TIME(cpu);
  13.375 -        prev_inf->time_slept -=  sl_decrement;
  13.376 -        prev_inf->avt += mcus * prev_inf->mcu_advance - sl_decrement;
  13.377 -  
  13.378 -        /*if(mcus * prev_inf->mcu_advance < LAST_VTB(cpu))
  13.379 -          {
  13.380 -          ASSERT(prev_inf->time_slept >= mcus * prev_inf->mcu_advance);
  13.381 -          prev_inf->time_slept -= mcus * prev_inf->mcu_advance;
  13.382 -          }
  13.383 -          else
  13.384 -          {
  13.385 -          prev_inf->avt += mcus * prev_inf->mcu_advance - LAST_VTB(cpu);
  13.386 -  
  13.387 -          ASSERT(prev_inf->time_slept >= LAST_VTB(cpu));
  13.388 -          prev_inf->time_slept -= LAST_VTB(cpu);
  13.389 -          }*/
  13.390 -        
  13.391 -        __calc_evt(prev_inf);
  13.392 -        
  13.393 -        __del_from_runqueue(prev);
  13.394 -        
  13.395 -        if ( domain_runnable(prev) )
  13.396 -            __add_to_runqueue_tail(prev);
  13.397 -    }
  13.398 -
  13.399 -    /* We should at least have the idle task */
  13.400 -    ASSERT(!list_empty(RUNQUEUE(cpu)));
  13.401 -
  13.402 -    /*
  13.403 -     * scan through the run queue and pick the task with the lowest evt
  13.404 -     * *and* the task the second lowest evt.
  13.405 -     * this code is O(n) but we expect n to be small.
  13.406 -     */
  13.407 -    next_inf        = FBVT_INFO(schedule_data[cpu].idle);
  13.408 -    next_prime_inf  = NULL;
  13.409 -
  13.410 -    next_evt       = ~0U;
  13.411 -    next_prime_evt = ~0U;
  13.412 -    min_avt        = ~0U;
  13.413 -
  13.414 -    list_for_each ( tmp, RUNQUEUE(cpu) )
  13.415 -    {
  13.416 -        p_inf = list_entry(tmp, struct fbvt_dom_info, run_list);
  13.417 -
  13.418 -        if ( p_inf->evt < next_evt )
  13.419 -        {
  13.420 -            next_prime_inf  = next_inf;
  13.421 -            next_prime_evt  = next_evt;
  13.422 -            next_inf        = p_inf;
  13.423 -            next_evt        = p_inf->evt;
  13.424 -        }
  13.425 -        else if ( next_prime_evt == ~0U )
  13.426 -        {
  13.427 -            next_prime_evt  = p_inf->evt;
  13.428 -            next_prime_inf  = p_inf;
  13.429 -        }
  13.430 -        else if ( p_inf->evt < next_prime_evt )
  13.431 -        {
  13.432 -            next_prime_evt  = p_inf->evt;
  13.433 -            next_prime_inf  = p_inf;
  13.434 -        }
  13.435 -
  13.436 -        /* Determine system virtual time. */
  13.437 -        if ( p_inf->avt < min_avt )
  13.438 -            min_avt = p_inf->avt;
  13.439 -    }
  13.440 -
  13.441 -    /* Extract the domain pointers from the dom infos */
  13.442 -    next        = next_inf->domain;
  13.443 -    next_prime  = next_prime_inf->domain;
  13.444 -     
  13.445 -
  13.446 -    /* Update system virtual time. */
  13.447 -    if ( min_avt != ~0U )
  13.448 -        CPU_SVT(cpu) = min_avt;
  13.449 -
  13.450 -    /* check for virtual time overrun on this cpu */
  13.451 -    if ( CPU_SVT(cpu) >= 0xf0000000 )
  13.452 -    {
  13.453 -        ASSERT(!local_irq_is_enabled());
  13.454 -
  13.455 -        write_lock(&tasklist_lock);
  13.456 -
  13.457 -        for_each_domain ( p )
  13.458 -        {
  13.459 -            if ( p->processor == cpu )
  13.460 -            {
  13.461 -                p_inf = FBVT_INFO(p);
  13.462 -                p_inf->evt -= 0xe0000000;
  13.463 -                p_inf->avt -= 0xe0000000;
  13.464 -            }
  13.465 -        } 
  13.466 -
  13.467 -        write_unlock(&tasklist_lock);
  13.468 -
  13.469 -        CPU_SVT(cpu) -= 0xe0000000;
  13.470 -    }
  13.471 -
  13.472 -    /* check for time_slept overrun for the domain we schedule to run*/
  13.473 -    if(next_inf->time_slept >= 0xf0000000)
  13.474 -    {
  13.475 -        printk("Domain %d is assigned more CPU then it is able to use.\n"
  13.476 -               "FBVT slept_time=%d, halving. Mcu_advance=%ld\n",next->domain, 
  13.477 -               next_inf->time_slept, next_inf->mcu_advance);
  13.478 -
  13.479 -        next_inf->time_slept /= 2;
  13.480 -    }
  13.481 -
  13.482 -
  13.483 -    /*
  13.484 -     * In here we decide on Virtual Time Bonus. The idea is, for the
  13.485 -     * domains that have large time_slept values to be allowed to run
  13.486 -     * for longer. Thus regaining the share of CPU originally allocated.
  13.487 -     * This is acompanied by the warp mechanism (which moves IO-bound
  13.488 -     * domains earlier in virtual time). Together this should give quite
  13.489 -     * good control both for CPU and IO-bound domains.
  13.490 -     */
  13.491 -    LAST_VTB(cpu) = next_inf->time_slept/5;
  13.492 -    if(LAST_VTB(cpu) / next_inf->mcu_advance > max_vtb / MCU) 
  13.493 -        LAST_VTB(cpu) = max_vtb * next_inf->mcu_advance / MCU;
  13.494 -
  13.495 -
  13.496 -    /* work out time for next run through scheduler */
  13.497 -    if ( is_idle_task(next) ) 
  13.498 -    {
  13.499 -        r_time = ctx_allow;
  13.500 -        goto sched_done;
  13.501 -    }
  13.502 -
  13.503 -    if ( (next_prime == NULL) || is_idle_task(next_prime) )
  13.504 -    {
  13.505 -        /* We have only one runnable task besides the idle task. */
  13.506 -        r_time = 10 * ctx_allow;     /* RN: random constant */
  13.507 -        goto sched_done;
  13.508 -    }
  13.509 -
  13.510 -    /*
  13.511 -     * If we are here then we have two runnable tasks.
  13.512 -     * Work out how long 'next' can run till its evt is greater than
  13.513 -     * 'next_prime's evt. Take context switch allowance into account.
  13.514 -     */
  13.515 -    ASSERT(next_prime_inf->evt >= next_inf->evt);
  13.516 -  
  13.517 -    ASSERT(LAST_VTB(cpu) >= 0);
  13.518 -
  13.519 -    r_time = MCU * ((next_prime_inf->evt + LAST_VTB(cpu) - next_inf->evt)/next_inf->mcu_advance)
  13.520 -        + ctx_allow;
  13.521 -
  13.522 -    ASSERT(r_time >= ctx_allow);
  13.523 -
  13.524 - sched_done:
  13.525 -    R_TIME(cpu) = r_time / MCU;
  13.526 -    TRACE_3D(TRC_SCHED_FBVT_DO_SCHED, next->domain, r_time, LAST_VTB(cpu));
  13.527 -    ret.task = next;
  13.528 -    ret.time = r_time;
  13.529 -    return ret;
  13.530 -}
  13.531 -
  13.532 -
  13.533 -static void fbvt_dump_runq_el(struct domain *p)
  13.534 -{
  13.535 -    struct fbvt_dom_info *inf = FBVT_INFO(p);
  13.536 -
  13.537 -    printk("mcua=0x%04lX ev=0x%08X av=0x%08X ",
  13.538 -           inf->mcu_advance, inf->evt, inf->avt);
  13.539 -}
  13.540 -
  13.541 -static void fbvt_dump_settings(void)
  13.542 -{
  13.543 -    printk("BVT: mcu=0x%08Xns ctx_allow=0x%08Xns ", (u32)MCU, (s32)ctx_allow );
  13.544 -}
  13.545 -
  13.546 -static void fbvt_dump_cpu_state(int i)
  13.547 -{
  13.548 -    struct list_head *list, *queue;
  13.549 -    int loop = 0;
  13.550 -    struct fbvt_dom_info *d_inf;
  13.551 -    struct domain *d;
  13.552 -
  13.553 -    printk("svt=0x%08lX ", CPU_SVT(i));
  13.554 -
  13.555 -    queue = RUNQUEUE(i);
  13.556 -    printk("QUEUE rq %lx   n: %lx, p: %lx\n",  (unsigned long)queue,
  13.557 -        (unsigned long) queue->next, (unsigned long) queue->prev);
  13.558 -
  13.559 -    list_for_each ( list, queue )
  13.560 -    {
  13.561 -        d_inf = list_entry(list, struct fbvt_dom_info, run_list);
  13.562 -        d = d_inf->domain;
  13.563 -        printk("%3d: %u has=%c ", loop++, d->domain,
  13.564 -              test_bit(DF_RUNNING, &d->flags) ? 'T':'F');
  13.565 -        fbvt_dump_runq_el(d);
  13.566 -        printk("c=0x%X%08X\n", (u32)(d->cpu_time>>32), (u32)d->cpu_time);
  13.567 -        printk("         l: %lx n: %lx  p: %lx\n",
  13.568 -            (unsigned long)list, (unsigned long)list->next,
  13.569 -            (unsigned long)list->prev);
  13.570 -    }
  13.571 -}
  13.572 -
  13.573 -/* Initialise the data structures. */
  13.574 -int fbvt_init_scheduler()
  13.575 -{
  13.576 -    int i;
  13.577 -
  13.578 -    for ( i = 0; i < NR_CPUS; i++ )
  13.579 -    {
  13.580 -        schedule_data[i].sched_priv = xmalloc(sizeof(struct fbvt_cpu_info));
  13.581 -        
  13.582 -        if ( schedule_data[i].sched_priv == NULL )
  13.583 -        {
  13.584 -            printk("Failed to allocate FBVT scheduler per-CPU memory!\n");
  13.585 -            return -1;
  13.586 -        }
  13.587 -
  13.588 -        INIT_LIST_HEAD(RUNQUEUE(i));
  13.589 - 
  13.590 -        CPU_SVT(i) = 0; /* XXX do I really need to do this? */
  13.591 -    }
  13.592 -
  13.593 -    dom_info_cache = xmem_cache_create(
  13.594 -        "FBVT dom info", sizeof(struct fbvt_dom_info), 0, 0, NULL, NULL);
  13.595 -    if ( dom_info_cache == NULL )
  13.596 -    {
  13.597 -        printk("FBVT: Failed to allocate domain info SLAB cache");
  13.598 -        return -1;
  13.599 -    }
  13.600 -
  13.601 -    return 0;
  13.602 -}
  13.603 - 
  13.604 -
  13.605 -struct scheduler sched_fbvt_def = {
  13.606 -    .name     = "Fair Borrowed Virtual Time",
  13.607 -    .opt_name = "fbvt",
  13.608 -    .sched_id = SCHED_FBVT,
  13.609 -    
  13.610 -    .init_scheduler = fbvt_init_scheduler,
  13.611 -    .init_idle_task = fbvt_init_idle_task,
  13.612 -    .alloc_task     = fbvt_alloc_task,
  13.613 -    .add_task       = fbvt_add_task,
  13.614 -    .free_task      = fbvt_free_task,
  13.615 -    .do_block       = fbvt_do_block,
  13.616 -    .do_schedule    = fbvt_do_schedule,
  13.617 -    .control        = fbvt_ctl,
  13.618 -    .adjdom         = fbvt_adjdom,
  13.619 -    .dump_settings  = fbvt_dump_settings,
  13.620 -    .dump_cpu_state = fbvt_dump_cpu_state,
  13.621 -    .sleep          = fbvt_sleep,
  13.622 -    .wake           = fbvt_wake,
  13.623 -};
  13.624 -
    14.1 --- a/xen/common/schedule.c	Thu Oct 21 06:54:28 2004 +0000
    14.2 +++ b/xen/common/schedule.c	Thu Oct 21 10:30:36 2004 +0000
    14.3 @@ -68,12 +68,10 @@ static void fallback_timer_fn(unsigned l
    14.4  schedule_data_t schedule_data[NR_CPUS];
    14.5  
    14.6  extern struct scheduler sched_bvt_def;
    14.7 -extern struct scheduler sched_fbvt_def;
    14.8  extern struct scheduler sched_rrobin_def;
    14.9  extern struct scheduler sched_atropos_def;
   14.10  static struct scheduler *schedulers[] = { 
   14.11      &sched_bvt_def,
   14.12 -    &sched_fbvt_def,
   14.13      &sched_rrobin_def,
   14.14      &sched_atropos_def,
   14.15      NULL
    15.1 --- a/xen/include/hypervisor-ifs/sched_ctl.h	Thu Oct 21 06:54:28 2004 +0000
    15.2 +++ b/xen/include/hypervisor-ifs/sched_ctl.h	Thu Oct 21 10:30:36 2004 +0000
    15.3 @@ -9,7 +9,6 @@
    15.4  
    15.5  /* Scheduler types */
    15.6  #define SCHED_BVT      0
    15.7 -#define SCHED_FBVT     1
    15.8  #define SCHED_ATROPOS  2
    15.9  #define SCHED_RROBIN   3
   15.10  
   15.11 @@ -33,12 +32,6 @@ struct sched_ctl_cmd
   15.12              u32 ctx_allow;            /*  8: context switch allowance */
   15.13          } PACKED bvt;
   15.14  
   15.15 -        struct fbvt_ctl
   15.16 -        {
   15.17 -            /* IN variables. */
   15.18 -            u32 ctx_allow;            /*  8: context switch allowance */
   15.19 -        } PACKED fbvt;
   15.20 -
   15.21          struct rrobin_ctl
   15.22          {
   15.23              /* IN variables */
   15.24 @@ -64,14 +57,6 @@ struct sched_adjdom_cmd
   15.25              long long warpu;        /* 40: unwarp time requirement */
   15.26          } PACKED bvt;
   15.27  
   15.28 -        struct fbvt_adjdom
   15.29 -        {
   15.30 -            u32 mcu_adv;    /* 16: mcu advance: inverse of weight */
   15.31 -            u32 warp;       /* 20: time warp */
   15.32 -            u32 warpl;      /* 24: warp limit */
   15.33 -            u32 warpu;      /* 28: unwarp time requirement */
   15.34 -        } PACKED fbvt;
   15.35 -
   15.36          struct atropos_adjdom
   15.37          {
   15.38              u64 nat_period; /* 16 */