ia64/xen-unstable

changeset 3097:2754a2ed61c3

bitkeeper revision 1.1159.183.8 (41a48ecb-kyT4HkGQjkDbgLd2-x-Kw)

Merge arcadians.cl.cam.ac.uk:/auto/groups/xeno/BK/xen-2.0-testing.bk
into arcadians.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
author cl349@arcadians.cl.cam.ac.uk
date Wed Nov 24 13:38:19 2004 +0000 (2004-11-24)
parents f068615fc588 6b22a56f55d3
children f1c44a4d4998 cc15210b2832
files xen/arch/x86/domain.c xen/arch/x86/i8259.c xen/arch/x86/memory.c xen/arch/x86/traps.c xen/arch/x86/x86_32/entry.S xen/common/dom_mem_ops.c xen/common/grant_table.c xen/include/asm-x86/x86_32/regs.h xen/include/xen/irq_cpustat.h xen/include/xen/keyhandler.h xen/include/xen/sched.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Tue Nov 23 22:48:27 2004 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Wed Nov 24 13:38:19 2004 +0000
     1.3 @@ -426,6 +426,22 @@ long do_iopl(domid_t domain, unsigned in
     1.4      return 0;
     1.5  }
     1.6  
     1.7 +void hypercall_create_continuation(unsigned int op, unsigned int nr_args, ...)
     1.8 +{
     1.9 +    execution_context_t *ec = get_execution_context();
    1.10 +    unsigned long *preg = &ec->ebx;
    1.11 +    unsigned int i;
    1.12 +    va_list args;
    1.13 +
    1.14 +    ec->eax  = op;
    1.15 +    ec->eip -= 2;  /* re-execute 'int 0x82' */
    1.16 +
    1.17 +    va_start(args, nr_args);
    1.18 +    for ( i = 0; i < nr_args; i++ )
    1.19 +        *preg++ = va_arg(args, unsigned long);
    1.20 +    va_end(args);
    1.21 +}
    1.22 +
    1.23  #endif
    1.24  
    1.25  
     2.1 --- a/xen/arch/x86/i8259.c	Tue Nov 23 22:48:27 2004 +0000
     2.2 +++ b/xen/arch/x86/i8259.c	Wed Nov 24 13:38:19 2004 +0000
     2.3 @@ -7,6 +7,7 @@
     2.4  
     2.5  #include <xen/config.h>
     2.6  #include <xen/init.h>
     2.7 +#include <xen/types.h>
     2.8  #include <asm/regs.h>
     2.9  #include <xen/errno.h>
    2.10  #include <xen/sched.h>
     3.1 --- a/xen/arch/x86/memory.c	Tue Nov 23 22:48:27 2004 +0000
     3.2 +++ b/xen/arch/x86/memory.c	Wed Nov 24 13:38:19 2004 +0000
     3.3 @@ -1300,6 +1300,9 @@ int do_mmu_update(mmu_update_t *ureqs, i
     3.4  
     3.5      for ( i = 0; i < count; i++ )
     3.6      {
     3.7 +        hypercall_may_preempt(
     3.8 +            __HYPERVISOR_mmu_update, 3, ureqs, count-i, success_count);
     3.9 +
    3.10          if ( unlikely(__copy_from_user(&req, ureqs, sizeof(req)) != 0) )
    3.11          {
    3.12              MEM_LOG("Bad __copy_from_user");
    3.13 @@ -1455,7 +1458,7 @@ int do_mmu_update(mmu_update_t *ureqs, i
    3.14      }
    3.15  
    3.16      if ( unlikely(success_count != NULL) )
    3.17 -        put_user(count, success_count);
    3.18 +        put_user(i, success_count);
    3.19  
    3.20      return rc;
    3.21  }
     4.1 --- a/xen/arch/x86/traps.c	Tue Nov 23 22:48:27 2004 +0000
     4.2 +++ b/xen/arch/x86/traps.c	Wed Nov 24 13:38:19 2004 +0000
     4.3 @@ -804,6 +804,8 @@ long do_set_trap_table(trap_info_t *trap
     4.4  
     4.5      for ( ; ; )
     4.6      {
     4.7 +        hypercall_may_preempt(__HYPERVISOR_set_trap_table, 1, traps);
     4.8 +
     4.9          if ( copy_from_user(&cur, traps, sizeof(cur)) ) return -EFAULT;
    4.10  
    4.11          if ( cur.address == 0 ) break;
     5.1 --- a/xen/arch/x86/x86_32/entry.S	Tue Nov 23 22:48:27 2004 +0000
     5.2 +++ b/xen/arch/x86/x86_32/entry.S	Wed Nov 24 13:38:19 2004 +0000
     5.3 @@ -95,6 +95,11 @@ do_multicall:
     5.4          jnc   bad_multicall_address
     5.5  multicall_loop:
     5.6          pushl %ecx
     5.7 +        movl  4(%esp),%ecx               # %ecx = struct domain
     5.8 +        movl  DOMAIN_processor(%ecx),%eax
     5.9 +        shl   $6,%eax                    # sizeof(irq_cpustat) == 64
    5.10 +        testl $~0,SYMBOL_NAME(irq_stat)(%eax,1)
    5.11 +        jnz   multicall_preempt
    5.12  multicall_fault1: 
    5.13          pushl 20(%ebx)      # args[4]
    5.14  multicall_fault2: 
    5.15 @@ -120,6 +125,17 @@ multicall_fault7:
    5.16          xorl  %eax,%eax
    5.17          jmp   ret_from_hypercall
    5.18  
    5.19 +multicall_preempt:
    5.20 +        # NB. remaining nr_calls is already at top of stack
    5.21 +        pushl %ebx                             # call_list
    5.22 +        pushl $2                               # nr_args == 2
    5.23 +        pushl $__HYPERVISOR_multicall          # op == __HYPERVISOR_multicall
    5.24 +        call  hypercall_create_continuation
    5.25 +        addl  $16,%esp
    5.26 +        popl  %ebx
    5.27 +        movl  $__HYPERVISOR_multicall,%eax        
    5.28 +        jmp   ret_from_hypercall
    5.29 +        
    5.30  bad_multicall_address:
    5.31          popl  %ebx
    5.32          movl  $-EFAULT,%eax
     6.1 --- a/xen/common/dom_mem_ops.c	Tue Nov 23 22:48:27 2004 +0000
     6.2 +++ b/xen/common/dom_mem_ops.c	Wed Nov 24 13:38:19 2004 +0000
     6.3 @@ -35,6 +35,12 @@ static long alloc_dom_mem(struct domain 
     6.4  
     6.5      for ( i = 0; i < nr_extents; i++ )
     6.6      {
     6.7 +        hypercall_may_preempt(
     6.8 +            __HYPERVISOR_dom_mem_op, 5,
     6.9 +            MEMOP_increase_reservation,
    6.10 +            &extent_list[i], nr_extents-i, extent_order,
    6.11 +            (d == current) ? DOMID_SELF : d->id);
    6.12 +
    6.13          if ( unlikely((page = alloc_domheap_pages(d, extent_order)) == NULL) )
    6.14          {
    6.15              DPRINTK("Could not allocate a frame\n");
    6.16 @@ -63,6 +69,12 @@ static long free_dom_mem(struct domain *
    6.17  
    6.18      for ( i = 0; i < nr_extents; i++ )
    6.19      {
    6.20 +        hypercall_may_preempt(
    6.21 +            __HYPERVISOR_dom_mem_op, 5,
    6.22 +            MEMOP_decrease_reservation,
    6.23 +            &extent_list[i], nr_extents-i, extent_order,
    6.24 +            (d == current) ? DOMID_SELF : d->id);
    6.25 +
    6.26          if ( unlikely(__get_user(mpfn, &extent_list[i]) != 0) )
    6.27              return i;
    6.28  
     7.1 --- a/xen/common/grant_table.c	Tue Nov 23 22:48:27 2004 +0000
     7.2 +++ b/xen/common/grant_table.c	Wed Nov 24 13:38:19 2004 +0000
     7.3 @@ -437,6 +437,9 @@ do_grant_table_op(
     7.4  {
     7.5      long rc;
     7.6  
     7.7 +    /* XXX stubbed out XXX */
     7.8 +    return -ENOSYS;
     7.9 +
    7.10      if ( count > 512 )
    7.11          return -EINVAL;
    7.12  
     8.1 --- a/xen/include/asm-x86/x86_32/regs.h	Tue Nov 23 22:48:27 2004 +0000
     8.2 +++ b/xen/include/asm-x86/x86_32/regs.h	Wed Nov 24 13:38:19 2004 +0000
     8.3 @@ -1,8 +1,6 @@
     8.4  #ifndef _I386_REGS_H
     8.5  #define _I386_REGS_H
     8.6  
     8.7 -#include <xen/types.h>
     8.8 -
     8.9  struct xen_regs
    8.10  {
    8.11      /* All saved activations contain the following fields. */
     9.1 --- a/xen/include/xen/irq_cpustat.h	Tue Nov 23 22:48:27 2004 +0000
     9.2 +++ b/xen/include/xen/irq_cpustat.h	Wed Nov 24 13:38:19 2004 +0000
     9.3 @@ -10,6 +10,7 @@
     9.4   */
     9.5  
     9.6  #include <xen/config.h>
     9.7 +#include <asm/hardirq.h>
     9.8  
     9.9  /*
    9.10   * Simple wrappers reducing source bloat.  Define all irq_stat fields
    9.11 @@ -17,7 +18,7 @@
    9.12   * definitions instead of differing sets for each arch.
    9.13   */
    9.14  
    9.15 -extern irq_cpustat_t irq_stat[];			/* defined in asm/hardirq.h */
    9.16 +extern irq_cpustat_t irq_stat[];
    9.17  
    9.18  #ifdef CONFIG_SMP
    9.19  #define __IRQ_STAT(cpu, member)	(irq_stat[cpu].member)
    10.1 --- a/xen/include/xen/keyhandler.h	Tue Nov 23 22:48:27 2004 +0000
    10.2 +++ b/xen/include/xen/keyhandler.h	Wed Nov 24 13:38:19 2004 +0000
    10.3 @@ -10,7 +10,7 @@
    10.4  #ifndef __XEN_KEYHANDLER_H__
    10.5  #define __XEN_KEYHANDLER_H__
    10.6  
    10.7 -#include <asm/regs.h>
    10.8 +struct xen_regs;
    10.9  
   10.10  /*
   10.11   * Register a callback function for key @key. The callback occurs in
    11.1 --- a/xen/include/xen/sched.h	Tue Nov 23 22:48:27 2004 +0000
    11.2 +++ b/xen/include/xen/sched.h	Wed Nov 24 13:38:19 2004 +0000
    11.3 @@ -21,6 +21,7 @@
    11.4  #include <asm/current.h>
    11.5  #include <xen/spinlock.h>
    11.6  #include <xen/grant_table.h>
    11.7 +#include <xen/irq_cpustat.h>
    11.8  
    11.9  extern unsigned long volatile jiffies;
   11.10  extern rwlock_t domlist_lock;
   11.11 @@ -217,6 +218,14 @@ void continue_cpu_idle_loop(void);
   11.12  
   11.13  void continue_nonidle_task(void);
   11.14  
   11.15 +void hypercall_create_continuation(unsigned int op, unsigned int nr_args, ...);
   11.16 +#define hypercall_may_preempt(_op, _nr_args, _args...)               \
   11.17 +    do {                                                             \
   11.18 +        if ( unlikely(softirq_pending(smp_processor_id())) ) {       \
   11.19 +            hypercall_create_continuation(_op , _nr_args , ##_args); \
   11.20 +            return _op;                                              \
   11.21 +    } } while ( 0 )
   11.22 +
   11.23  /* This domain_hash and domain_list are protected by the domlist_lock. */
   11.24  #define DOMAIN_HASH_SIZE 256
   11.25  #define DOMAIN_HASH(_id) ((int)(_id)&(DOMAIN_HASH_SIZE-1))