ia64/xen-unstable

changeset 303:4ace704a143f

bitkeeper revision 1.125 (3e71f9b97xoz4trwItZ94ikXgOSgOA)

BK merge and pull etc sucks
author rn@wyvis.research.intel-research.net
date Fri Mar 14 15:48:09 2003 +0000 (2003-03-14)
parents 18f05ecf3fef
children 9121aa1e3f33
files .bk-to-hg .hg-to-bk .rootkeys xen/common/dom0_ops.c xen/common/domain.c xen/common/keyhandler.c xen/common/perfc.c xen/include/xeno/ac_timer.h xen/include/xeno/perfc.h xen/include/xeno/perfc_defn.h xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/sched_ops.c
line diff
     1.1 --- a/.bk-to-hg	Fri Mar 14 15:43:32 2003 +0000
     1.2 +++ b/.bk-to-hg	Fri Mar 14 15:48:09 2003 +0000
     1.3 @@ -2,6 +2,8 @@
     1.4  set -e
     1.5  test -L old/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs
     1.6  rm      old/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs
     1.7 +test -L tools/domain_builder/dom0_ops.h
     1.8 +rm      tools/domain_builder/dom0_ops.h
     1.9  test -L xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs
    1.10  rm      xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs
    1.11  (find -depth -type d -print | xargs -r rmdir 2>/dev/null) || true
     2.1 --- a/.hg-to-bk	Fri Mar 14 15:43:32 2003 +0000
     2.2 +++ b/.hg-to-bk	Fri Mar 14 15:48:09 2003 +0000
     2.3 @@ -5,6 +5,9 @@ mkdir -p old/xenolinux-2.4.16-sparse
     2.4  mkdir -p old/xenolinux-2.4.16-sparse/include
     2.5  mkdir -p old/xenolinux-2.4.16-sparse/include/asm-xeno
     2.6  ln -s ../../../xen-2.4.16/include/hypervisor-ifs old/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs
     2.7 +mkdir -p tools
     2.8 +mkdir -p tools/domain_builder
     2.9 +ln -s ../../xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h tools/domain_builder/dom0_ops.h
    2.10  mkdir -p xenolinux-2.4.21-pre4-sparse
    2.11  mkdir -p xenolinux-2.4.21-pre4-sparse/include
    2.12  mkdir -p xenolinux-2.4.21-pre4-sparse/include/asm-xeno
     3.1 --- a/.rootkeys	Fri Mar 14 15:43:32 2003 +0000
     3.2 +++ b/.rootkeys	Fri Mar 14 15:48:09 2003 +0000
     3.3 @@ -182,6 +182,7 @@ 3e6377dbGcgnisKw16DPCaND7oGO3Q tools/bal
     3.4  3e4d00468-FN2VDeEHo96zxrMHK_mA tools/domain_builder/Makefile
     3.5  3e4d0046SPau_y0sw2WLJz8QkqNoRA tools/domain_builder/README
     3.6  3e4d0046bbdH0GsI9J_1Eb4ZQHfIiQ tools/domain_builder/dom0_defs.h
     3.7 +3e71f9b871pvOAxDrhxpC4N4mHkbww tools/domain_builder/dom0_ops.h
     3.8  3e4d0046ouLij_CMN_j7-dUHZIBI_A tools/domain_builder/dom_builder.c
     3.9  3e4d0046EKs06fY0CWDEgZQcn7DYUg tools/domain_builder/dom_kill.c
    3.10  3e4d0046aPbGiRTtdWxqY5b3ytWurA tools/domain_builder/hypervisor_defs.h
     4.1 --- a/xen/common/dom0_ops.c	Fri Mar 14 15:43:32 2003 +0000
     4.2 +++ b/xen/common/dom0_ops.c	Fri Mar 14 15:48:09 2003 +0000
     4.3 @@ -126,14 +126,22 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     4.4      }
     4.5      break;
     4.6  
     4.7 +    case DOM0_BVTCTL:
     4.8 +    {
     4.9 +        unsigned long  ctx_allow = op.u.bvtctl.ctx_allow;
    4.10 +        ret = sched_bvtctl(ctx_allow);
    4.11 +        
    4.12 +    }
    4.13 +    break;
    4.14 +
    4.15      case DOM0_ADJUSTDOM:
    4.16      {
    4.17          unsigned int   dom     = op.u.adjustdom.domain;
    4.18 -		unsigned long  mcu_adv = op.u.adjustdom.mcu_adv;
    4.19 -		unsigned long  warp    = op.u.adjustdom.warp;
    4.20 -		unsigned long  warpl   = op.u.adjustdom.warpl;
    4.21 -		unsigned long  warpu   = op.u.adjustdom.warpu;
    4.22 -		
    4.23 +        unsigned long  mcu_adv = op.u.adjustdom.mcu_adv;
    4.24 +        unsigned long  warp    = op.u.adjustdom.warp;
    4.25 +        unsigned long  warpl   = op.u.adjustdom.warpl;
    4.26 +        unsigned long  warpu   = op.u.adjustdom.warpu;
    4.27 +        
    4.28  
    4.29          if ( dom == IDLE_DOMAIN_ID )
    4.30          {
     5.1 --- a/xen/common/domain.c	Fri Mar 14 15:43:32 2003 +0000
     5.2 +++ b/xen/common/domain.c	Fri Mar 14 15:48:09 2003 +0000
     5.3 @@ -58,10 +58,11 @@ struct task_struct *do_newdomain(unsigne
     5.4      SET_GDT_ADDRESS(p, DEFAULT_GDT_ADDRESS);
     5.5  
     5.6      p->addr_limit = USER_DS;
     5.7 -    p->state      = TASK_UNINTERRUPTIBLE;
     5.8      p->active_mm  = &p->mm;
     5.9      p->num_net_vifs = 0;
    5.10  
    5.11 +    sched_add_domain(p);
    5.12 +
    5.13      p->net_ring_base = (net_ring_t *)(p->shared_info + 1);
    5.14      INIT_LIST_HEAD(&p->pg_head);
    5.15      p->max_pages = p->tot_pages = 0;
    5.16 @@ -115,7 +116,8 @@ void kill_domain(void)
    5.17      }
    5.18  
    5.19      printk("Killing domain %d\n", current->domain);
    5.20 -    current->state = TASK_DYING;
    5.21 +    
    5.22 +    sched_rem_domain(current);
    5.23      schedule();
    5.24      BUG(); /* never get here */
    5.25  }
    5.26 @@ -293,7 +295,7 @@ int final_setup_guestos(struct task_stru
    5.27  
    5.28      /* set up the shared info structure */
    5.29      update_dom_time(p->shared_info);
    5.30 -    p->shared_info->cpu_freq	 = cpu_freq;
    5.31 +    p->shared_info->cpu_freq     = cpu_freq;
    5.32      p->shared_info->domain_time  = 0;
    5.33  
    5.34      /* we pass start info struct to guest os as function parameter on stack */
    5.35 @@ -516,8 +518,8 @@ int setup_guestos(struct task_struct *p,
    5.36      unmap_domain_mem(l1start);
    5.37  
    5.38      /* Set up shared info area. */
    5.39 -	update_dom_time(p->shared_info);
    5.40 -	p->shared_info->cpu_freq	 = cpu_freq;
    5.41 +    update_dom_time(p->shared_info);
    5.42 +    p->shared_info->cpu_freq     = cpu_freq;
    5.43      p->shared_info->domain_time  = 0;
    5.44  
    5.45  
    5.46 @@ -555,7 +557,7 @@ int setup_guestos(struct task_struct *p,
    5.47  #define SHIP2GUEST(_x) (virt_shinfo_address | (((unsigned long)(_x)) & 0xFFF))
    5.48  
    5.49      virt_startinfo_address->net_rings = 
    5.50 -	(net_ring_t *)SHIP2GUEST(p->net_ring_base); 
    5.51 +    (net_ring_t *)SHIP2GUEST(p->net_ring_base); 
    5.52      virt_startinfo_address->num_net_rings = p->num_net_vifs;
    5.53  
    5.54      /* Add block io interface */
    5.55 @@ -597,7 +599,5 @@ int setup_guestos(struct task_struct *p,
    5.56  
    5.57  void __init domain_init(void)
    5.58  {
    5.59 -	printk("Initialising domains\n");
    5.60 +    printk("Initialising domains\n");
    5.61  }
    5.62 -
    5.63 -
     6.1 --- a/xen/common/keyhandler.c	Fri Mar 14 15:43:32 2003 +0000
     6.2 +++ b/xen/common/keyhandler.c	Fri Mar 14 15:48:09 2003 +0000
     6.3 @@ -1,8 +1,6 @@
     6.4  #include <xeno/keyhandler.h> 
     6.5  #include <xeno/reboot.h>
     6.6  
     6.7 -extern void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs);
     6.8 -
     6.9  #define KEY_MAX 256
    6.10  #define STR_MAX  64
    6.11  
    6.12 @@ -71,8 +69,6 @@ void halt_machine(u_char key, void *dev_
    6.13      return; 
    6.14  }
    6.15  
    6.16 -
    6.17 -
    6.18  /* XXX SMH: this is keir's fault */
    6.19  static char *task_states[] = 
    6.20  { 
    6.21 @@ -110,6 +106,8 @@ void do_task_queues(u_char key, void *de
    6.22  }
    6.23  
    6.24  
    6.25 +extern void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs);
    6.26 +extern void perfc_reset (u_char key, void *dev_id, struct pt_regs *regs);
    6.27  extern void dump_timerq(u_char key, void *dev_id, struct pt_regs *regs);
    6.28  extern void dump_runq(u_char key, void *dev_id, struct pt_regs *regs);
    6.29  
    6.30 @@ -127,6 +125,7 @@ void initialize_keytable()
    6.31      add_key_handler('d', dump_registers, "dump registers"); 
    6.32      add_key_handler('h', show_handlers,  "show this message");
    6.33      add_key_handler('p', perfc_printall, "print performance counters"); 
    6.34 +    add_key_handler('P', perfc_reset,    "reset performance counters"); 
    6.35      add_key_handler('q', do_task_queues, "dump task queues + guest state");
    6.36      add_key_handler('r', dump_runq,      "dump run queue"); 
    6.37      add_key_handler('R', halt_machine,   "reboot machine ungracefully"); 
     7.1 --- a/xen/common/perfc.c	Fri Mar 14 15:43:32 2003 +0000
     7.2 +++ b/xen/common/perfc.c	Fri Mar 14 15:48:09 2003 +0000
     7.3 @@ -2,8 +2,9 @@
     7.4   * xen performance counters
     7.5   */
     7.6  
     7.7 +#include <xeno/lib.h>
     7.8  #include <xeno/smp.h>
     7.9 -
    7.10 +#include <xeno/time.h>
    7.11  #include <xeno/perfc.h>
    7.12  #include <xeno/keyhandler.h> 
    7.13  
    7.14 @@ -31,74 +32,85 @@ void __perfc_print (unsigned long counte
    7.15    int num = 0;
    7.16  
    7.17    for (loop = 0; loop < sizeof(perfc_name) / sizeof(char *); loop++) {
    7.18 -	  if (perfc_name[loop][0] == 'C') {
    7.19 -		  element_size = NR_CPUS;
    7.20 -		  cpus = 1;
    7.21 -	  } else {
    7.22 -		  num = sscanf (perfc_name[loop], "[%d]", &element_size);
    7.23 -	  }
    7.24 +      if (perfc_name[loop][0] == 'C') {
    7.25 +          element_size = NR_CPUS;
    7.26 +          cpus = 1;
    7.27 +      } else {
    7.28 +          num = sscanf (perfc_name[loop], "[%d]", &element_size);
    7.29 +      }
    7.30  
    7.31 -	  total_size += element_size == 0 ? 1 : element_size;
    7.32 -	  if (total_size > offset) break;
    7.33 +      total_size += element_size == 0 ? 1 : element_size;
    7.34 +      if (total_size > offset) break;
    7.35    }
    7.36    if (loop == sizeof(perfc_name) / sizeof(char *)) {
    7.37 -	  printf ("error: couldn't find variable\n"); 
    7.38 -	  return;
    7.39 +      printf ("error: couldn't find variable\n"); 
    7.40 +      return;
    7.41    }
    7.42    if (element_size == 0) {                              /* single counter */
    7.43 -	  printf ("%10ld  0x%08lx  %s\n", counter[0], counter[0],
    7.44 -			  perfc_name[loop] + 2 + num);
    7.45 -  } else if (cpus) {									/* counter per CPU  */
    7.46 -	  for (loop = 0; loop < smp_num_cpus; loop++) {
    7.47 -		  printf ("%10ld  0x%08lx  cpu[%02d] %s\n", 
    7.48 -				  counter[loop], counter[loop], 
    7.49 -				  loop, perfc_name[loop]);
    7.50 -	  }
    7.51 -	  
    7.52 +      printf ("%10ld  0x%08lx  %s\n", counter[0], counter[0],
    7.53 +              perfc_name[loop] + 2 + num);
    7.54 +  } else if (cpus) {                                    /* counter per CPU  */
    7.55 +      for (loop = 0; loop < smp_num_cpus; loop++) {
    7.56 +          printf ("%10ld  0x%08lx  cpu[%02d] %s\n", 
    7.57 +                  counter[loop], counter[loop], 
    7.58 +                  loop, perfc_name[loop]);
    7.59 +      }
    7.60 +      
    7.61    } else {                                             /* show entire array */
    7.62 -	  for (loop = 0; loop < element_size; loop++) {
    7.63 -		  printf ("%10ld  0x%08lx  %s:%d\n", 
    7.64 -				  counter[loop], counter[loop], 
    7.65 -				  perfc_name[loop] + 2 + num, loop);
    7.66 -	  }
    7.67 +      for (loop = 0; loop < element_size; loop++) {
    7.68 +          printf ("%10ld  0x%08lx  %s:%d\n", 
    7.69 +                  counter[loop], counter[loop], 
    7.70 +                  perfc_name[loop] + 2 + num, loop);
    7.71 +      }
    7.72    }
    7.73    return;
    7.74  }
    7.75  
    7.76  void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs)
    7.77  {
    7.78 -	int loop, idx;
    7.79 -	int element_size;
    7.80 -	int cpus=0;
    7.81 -	int num = 0;
    7.82 -	unsigned long *counters = (unsigned long *)&perfcounters;
    7.83 -
    7.84 -	printf ("xen performance counters\n");
    7.85 +    int loop, idx;
    7.86 +    int element_size;
    7.87 +    int cpus=0;
    7.88 +    int num = 0;
    7.89 +    s_time_t now = NOW();
    7.90 +    unsigned long *counters = (unsigned long *)&perfcounters;
    7.91  
    7.92 -	for (loop = 0; loop < sizeof(perfc_name) / sizeof(char *); loop++) {
    7.93 +    printf ("xen performance counters: now=0x%08X%08X\n",
    7.94 +            (u32)(now>>32), (u32)now);
    7.95  
    7.96 -		if (perfc_name[loop][0] == 'C') {
    7.97 -			element_size = NR_CPUS;
    7.98 -			cpus = 1;
    7.99 -		} else {
   7.100 -			num = sscanf (perfc_name[loop], "[%d]", &element_size);
   7.101 -		}
   7.102 +    for (loop = 0; loop < sizeof(perfc_name) / sizeof(char *); loop++) {
   7.103 +
   7.104 +        if (perfc_name[loop][0] == 'C') {
   7.105 +            element_size = NR_CPUS;
   7.106 +            cpus = 1;
   7.107 +        } else {
   7.108 +            num = sscanf (perfc_name[loop], "[%d]", &element_size);
   7.109 +        }
   7.110      
   7.111 -		for (idx = 0; idx < (element_size ? element_size : 1); idx++) {
   7.112 -			if (cpus) {
   7.113 -				if (idx < smp_num_cpus)
   7.114 -					printf ("%10ld  0x%08lx  cpu[%02d] %s\n", 
   7.115 -							*counters, *counters, idx, perfc_name[loop] + 1);
   7.116 -			} else if (element_size) {
   7.117 -				printf ("%10ld  0x%08lx  %s:%d\n", 
   7.118 -						*counters, *counters, perfc_name[loop] + num + 2, idx);
   7.119 -			} else {
   7.120 -				printf ("%10ld  0x%08lx  %s\n", 
   7.121 -						*counters, *counters, perfc_name[loop] + num + 2);
   7.122 -			}
   7.123 -			counters++;
   7.124 -		}
   7.125 -	}
   7.126 +        for (idx = 0; idx < (element_size ? element_size : 1); idx++) {
   7.127 +            if (cpus) {
   7.128 +                if (idx < smp_num_cpus)
   7.129 +                    printf ("%10ld  0x%08lx  cpu[%02d] %s\n", 
   7.130 +                            *counters, *counters, idx, perfc_name[loop] + 1);
   7.131 +            } else if (element_size) {
   7.132 +                printf ("%10ld  0x%08lx  %s:%d\n", 
   7.133 +                        *counters, *counters, perfc_name[loop] + num + 2, idx);
   7.134 +            } else {
   7.135 +                printf ("%10ld  0x%08lx  %s\n", 
   7.136 +                        *counters, *counters, perfc_name[loop] + num + 2);
   7.137 +            }
   7.138 +            counters++;
   7.139 +        }
   7.140 +    }
   7.141  
   7.142 -	return;
   7.143 +    return;
   7.144  }
   7.145 +
   7.146 +void perfc_reset (u_char key, void *dev_id, struct pt_regs *regs)
   7.147 +{
   7.148 +    s_time_t now = NOW();
   7.149 +    printk ("xen performance counters reset: now=0x%08X%08X\n",
   7.150 +            (u32)(now>>32), (u32)now);
   7.151 +    memset (&perfcounters, 0, sizeof(perfcounters));
   7.152 +}
   7.153 +
     8.1 --- a/xen/include/xeno/ac_timer.h	Fri Mar 14 15:43:32 2003 +0000
     8.2 +++ b/xen/include/xeno/ac_timer.h	Fri Mar 14 15:48:09 2003 +0000
     8.3 @@ -43,10 +43,10 @@
     8.4   */
     8.5  
     8.6  struct ac_timer {
     8.7 -	struct list_head timer_list;
     8.8 -	s_time_t         expires;	/* system time time out value */
     8.9 -	unsigned long    data;
    8.10 -	void             (*function)(unsigned long);
    8.11 +    struct list_head timer_list;
    8.12 +    s_time_t         expires;   /* system time time out value */
    8.13 +    unsigned long    data;
    8.14 +    void             (*function)(unsigned long);
    8.15  };
    8.16  
    8.17  /* interface for "clients" */
    8.18 @@ -55,7 +55,7 @@ extern int rem_ac_timer(struct ac_timer 
    8.19  extern int mod_ac_timer(struct ac_timer *timer, s_time_t new_time);
    8.20  static inline void init_ac_timer(struct ac_timer *timer)
    8.21  {
    8.22 -	//timer->next = NULL;
    8.23 +    timer->timer_list.next = NULL;
    8.24  }
    8.25  
    8.26  /* interface used by programmable timer, implemented hardware dependent */
     9.1 --- a/xen/include/xeno/perfc.h	Fri Mar 14 15:43:32 2003 +0000
     9.2 +++ b/xen/include/xeno/perfc.h	Fri Mar 14 15:48:09 2003 +0000
     9.3 @@ -10,14 +10,18 @@
     9.4   * PERFCOUNTER_ARRY (counter, string, size)   define an array of counters
     9.5   * 
     9.6   * unsigned long perfc_value  (counter)        get value of a counter  
     9.7 + * unsigned long perfc_valuec (counter)        get value of a per CPU counter
     9.8   * unsigned long perfc_valuea (counter, index) get value of an array counter
     9.9 - * void perfc_incr  (counter)                 increment a counter          
    9.10 - * void perfc_incrc (counter, index)          increment a per CPU counter   
    9.11 - * void perfc_incra (counter, index)          increment an array counter   
    9.12 - * void perfc_add   (counter, value)          add a value to a counter     
    9.13 - * void perfc_addc  (counter, value)          add a value to a per CPU counter 
    9.14 - * void perfc_adda  (counter, index, value)   add a value to array counter 
    9.15 - * void perfc_print (counter)                 print out the counter
    9.16 + * unsigned long perfc_set  (counter, val)     set value of a counter  
    9.17 + * unsigned long perfc_setc (counter, val)     set value of a per CPU counter
    9.18 + * unsigned long perfc_seta (counter, index, val) set value of an array counter
    9.19 + * void perfc_incr  (counter)                  increment a counter          
    9.20 + * void perfc_incrc (counter, index)           increment a per CPU counter   
    9.21 + * void perfc_incra (counter, index)           increment an array counter   
    9.22 + * void perfc_add   (counter, value)           add a value to a counter     
    9.23 + * void perfc_addc  (counter, value)           add a value to a per CPU counter
    9.24 + * void perfc_adda  (counter, index, value)    add a value to array counter 
    9.25 + * void perfc_print (counter)                  print out the counter
    9.26   */
    9.27  
    9.28  #define PERFCOUNTER( var, name ) \
    9.29 @@ -38,6 +42,9 @@ extern char *perfc_name[];
    9.30  #define perfc_value(x)    perfcounters.x[0]
    9.31  #define perfc_valuec(x)   perfcounters.x[smp_processor_id()]
    9.32  #define perfc_valuea(x,y) perfcounters.x[y]
    9.33 +#define perfc_set(x,v)    perfcounters.x[0] = v
    9.34 +#define perfc_setc(x,v)   perfcounters.x[smp_processor_id()] = v
    9.35 +#define perfc_seta(x,y,v) perfcounters.x[y] = v
    9.36  #define perfc_incr(x)     perfcounters.x[0]++
    9.37  #define perfc_incrc(x)    perfcounters.x[smp_processor_id()]++
    9.38  #define perfc_incra(x,y)  perfcounters.x[y]++
    10.1 --- a/xen/include/xeno/perfc_defn.h	Fri Mar 14 15:43:32 2003 +0000
    10.2 +++ b/xen/include/xeno/perfc_defn.h	Fri Mar 14 15:48:09 2003 +0000
    10.3 @@ -1,9 +1,13 @@
    10.4 -
    10.5 -PERFCOUNTER( blockio_tx, "block io: messages received from tx queue" )
    10.6 -PERFCOUNTER( blockio_rx, "block io: messages sent on rx queue" )
    10.7 +PERFCOUNTER_CPU( irqs,         "#interrupts" )
    10.8 +PERFCOUNTER_CPU( irq_time,     "cycles spent in irq handler" )
    10.9  
   10.10 -PERFCOUNTER_CPU( apic_timer, "apic timer interrupts" )
   10.11 -PERFCOUNTER_CPU( sched_irq,  "sched: timer" )
   10.12 -PERFCOUNTER_CPU( sched_run1, "sched: calls to schedule" )
   10.13 -PERFCOUNTER_CPU( sched_run2, "sched: runs through scheduler" )
   10.14 +PERFCOUNTER( blockio_tx,       "block io: messages received from tx queue" )
   10.15 +PERFCOUNTER( blockio_rx,       "block io: messages sent on rx queue" )
   10.16  
   10.17 +PERFCOUNTER_CPU( apic_timer,   "apic timer interrupts" )
   10.18 +PERFCOUNTER_CPU( ac_timer_max, "ac_timer max error (ns)" )
   10.19 +PERFCOUNTER_CPU( sched_irq,    "sched: timer" )
   10.20 +PERFCOUNTER_CPU( sched_run1,   "sched: calls to schedule" )
   10.21 +PERFCOUNTER_CPU( sched_run2,   "sched: runs through scheduler" )
   10.22 +PERFCOUNTER_CPU( sched_ctx,    "sched: context switches" )
   10.23 +
    11.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h	Fri Mar 14 15:43:32 2003 +0000
    11.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h	Fri Mar 14 15:48:09 2003 +0000
    11.3 @@ -6,6 +6,7 @@
    11.4   * Copyright (c) 2002, K A Fraser, B Dragovic
    11.5   * 
    11.6   * MUST BE KEPT IN SYNC WITH xen/include/xeno/dom0_ops.h
    11.7 + * MUST BE KEPT IN SYNC WITH tools/domain_builder/dom0_ops.h
    11.8   */
    11.9  
   11.10  #define DOM0_NEWDOMAIN   0
   11.11 @@ -43,16 +44,16 @@ typedef struct dom0_getmemlist_st
   11.12  
   11.13  typedef struct dom0_bvtctl_st
   11.14  {
   11.15 -	unsigned long ctx_allow;	/* context switch allowance */
   11.16 +    unsigned long ctx_allow;    /* context switch allowance */
   11.17  } dom0_bvtctl_t;
   11.18  
   11.19  typedef struct dom0_adjustdom_st
   11.20  {
   11.21 -    unsigned int  domain;	/* domain id */
   11.22 -	unsigned long mcu_adv;	/* mcu advance: inverse of weight */
   11.23 -	unsigned long warp;     /* time warp */
   11.24 -	unsigned long warpl;    /* warp limit */
   11.25 -	unsigned long warpu;    /* unwarp time requirement */
   11.26 +    unsigned int  domain;   /* domain id */
   11.27 +    unsigned long mcu_adv;  /* mcu advance: inverse of weight */
   11.28 +    unsigned long warp;     /* time warp */
   11.29 +    unsigned long warpl;    /* warp limit */
   11.30 +    unsigned long warpu;    /* unwarp time requirement */
   11.31  } dom0_adjustdom_t;
   11.32  
   11.33  /* This is entirely processed by XenoLinux */
   11.34 @@ -92,8 +93,8 @@ typedef struct dom0_op_st
   11.35          dom0_newdomain_t newdomain;
   11.36          dom0_killdomain_t killdomain;
   11.37          dom0_getmemlist_t getmemlist;
   11.38 -		dom0_bvtctl_t bvtctl;
   11.39 -		dom0_adjustdom_t adjustdom;
   11.40 +        dom0_bvtctl_t bvtctl;
   11.41 +        dom0_adjustdom_t adjustdom;
   11.42          dom_mem_t dommem;
   11.43          dom_pgupdate_t pgupdate;
   11.44          dom_meminfo_t meminfo;
    12.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/sched_ops.c	Fri Mar 14 15:43:32 2003 +0000
    12.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/sched_ops.c	Fri Mar 14 15:48:09 2003 +0000
    12.3 @@ -16,26 +16,33 @@
    12.4   *
    12.5   * Commands understood by the interface:
    12.6   *
    12.7 - * S <did> <mcu advance> [ <warp> <warp limit> <unwarp limit> ]
    12.8   * C <context swith allowance>
    12.9 + * S <did> <mcu advance> <warp> <warp limit> <unwarp limit>
   12.10   *
   12.11   ****************************************************************************
   12.12   * $Id: c-insert.c,v 1.7 2002/11/08 16:04:34 rn Exp $
   12.13   ****************************************************************************
   12.14   */
   12.15  
   12.16 +#include <linux/config.h>
   12.17 +#include <linux/module.h>
   12.18 +#include <linux/kernel.h>
   12.19 +#include <linux/sched.h>
   12.20 +#include <linux/ctype.h>
   12.21 +#include <linux/string.h>
   12.22 +#include <linux/errno.h>
   12.23 +#include <linux/proc_fs.h>
   12.24  
   12.25 -#include <linux/proc_fs.h>
   12.26 -#include <asm/hypervisor.h>
   12.27  #include "dom0_ops.h"
   12.28  
   12.29  #define SCHED_ENTRY    "sched"
   12.30  extern struct proc_dir_entry *xeno_base;
   12.31  static struct proc_dir_entry *sched_pde;
   12.32  
   12.33 +static unsigned char readbuf[1024];
   12.34  
   12.35  static int sched_read_proc(char *page, char **start, off_t off,
   12.36 -						   int count, int *eof, void *data)
   12.37 +                           int count, int *eof, void *data)
   12.38  {   
   12.39      strcpy(page, readbuf);
   12.40      *readbuf = '\0';
   12.41 @@ -46,35 +53,57 @@ static int sched_read_proc(char *page, c
   12.42  
   12.43  
   12.44  static int sched_write_proc(struct file *file, const char *buffer,
   12.45 -							u_long count, void *data)
   12.46 +                            u_long count, void *data)
   12.47  {
   12.48 -	dom0_op_t op;
   12.49 +    dom0_op_t op;
   12.50  
   12.51 -	int ret, len;
   12.52 -	int ts, te, tl; /* token start, end, and length */
   12.53 +    int ret, len;
   12.54 +    int ts, te, tl; /* token start, end, and length */
   12.55  
   12.56      /* Only admin can adjust scheduling parameters */
   12.57      if ( !capable(CAP_SYS_ADMIN) )
   12.58          return -EPERM;
   12.59  
   12.60 -	/* parse the commands  */
   12.61 -	len = count;
   12.62 -	ts = te = 0;
   12.63 -
   12.64 -	while ( count && isspace(buffer[ts]) ) { ts++; count--; } // skip spaces.
   12.65 -	te = ts;
   12.66 -	if ( te <= ts ) goto bad;
   12.67 -	tl = te - ts;
   12.68 +    /* parse the commands  */
   12.69 +    len = count;
   12.70 +    ts = te = 0;
   12.71  
   12.72 -	if ( strncmp(&buffer[ts], "S", tl) == 0 )
   12.73 -	{
   12.74 -		op.cmd = NETWORK_OP_ADDRULE;
   12.75 -	}
   12.76 -	else if ( strncmp(&buffer[ts], "C", tl) == 0 )
   12.77 -	{
   12.78 -		op.cmd = NETWORK_OP_DELETERULE;
   12.79 -	}
   12.80 +    while ( count && isspace(buffer[ts]) ) { ts++; count--; } /*skip spaces*/
   12.81 +    te = ts;
   12.82 +    while ( count && !isspace(buffer[te]) ) { te++; count--; } /*command end*/
   12.83 +    if ( te <= ts ) goto bad;
   12.84 +    tl = te - ts;
   12.85  
   12.86 +    if ( strncmp(&buffer[ts], "C", tl) == 0 ) {
   12.87 +        op.cmd = DOM0_BVTCTL;
   12.88 +    } else if ( strncmp(&buffer[ts], "S", tl) == 0 ) {
   12.89 +        op.cmd = DOM0_ADJUSTDOM;
   12.90 +    } else
   12.91 +        goto bad;
   12.92 +
   12.93 +    /* skip whitspaces and get first parameter */
   12.94 +    ts = te; while ( count &&  isspace(buffer[ts]) ) { ts++; count--; }
   12.95 +    te = ts; while ( count && !isspace(buffer[te]) ) { te++; count--; }
   12.96 +    if ( te <= ts ) goto bad;
   12.97 +    tl = te - ts;
   12.98 +    if ( !isdigit(buffer[ts]) ) goto bad;
   12.99 +
  12.100 +    if (op.cmd == DOM0_BVTCTL) {
  12.101 +        /* get context switch allowance  */
  12.102 +        sscanf(&buffer[ts], "%lu", &op.u.bvtctl.ctx_allow);
  12.103 +    } else if (op.cmd == DOM0_ADJUSTDOM) {
  12.104 +        sscanf(&buffer[ts], "%u %lu %lu %lu %lu",
  12.105 +               &op.u.adjustdom.domain,
  12.106 +               &op.u.adjustdom.mcu_adv,
  12.107 +               &op.u.adjustdom.warp,
  12.108 +               &op.u.adjustdom.warpl,
  12.109 +               &op.u.adjustdom.warpu);
  12.110 +    }
  12.111 +    ret = HYPERVISOR_dom0_op(&op);
  12.112 +    return sizeof(op);
  12.113 +    
  12.114 + bad:
  12.115 +    return -EINVAL;
  12.116  
  12.117  }
  12.118