direct-io.hg

changeset 877:d1833d5b387b

bitkeeper revision 1.546.1.1 (3fa3e1b4UwJQtnD-lZcvMsbqR-XhSA)

sched hypercall unification -- tidying things up in
anticipation of suspend/resume
author akw27@labyrinth.cl.cam.ac.uk
date Sat Nov 01 16:39:16 2003 +0000 (2003-11-01)
parents 64754ee21add
children 61c3759bc7be
files xen/arch/i386/entry.S xen/common/schedule.c xen/include/hypervisor-ifs/hypervisor-if.h xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h
line diff
     1.1 --- a/xen/arch/i386/entry.S	Fri Oct 31 16:36:13 2003 +0000
     1.2 +++ b/xen/arch/i386/entry.S	Sat Nov 01 16:39:16 2003 +0000
     1.3 @@ -713,8 +713,7 @@ ENTRY(hypervisor_call_table)
     1.4          .long SYMBOL_NAME(do_set_callbacks)
     1.5          .long SYMBOL_NAME(do_net_io_op)
     1.6          .long SYMBOL_NAME(do_fpu_taskswitch)
     1.7 -        .long SYMBOL_NAME(do_yield)
     1.8 -        .long SYMBOL_NAME(kill_domain)
     1.9 +        .long SYMBOL_NAME(do_sched_op)
    1.10          .long SYMBOL_NAME(do_dom0_op)
    1.11          .long SYMBOL_NAME(do_network_op)
    1.12          .long SYMBOL_NAME(do_block_io_op)
     2.1 --- a/xen/common/schedule.c	Fri Oct 31 16:36:13 2003 +0000
     2.2 +++ b/xen/common/schedule.c	Sat Nov 01 16:39:16 2003 +0000
     2.3 @@ -111,9 +111,9 @@ static void __calc_evt(struct task_struc
     2.4  }
     2.5  
     2.6  
     2.7 -/******************************************************************************
     2.8 -* Add and remove a domain
     2.9 -******************************************************************************/
    2.10 +/*
    2.11 + * Add and remove a domain
    2.12 + */
    2.13  void sched_add_domain(struct task_struct *p) 
    2.14  {
    2.15      p->state       = TASK_SUSPENDED;
    2.16 @@ -157,9 +157,9 @@ void init_idle_task(void)
    2.17  }
    2.18  
    2.19  
    2.20 -/****************************************************************************
    2.21 +/*
    2.22   * wake up a domain which had been sleeping
    2.23 - ****************************************************************************/
    2.24 + */
    2.25  int wake_up(struct task_struct *p)
    2.26  {
    2.27      unsigned long flags;
    2.28 @@ -194,9 +194,9 @@ int wake_up(struct task_struct *p)
    2.29      return ret;
    2.30  }
    2.31  
    2.32 -/****************************************************************************
    2.33 +/*
    2.34   * Voluntarily yield the processor to another domain, until an event occurs.
    2.35 - ****************************************************************************/
    2.36 + */
    2.37  long do_yield(void)
    2.38  {
    2.39      current->state = TASK_INTERRUPTIBLE;
    2.40 @@ -205,18 +205,47 @@ long do_yield(void)
    2.41      return 0;
    2.42  }
    2.43  
    2.44 -/****************************************************************************
    2.45 +/*
    2.46 + *  Demultiplex scheduler-related hypercalls.
    2.47 + */
    2.48 +long do_sched_op(unsigned long op)
    2.49 +{
    2.50 +    long ret = 0;
    2.51 +
    2.52 +    switch( op ) 
    2.53 +    {
    2.54 +
    2.55 +    case SCHEDOP_yield:
    2.56 +    {
    2.57 +        ret = do_yield();
    2.58 +        break;
    2.59 +    }
    2.60 +
    2.61 +    case SCHEDOP_exit:
    2.62 +    {
    2.63 +        kill_domain();
    2.64 +        break;
    2.65 +    }
    2.66 +
    2.67 +    default:
    2.68 +        ret = -ENOSYS;
    2.69 +    }
    2.70 +
    2.71 +    return ret;
    2.72 +}
    2.73 +
    2.74 +/*
    2.75   * Control the scheduler
    2.76 - ****************************************************************************/
    2.77 + */
    2.78  long sched_bvtctl(unsigned long c_allow)
    2.79  {
    2.80      ctx_allow = c_allow;
    2.81      return 0;
    2.82  }
    2.83  
    2.84 -/****************************************************************************
    2.85 +/*
    2.86   * Adjust scheduling parameter for a given domain
    2.87 - ****************************************************************************/
    2.88 + */
    2.89  long sched_adjdom(int dom, unsigned long mcu_adv, unsigned long warp, 
    2.90                   unsigned long warpl, unsigned long warpu)
    2.91  {
    2.92 @@ -239,14 +268,14 @@ long sched_adjdom(int dom, unsigned long
    2.93      return 0;
    2.94  }
    2.95  
    2.96 -/****************************************************************************
    2.97 +/*
    2.98   * cause a run through the scheduler when appropriate
    2.99   * Appropriate is:
   2.100   * - current task is idle task
   2.101   * - the current task already ran for it's context switch allowance
   2.102   * Otherwise we do a run through the scheduler after the current tasks 
   2.103   * context switch allowance is over.
   2.104 - ****************************************************************************/
   2.105 + */
   2.106  void reschedule(struct task_struct *p)
   2.107  {
   2.108      int cpu = p->processor;
   2.109 @@ -286,13 +315,13 @@ void reschedule(struct task_struct *p)
   2.110  }
   2.111  
   2.112  
   2.113 -/**************************************************************************** 
   2.114 +/* 
   2.115   * The main function
   2.116   * - deschedule the current domain.
   2.117   * - pick a new domain.
   2.118   *   i.e., the domain with lowest EVT.
   2.119   *   The runqueue should be ordered by EVT so that is easy.
   2.120 - ****************************************************************************/
   2.121 + */
   2.122  asmlinkage void __enter_scheduler(void)
   2.123  {
   2.124      struct task_struct *prev, *next, *next_prime, *p;
     3.1 --- a/xen/include/hypervisor-ifs/hypervisor-if.h	Fri Oct 31 16:36:13 2003 +0000
     3.2 +++ b/xen/include/hypervisor-ifs/hypervisor-if.h	Sat Nov 01 16:39:16 2003 +0000
     3.3 @@ -48,19 +48,18 @@
     3.4  #define __HYPERVISOR_set_callbacks         5
     3.5  #define __HYPERVISOR_net_io_op             6
     3.6  #define __HYPERVISOR_fpu_taskswitch        7
     3.7 -#define __HYPERVISOR_yield                 8
     3.8 -#define __HYPERVISOR_exit                  9
     3.9 -#define __HYPERVISOR_dom0_op              10
    3.10 -#define __HYPERVISOR_network_op           11
    3.11 -#define __HYPERVISOR_block_io_op          12
    3.12 -#define __HYPERVISOR_set_debugreg         13
    3.13 -#define __HYPERVISOR_get_debugreg         14
    3.14 -#define __HYPERVISOR_update_descriptor    15
    3.15 -#define __HYPERVISOR_set_fast_trap        16
    3.16 -#define __HYPERVISOR_dom_mem_op           17
    3.17 -#define __HYPERVISOR_multicall            18
    3.18 -#define __HYPERVISOR_kbd_op               19
    3.19 -#define __HYPERVISOR_update_va_mapping    20
    3.20 +#define __HYPERVISOR_sched_op              8
    3.21 +#define __HYPERVISOR_dom0_op               9
    3.22 +#define __HYPERVISOR_network_op           10
    3.23 +#define __HYPERVISOR_block_io_op          11
    3.24 +#define __HYPERVISOR_set_debugreg         12
    3.25 +#define __HYPERVISOR_get_debugreg         13
    3.26 +#define __HYPERVISOR_update_descriptor    14
    3.27 +#define __HYPERVISOR_set_fast_trap        15
    3.28 +#define __HYPERVISOR_dom_mem_op           16
    3.29 +#define __HYPERVISOR_multicall            17
    3.30 +#define __HYPERVISOR_kbd_op               18
    3.31 +#define __HYPERVISOR_update_va_mapping    19
    3.32  
    3.33  /* And the trap vector is... */
    3.34  #define TRAP_INSTR "int $0x82"
    3.35 @@ -152,6 +151,14 @@
    3.36  #define EVENTS_MASTER_ENABLE_BIT  31
    3.37  
    3.38  
    3.39 +/*
    3.40 + * SCHEDOP_* - Scheduler hypercall operations.
    3.41 + */
    3.42 +#define SCHEDOP_yield           0
    3.43 +#define SCHEDOP_exit            1
    3.44 +
    3.45 + 
    3.46 +
    3.47  #ifndef __ASSEMBLY__
    3.48  
    3.49  #include "network.h"
     4.1 --- a/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h	Fri Oct 31 16:36:13 2003 +0000
     4.2 +++ b/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h	Sat Nov 01 16:39:16 2003 +0000
     4.3 @@ -245,7 +245,8 @@ static inline int HYPERVISOR_yield(void)
     4.4      int ret;
     4.5      __asm__ __volatile__ (
     4.6          TRAP_INSTR
     4.7 -        : "=a" (ret) : "0" (__HYPERVISOR_yield) );
     4.8 +        : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
     4.9 +        "b" (SCHEDOP_yield) );
    4.10  
    4.11      return ret;
    4.12  }
    4.13 @@ -255,7 +256,8 @@ static inline int HYPERVISOR_exit(void)
    4.14      int ret;
    4.15      __asm__ __volatile__ (
    4.16          TRAP_INSTR
    4.17 -        : "=a" (ret) : "0" (__HYPERVISOR_exit) );
    4.18 +        : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
    4.19 +        "b" (SCHEDOP_exit) );
    4.20  
    4.21      return ret;
    4.22  }