ia64/xen-unstable

changeset 2091:b6d46f6caea5

bitkeeper revision 1.1153 (41126318o43x3YiPCk8UwYtIQ4XdtA)

Fixes to the warping mechanism in BVT
author gm281@boulderdash.cl.cam.ac.uk
date Thu Aug 05 16:40:56 2004 +0000 (2004-08-05)
parents ba8727dce7d7
children 8e0d9e45c5f7
files tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/Args.py tools/python/xen/xend/server/SrvDomain.py tools/python/xen/xm/main.py xen/common/sched_bvt.c
line diff
     1.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Thu Aug 05 13:31:09 2004 +0000
     1.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Thu Aug 05 16:40:56 2004 +0000
     1.3 @@ -445,7 +445,7 @@ static PyObject *pyxc_bvtsched_domain_se
     1.4      static char *kwd_list[] = { "dom", "mcuadv", "warpback", "warpvalue",
     1.5                                  "warpl", "warpu", NULL };
     1.6  
     1.7 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiill", kwd_list,
     1.8 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiiLL", kwd_list,
     1.9                                        &dom, &mcuadv, &warpback, &warpvalue, 
    1.10                                        &warpl, &warpu) )
    1.11          return NULL;
     2.1 --- a/tools/python/xen/xend/Args.py	Thu Aug 05 13:31:09 2004 +0000
     2.2 +++ b/tools/python/xen/xend/Args.py	Thu Aug 05 16:40:56 2004 +0000
     2.3 @@ -72,6 +72,8 @@ class Args:
     2.4          try:
     2.5              if type == 'int':
     2.6                  val = int(v)
     2.7 +            elif type == 'long':
     2.8 +                val = long(v)
     2.9              elif type == 'str':
    2.10                  val = str(v)
    2.11              elif type == 'sxpr':
     3.1 --- a/tools/python/xen/xend/server/SrvDomain.py	Thu Aug 05 13:31:09 2004 +0000
     3.2 +++ b/tools/python/xen/xend/server/SrvDomain.py	Thu Aug 05 16:40:56 2004 +0000
     3.3 @@ -112,8 +112,8 @@ class SrvDomain(SrvDir):
     3.4                       ['mcuadv', 'int'],
     3.5                       ['warpback', 'int'],
     3.6                       ['warpvalue', 'int'],
     3.7 -                     ['warpl', 'int'],
     3.8 -                     ['warpu', 'int']])
     3.9 +                     ['warpl', 'long'],
    3.10 +                     ['warpu', 'long']])
    3.11          val = fn(req.args, {'dom': self.dom.name})
    3.12          return val
    3.13      
     4.1 --- a/tools/python/xen/xm/main.py	Thu Aug 05 13:31:09 2004 +0000
     4.2 +++ b/tools/python/xen/xm/main.py	Thu Aug 05 16:40:56 2004 +0000
     4.3 @@ -497,7 +497,7 @@ class ProgBvt(Prog):
     4.4  
     4.5      def main(self, args):
     4.6          if len(args) != 7: self.err("%s: Invalid argument(s)" % args[0])
     4.7 -        v = map(int, args[1:7])
     4.8 +        v = map(long, args[1:7])
     4.9          server.xend_domain_cpu_bvt_set(*v)
    4.10  
    4.11  xm.prog(ProgBvt)
     5.1 --- a/xen/common/sched_bvt.c	Thu Aug 05 13:31:09 2004 +0000
     5.2 +++ b/xen/common/sched_bvt.c	Thu Aug 05 16:40:56 2004 +0000
     5.3 @@ -98,8 +98,9 @@ static inline int __task_on_runqueue(str
     5.4  static void warp_timer_fn(unsigned long pointer)
     5.5  {
     5.6      struct bvt_dom_info *inf = (struct bvt_dom_info *)pointer;
     5.7 -
     5.8 -printk("--> Warp timer fired for %d\n", inf->domain->domain);
     5.9 +    unsigned long flags; 
    5.10 +    
    5.11 +    spin_lock_irqsave(&CPU_INFO(inf->domain->processor)->run_lock, flags);
    5.12      inf->warp = 0;
    5.13      /* unwarp equal to zero => stop warping */
    5.14      if(inf->warpu == 0)
    5.15 @@ -110,7 +111,9 @@ printk("--> Warp timer fired for %d\n", 
    5.16      
    5.17      /* set unwarp timer */
    5.18      inf->unwarp_timer.expires = NOW() + inf->warpu;
    5.19 +    rem_ac_timer(&inf->unwarp_timer);
    5.20      add_ac_timer(&inf->unwarp_timer);
    5.21 +    spin_unlock_irqrestore(&CPU_INFO(inf->domain->processor)->run_lock, flags);
    5.22  
    5.23  reschedule:
    5.24      cpu_raise_softirq(inf->domain->processor, SCHEDULE_SOFTIRQ);   
    5.25 @@ -119,13 +122,16 @@ reschedule:
    5.26  static void unwarp_timer_fn(unsigned long pointer)
    5.27  {
    5.28       struct bvt_dom_info *inf = (struct bvt_dom_info *)pointer;
    5.29 +     unsigned long flags;
    5.30  
    5.31 -printk("---> UnWarp timer fired for %d\n", inf->domain->domain);
    5.32 +     spin_lock_irqsave(&CPU_INFO(inf->domain->processor)->run_lock, flags);
    5.33      if(inf->warpback)
    5.34      {
    5.35          inf->warp = 1;
    5.36          cpu_raise_softirq(inf->domain->processor, SCHEDULE_SOFTIRQ);   
    5.37      }
    5.38 +    
    5.39 +    spin_unlock_irqrestore(&CPU_INFO(inf->domain->processor)->run_lock, flags);
    5.40  }
    5.41  
    5.42  
    5.43 @@ -262,9 +268,6 @@ void bvt_wake(struct domain *d)
    5.44          inf->avt = CPU_SVT(cpu);
    5.45  
    5.46      /* Deal with warping here. */
    5.47 -    // TODO rewrite
    5.48 -    //inf->warpback  = 1;
    5.49 -    //inf->warped    = now;
    5.50      inf->evt = calc_evt(d, inf->avt);
    5.51      spin_unlock_irqrestore(&CPU_INFO(cpu)->run_lock, flags);
    5.52      
    5.53 @@ -323,7 +326,6 @@ void bvt_free_task(struct domain *p)
    5.54   */
    5.55  static void bvt_do_block(struct domain *p)
    5.56  {
    5.57 -    // TODO what when blocks? BVT_INFO(p)->warpback = 0; 
    5.58  }
    5.59  
    5.60  /* Control the scheduler. */
    5.61 @@ -371,16 +373,17 @@ int bvt_adjdom(struct domain *p,
    5.62          
    5.63          spin_lock_irqsave(&CPU_INFO(p->processor)->run_lock, flags);   
    5.64          inf->mcu_advance = mcu_adv;
    5.65 -        inf->warpback = warpback; // TODO - temporary 
    5.66 -        inf->warp = 1;
    5.67 +        inf->warpback = warpback;  
    5.68 +        /* The warp should be the same as warpback */
    5.69 +        inf->warp = warpback;
    5.70          inf->warp_value = warpvalue;
    5.71          inf->warpl = warpl;
    5.72          inf->warpu = warpu;
    5.73  
    5.74          DPRINTK("Get domain %u bvt mcu_adv=%u, warpback=%d, warpvalue=%d"
    5.75 -                "warpl=%lld, warpu=%lld\n",
    5.76 +                "warpl=%lld, warpu=%lld, values(%lld, %lld)\n",
    5.77                  p->domain, inf->mcu_advance, inf->warpback, inf->warp_value,
    5.78 -                inf->warpl, inf->warpu);
    5.79 +                inf->warpl, inf->warpu, warpl, warpu);
    5.80  
    5.81          spin_unlock_irqrestore(&CPU_INFO(p->processor)->run_lock, flags);
    5.82      }
    5.83 @@ -434,7 +437,9 @@ static task_slice_t bvt_do_schedule(s_ti
    5.84          prev_inf->avt = calc_avt(prev, now);
    5.85          prev_inf->evt = calc_evt(prev, prev_inf->avt);
    5.86         
    5.87 -        rem_ac_timer(&prev_inf->warp_timer);
    5.88 +        if(prev_inf->warpback && prev_inf->warpl > 0)
    5.89 +            rem_ac_timer(&prev_inf->warp_timer);
    5.90 +        
    5.91          __del_from_runqueue(prev);
    5.92          
    5.93          if ( domain_runnable(prev) )
    5.94 @@ -484,6 +489,14 @@ static task_slice_t bvt_do_schedule(s_ti
    5.95              min_avt = p_inf->avt;
    5.96      }
    5.97      
    5.98 +    if(next_inf->warp && next_inf->warpl > 0)
    5.99 +    {
   5.100 +        /* Set the timer up */ 
   5.101 +        next_inf->warp_timer.expires = now + next_inf->warpl;
   5.102 +        /* Add it to the heap */
   5.103 +        add_ac_timer(&next_inf->warp_timer);
   5.104 +    }
   5.105 +   
   5.106      spin_unlock_irqrestore(&CPU_INFO(cpu)->run_lock, flags);
   5.107   
   5.108      /* Extract the domain pointers from the dom infos */
   5.109 @@ -543,13 +556,6 @@ static task_slice_t bvt_do_schedule(s_ti
   5.110      ASSERT(r_time >= ctx_allow);
   5.111  
   5.112   sched_done:
   5.113 -    if(next_inf->warp && next_inf->warpl > 0) // TODO - already added?
   5.114 -    {
   5.115 -        /* Set the timer up */ 
   5.116 -        next_inf->warp_timer.expires = now + next_inf->warpl;
   5.117 -        /* Add it to the heap */
   5.118 -        add_ac_timer(&next_inf->warp_timer);
   5.119 -    }
   5.120      ret.task = next;
   5.121      ret.time = r_time;
   5.122      return ret;