ia64/xen-unstable

changeset 4326:148aec70383c

bitkeeper revision 1.1236.43.9 (42441631VxhWONemyRXIOoB5s3kllQ)

Merge firebug.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk
author kaf24@firebug.cl.cam.ac.uk
date Fri Mar 25 13:46:25 2005 +0000 (2005-03-25)
parents 51b277b0371a 9e2a7958a704
children 4a339d097802
files xen/arch/ia64/domain.c xen/arch/x86/domain.c xen/arch/x86/mm.c xen/arch/x86/shadow.c xen/arch/x86/traps.c xen/arch/x86/vmx.c xen/arch/x86/vmx_intercept.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_platform.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_64/entry.S xen/common/domain.c xen/common/schedule.c xen/drivers/char/console.c xen/include/asm-x86/debugger.h xen/include/asm-x86/vmx_vmcs.h xen/include/xen/sched.h
line diff
     1.1 --- a/xen/arch/ia64/domain.c	Fri Mar 25 13:40:52 2005 +0000
     1.2 +++ b/xen/arch/ia64/domain.c	Fri Mar 25 13:46:25 2005 +0000
     1.3 @@ -102,8 +102,9 @@ void startup_cpu_idle_loop(void)
     1.4  {
     1.5      /* Just some sanity to ensure that the scheduler is set up okay. */
     1.6      ASSERT(current->domain == IDLE_DOMAIN_ID);
     1.7 -    domain_unpause_by_systemcontroller(current);
     1.8 -    __enter_scheduler();
     1.9 +    domain_unpause_by_systemcontroller(current); 
    1.10 +    raise_softirq(SCHEDULE_SOFTIRQ);
    1.11 +    do_softirq();
    1.12  
    1.13      /*
    1.14       * Declares CPU setup done to the boot processor.
     2.1 --- a/xen/arch/x86/domain.c	Fri Mar 25 13:40:52 2005 +0000
     2.2 +++ b/xen/arch/x86/domain.c	Fri Mar 25 13:46:25 2005 +0000
     2.3 @@ -74,7 +74,8 @@ void startup_cpu_idle_loop(void)
     2.4      /* Just some sanity to ensure that the scheduler is set up okay. */
     2.5      ASSERT(current->domain->id == IDLE_DOMAIN_ID);
     2.6      domain_unpause_by_systemcontroller(current->domain);
     2.7 -    __enter_scheduler();
     2.8 +    raise_softirq(SCHEDULE_SOFTIRQ);
     2.9 +    do_softirq();
    2.10  
    2.11      /*
    2.12       * Declares CPU setup done to the boot processor.
     3.1 --- a/xen/arch/x86/mm.c	Fri Mar 25 13:40:52 2005 +0000
     3.2 +++ b/xen/arch/x86/mm.c	Fri Mar 25 13:46:25 2005 +0000
     3.3 @@ -1669,8 +1669,8 @@ int do_mmu_update(
     3.4      if ( unlikely(shadow_mode_enabled(d)) )
     3.5          check_pagetable(d, ed->arch.guest_table, "pre-mmu"); /* debug */
     3.6  
     3.7 -    if ( unlikely(shadow_mode_translate(d) ) )
     3.8 -        domain_crash();
     3.9 +    if ( unlikely(shadow_mode_translate(d)) )
    3.10 +        domain_crash_synchronous();
    3.11  
    3.12      /*
    3.13       * If we are resuming after preemption, read how much work we have already
    3.14 @@ -2033,8 +2033,8 @@ int do_update_va_mapping(unsigned long v
    3.15      if ( unlikely(!__addr_ok(va)) )
    3.16          return -EINVAL;
    3.17  
    3.18 -    if ( unlikely(shadow_mode_translate(d) ) )
    3.19 -        domain_crash();
    3.20 +    if ( unlikely(shadow_mode_translate(d)) )
    3.21 +        domain_crash_synchronous();
    3.22  
    3.23      LOCK_BIGLOCK(d);
    3.24  
    3.25 @@ -2312,7 +2312,7 @@ void ptwr_flush(const int which)
    3.26          MEM_LOG("ptwr: Could not read pte at %p\n", ptep);
    3.27          /*
    3.28           * Really a bug. We could read this PTE during the initial fault,
    3.29 -         * and pagetables can't have changed meantime. XXX Multi-CPU guests?
    3.30 +         * and pagetables can't have changed meantime.
    3.31           */
    3.32          BUG();
    3.33      }
    3.34 @@ -2339,7 +2339,7 @@ void ptwr_flush(const int which)
    3.35          MEM_LOG("ptwr: Could not update pte at %p\n", ptep);
    3.36          /*
    3.37           * Really a bug. We could write this PTE during the initial fault,
    3.38 -         * and pagetables can't have changed meantime. XXX Multi-CPU guests?
    3.39 +         * and pagetables can't have changed meantime.
    3.40           */
    3.41          BUG();
    3.42      }
    3.43 @@ -2400,6 +2400,7 @@ void ptwr_flush(const int which)
    3.44                  *pl2e = mk_l2_pgentry(l2_pgentry_val(*pl2e) | _PAGE_PRESENT); 
    3.45              }
    3.46              domain_crash();
    3.47 +            return;
    3.48          }
    3.49          
    3.50          if ( unlikely(sl1e != NULL) )
    3.51 @@ -2693,6 +2694,7 @@ int ptwr_do_page_fault(unsigned long add
    3.52          unmap_domain_mem(ptwr_info[cpu].ptinfo[which].pl1e);
    3.53          ptwr_info[cpu].ptinfo[which].l1va = 0;
    3.54          domain_crash();
    3.55 +        return 0;
    3.56      }
    3.57      
    3.58      return EXCRET_fault_fixed;
    3.59 @@ -2730,40 +2732,6 @@ static __init int ptwr_init(void)
    3.60  
    3.61  #ifndef NDEBUG
    3.62  
    3.63 -void ptwr_status(void)
    3.64 -{
    3.65 -    unsigned long pte, *ptep, pfn;
    3.66 -    struct pfn_info *page;
    3.67 -    int cpu = smp_processor_id();
    3.68 -
    3.69 -    ptep = (unsigned long *)&linear_pg_table
    3.70 -        [ptwr_info[cpu].ptinfo[PTWR_PT_INACTIVE].l1va>>PAGE_SHIFT];
    3.71 -
    3.72 -    if ( __get_user(pte, ptep) ) {
    3.73 -        MEM_LOG("ptwr: Could not read pte at %p\n", ptep);
    3.74 -        domain_crash();
    3.75 -    }
    3.76 -
    3.77 -    pfn = pte >> PAGE_SHIFT;
    3.78 -    page = &frame_table[pfn];
    3.79 -    printk("need to alloc l1 page %p\n", page);
    3.80 -    /* make pt page writable */
    3.81 -    printk("need to make read-only l1-page at %p is %p\n",
    3.82 -           ptep, pte);
    3.83 -
    3.84 -    if ( ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va == 0 )
    3.85 -        return;
    3.86 -
    3.87 -    if ( __get_user(pte, (unsigned long *)
    3.88 -                    ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va) ) {
    3.89 -        MEM_LOG("ptwr: Could not read pte at %p\n", (unsigned long *)
    3.90 -                ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va);
    3.91 -        domain_crash();
    3.92 -    }
    3.93 -    pfn = pte >> PAGE_SHIFT;
    3.94 -    page = &frame_table[pfn];
    3.95 -}
    3.96 -
    3.97  void audit_pagelist(struct domain *d)
    3.98  {
    3.99      struct list_head *list_ent;
     4.1 --- a/xen/arch/x86/shadow.c	Fri Mar 25 13:40:52 2005 +0000
     4.2 +++ b/xen/arch/x86/shadow.c	Fri Mar 25 13:46:25 2005 +0000
     4.3 @@ -655,15 +655,13 @@ int shadow_fault(unsigned long va, struc
     4.4                               &linear_pg_table[va >> PAGE_SHIFT])) )
     4.5      {
     4.6          SH_VVLOG("shadow_fault - EXIT: read gpte faulted2" );
     4.7 -        shadow_unlock(d);
     4.8 -        return 0;
     4.9 +        goto fail;
    4.10      }
    4.11  
    4.12      if ( unlikely(!(gpte & _PAGE_PRESENT)) )
    4.13      {
    4.14          SH_VVLOG("shadow_fault - EXIT: gpte not present2 (%lx)",gpte );
    4.15 -        shadow_unlock(d);
    4.16 -        return 0;
    4.17 +        goto fail;
    4.18      }
    4.19  
    4.20      /* Write fault? */
    4.21 @@ -673,8 +671,7 @@ int shadow_fault(unsigned long va, struc
    4.22          {
    4.23              /* Write fault on a read-only mapping. */
    4.24              SH_VVLOG("shadow_fault - EXIT: wr fault on RO page (%lx)", gpte);
    4.25 -            shadow_unlock(d);
    4.26 -            return 0;
    4.27 +            goto fail;
    4.28          }
    4.29  
    4.30          l1pte_write_fault(d, &gpte, &spte);
    4.31 @@ -691,7 +688,10 @@ int shadow_fault(unsigned long va, struc
    4.32      /* XXX Watch out for read-only L2 entries! (not used in Linux). */
    4.33      if ( unlikely(__put_user(gpte, (unsigned long *)
    4.34                               &linear_pg_table[va >> PAGE_SHIFT])) )
    4.35 +    {
    4.36          domain_crash();
    4.37 +        goto fail;
    4.38 +    }
    4.39  
    4.40      /*
    4.41       * Update of shadow PTE can fail because the L1 p.t. is not shadowed,
    4.42 @@ -712,6 +712,10 @@ int shadow_fault(unsigned long va, struc
    4.43  
    4.44      check_pagetable(d, ed->arch.guest_table, "post-sf");
    4.45      return EXCRET_fault_fixed;
    4.46 +
    4.47 + fail:
    4.48 +    shadow_unlock(d);
    4.49 +    return 0;
    4.50  }
    4.51  
    4.52  
     5.1 --- a/xen/arch/x86/traps.c	Fri Mar 25 13:40:52 2005 +0000
     5.2 +++ b/xen/arch/x86/traps.c	Fri Mar 25 13:46:25 2005 +0000
     5.3 @@ -223,18 +223,7 @@ asmlinkage int do_int3(struct xen_regs *
     5.4          show_registers(regs);
     5.5          panic("CPU%d FATAL TRAP: vector = 3 (Int3)\n", smp_processor_id());
     5.6      } 
     5.7 -#ifdef DOMU_DEBUG
     5.8 -    else if ( KERNEL_MODE(ed, regs) && ed->domain->id != 0 ) 
     5.9 -    {
    5.10 -        if ( !test_and_set_bit(EDF_CTRLPAUSE, &ed->ed_flags) ) {
    5.11 -            while (ed == current)
    5.12 -                __enter_scheduler();
    5.13 -            domain_pause_by_systemcontroller(ed->domain);
    5.14 -        }
    5.15 -        
    5.16 -        return 0;
    5.17 -    }
    5.18 -#endif /* DOMU_DEBUG */
    5.19 +
    5.20      ti = current->arch.traps + 3;
    5.21      tb->flags = TBF_EXCEPTION;
    5.22      tb->cs    = ti->cs;
    5.23 @@ -950,8 +939,6 @@ asmlinkage int do_debug(struct xen_regs 
    5.24      struct exec_domain *ed = current;
    5.25      struct trap_bounce *tb = &ed->arch.trap_bounce;
    5.26  
    5.27 -    DEBUGGER_trap_entry(TRAP_debug, regs);
    5.28 -
    5.29      __asm__ __volatile__("mov %%db6,%0" : "=r" (condition));
    5.30  
    5.31      /* Mask out spurious debug traps due to lazy DR7 setting */
    5.32 @@ -962,6 +949,8 @@ asmlinkage int do_debug(struct xen_regs 
    5.33          goto out;
    5.34      }
    5.35  
    5.36 +    DEBUGGER_trap_entry(TRAP_debug, regs);
    5.37 +
    5.38      if ( !GUEST_MODE(regs) )
    5.39      {
    5.40          /* Clear TF just for absolute sanity. */
    5.41 @@ -974,19 +963,7 @@ asmlinkage int do_debug(struct xen_regs 
    5.42           */
    5.43          goto out;
    5.44      } 
    5.45 -#ifdef DOMU_DEBUG
    5.46 -    else if ( KERNEL_MODE(ed, regs) && ed->domain->id != 0 ) 
    5.47 -    {
    5.48 -        regs->eflags &= ~EF_TF;
    5.49 -        if ( !test_and_set_bit(EDF_CTRLPAUSE, &ed->ed_flags) ) {
    5.50 -            while (ed == current)
    5.51 -                __enter_scheduler();
    5.52 -            domain_pause_by_systemcontroller(ed->domain);
    5.53 -        }
    5.54  
    5.55 -        goto out;
    5.56 -    }    
    5.57 -#endif /* DOMU_DEBUG */
    5.58      /* Save debug status register where guest OS can peek at it */
    5.59      ed->arch.debugreg[6] = condition;
    5.60  
     6.1 --- a/xen/arch/x86/vmx.c	Fri Mar 25 13:40:52 2005 +0000
     6.2 +++ b/xen/arch/x86/vmx.c	Fri Mar 25 13:46:25 2005 +0000
     6.3 @@ -22,6 +22,7 @@
     6.4  #include <xen/lib.h>
     6.5  #include <xen/trace.h>
     6.6  #include <xen/sched.h>
     6.7 +#include <xen/softirq.h>
     6.8  #include <asm/current.h>
     6.9  #include <asm/io.h>
    6.10  #include <asm/irq.h>
    6.11 @@ -314,7 +315,7 @@ static void vmx_io_instruction(struct xe
    6.12      vio = (vcpu_iodata_t *) d->arch.arch_vmx.vmx_platform.shared_page_va;
    6.13      if (vio == 0) {
    6.14          VMX_DBG_LOG(DBG_LEVEL_1, "bad shared page: %lx", (unsigned long) vio);
    6.15 -        domain_crash(); 
    6.16 +        domain_crash_synchronous(); 
    6.17      }
    6.18      p = &vio->vp_ioreq;
    6.19      p->dir = test_bit(3, &exit_qualification);  
    6.20 @@ -340,7 +341,7 @@ static void vmx_io_instruction(struct xe
    6.21              printk("stringio crosses page boundary!\n");
    6.22              if (p->u.data & (p->size - 1)) {
    6.23                  printk("Not aligned I/O!\n");
    6.24 -                domain_crash();     
    6.25 +                domain_crash_synchronous();     
    6.26              }
    6.27              p->count = (PAGE_SIZE - (p->u.data & ~PAGE_MASK)) / p->size;
    6.28          } else {
    6.29 @@ -424,7 +425,7 @@ static void mov_to_cr(int gp, int cr, st
    6.30              {
    6.31                  VMX_DBG_LOG(DBG_LEVEL_VMMU, "Invalid CR3 value = %lx", 
    6.32                          d->arch.arch_vmx.cpu_cr3);
    6.33 -                domain_crash(); /* need to take a clean path */
    6.34 +                domain_crash_synchronous(); /* need to take a clean path */
    6.35              }
    6.36              old_base_mfn = pagetable_val(d->arch.guest_table) >> PAGE_SHIFT;
    6.37  
    6.38 @@ -494,7 +495,7 @@ static void mov_to_cr(int gp, int cr, st
    6.39              {
    6.40                  VMX_DBG_LOG(DBG_LEVEL_VMMU, 
    6.41                          "Invalid CR3 value=%lx", value);
    6.42 -                domain_crash(); /* need to take a clean path */
    6.43 +                domain_crash_synchronous(); /* need to take a clean path */
    6.44              }
    6.45              mfn = phys_to_machine_mapping(value >> PAGE_SHIFT);
    6.46              vmx_shadow_clear_state(d->domain);
    6.47 @@ -620,24 +621,24 @@ static inline void vmx_do_msr_read(struc
    6.48  /*
    6.49   * Need to use this exit to rescheule
    6.50   */
    6.51 -static inline void vmx_vmexit_do_hlt()
    6.52 +static inline void vmx_vmexit_do_hlt(void)
    6.53  {
    6.54  #if VMX_DEBUG
    6.55      unsigned long eip;
    6.56      __vmread(GUEST_EIP, &eip);
    6.57  #endif
    6.58      VMX_DBG_LOG(DBG_LEVEL_1, "vmx_vmexit_do_hlt:eip=%p", eip);
    6.59 -    __enter_scheduler();
    6.60 +    raise_softirq(SCHEDULE_SOFTIRQ);
    6.61  }
    6.62  
    6.63 -static inline void vmx_vmexit_do_mwait()
    6.64 +static inline void vmx_vmexit_do_mwait(void)
    6.65  {
    6.66  #if VMX_DEBUG
    6.67      unsigned long eip;
    6.68      __vmread(GUEST_EIP, &eip);
    6.69  #endif
    6.70      VMX_DBG_LOG(DBG_LEVEL_1, "vmx_vmexit_do_mwait:eip=%p", eip);
    6.71 -    __enter_scheduler();
    6.72 +    raise_softirq(SCHEDULE_SOFTIRQ);
    6.73  }
    6.74  
    6.75  #define BUF_SIZ     256
    6.76 @@ -736,7 +737,7 @@ asmlinkage void vmx_vmexit_handler(struc
    6.77          VMX_DBG_LOG(DBG_LEVEL_0, "exit reason = %x", exit_reason);
    6.78  
    6.79      if (exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) {
    6.80 -        domain_crash();         
    6.81 +        domain_crash_synchronous();         
    6.82          return;
    6.83      }
    6.84  
     7.1 --- a/xen/arch/x86/vmx_intercept.c	Fri Mar 25 13:40:52 2005 +0000
     7.2 +++ b/xen/arch/x86/vmx_intercept.c	Fri Mar 25 13:46:25 2005 +0000
     7.3 @@ -56,7 +56,7 @@ int register_io_handler(unsigned long ad
     7.4  
     7.5      if (num >= MAX_IO_HANDLER) {
     7.6          printk("no extra space, register io interceptor failed!\n");
     7.7 -        domain_crash();
     7.8 +        domain_crash_synchronous();
     7.9      }
    7.10  
    7.11      handler->hdl_list[num].addr = addr;
     8.1 --- a/xen/arch/x86/vmx_io.c	Fri Mar 25 13:40:52 2005 +0000
     8.2 +++ b/xen/arch/x86/vmx_io.c	Fri Mar 25 13:46:25 2005 +0000
     8.3 @@ -195,7 +195,7 @@ void vmx_io_assist(struct exec_domain *e
     8.4      if (vio == 0) {
     8.5          VMX_DBG_LOG(DBG_LEVEL_1, 
     8.6                      "bad shared page: %lx", (unsigned long) vio);
     8.7 -        domain_crash();
     8.8 +        domain_crash_synchronous();
     8.9      }
    8.10      p = &vio->vp_ioreq;
    8.11  
    8.12 @@ -314,7 +314,7 @@ static inline int find_highest_pending_i
    8.13      if (vio == 0) {
    8.14          VMX_DBG_LOG(DBG_LEVEL_1, 
    8.15                      "bad shared page: %lx", (unsigned long) vio);
    8.16 -        domain_crash();
    8.17 +        domain_crash_synchronous();
    8.18      }
    8.19          
    8.20      return find_highest_irq(&vio->vp_intr[0]);
    8.21 @@ -328,7 +328,7 @@ static inline void clear_highest_bit(str
    8.22      if (vio == 0) {
    8.23          VMX_DBG_LOG(DBG_LEVEL_1, 
    8.24                      "bad shared page: %lx", (unsigned long) vio);
    8.25 -        domain_crash();
    8.26 +        domain_crash_synchronous();
    8.27      }
    8.28          
    8.29      clear_bit(vector, &vio->vp_intr[0]);
     9.1 --- a/xen/arch/x86/vmx_platform.c	Fri Mar 25 13:40:52 2005 +0000
     9.2 +++ b/xen/arch/x86/vmx_platform.c	Fri Mar 25 13:46:25 2005 +0000
     9.3 @@ -436,7 +436,7 @@ static void send_mmio_req(unsigned long 
     9.4          
     9.5      if (vio == NULL) {
     9.6          printk("bad shared page\n");
     9.7 -        domain_crash(); 
     9.8 +        domain_crash_synchronous(); 
     9.9      }
    9.10      p = &vio->vp_ioreq;
    9.11          
    9.12 @@ -490,13 +490,13 @@ void handle_mmio(unsigned long va, unsig
    9.13      ret = inst_copy_from_guest(inst, eip, inst_len);
    9.14      if (ret != inst_len) {
    9.15          printk("handle_mmio - EXIT: get guest instruction fault\n");
    9.16 -        domain_crash();
    9.17 +        domain_crash_synchronous();
    9.18      }
    9.19  
    9.20      init_instruction(&mmio_inst);
    9.21      
    9.22      if (vmx_decode(check_prefix(inst, &mmio_inst), &mmio_inst) == DECODE_failure)
    9.23 -        domain_crash();
    9.24 +        domain_crash_synchronous();
    9.25  
    9.26      __vmwrite(GUEST_EIP, eip + inst_len);
    9.27      store_xen_regs(inst_decoder_regs);
    9.28 @@ -510,7 +510,7 @@ void handle_mmio(unsigned long va, unsig
    9.29              return ;
    9.30          } else {
    9.31              printk("handle_mmio - EXIT: movz error!\n");
    9.32 -            domain_crash();
    9.33 +            domain_crash_synchronous();
    9.34          }
    9.35      }
    9.36  
    9.37 @@ -539,14 +539,14 @@ void handle_mmio(unsigned long va, unsig
    9.38                  index = operand_index(mmio_inst.operand[0]);
    9.39                  value = get_reg_value(size, index, 0, inst_decoder_regs);
    9.40              } else {
    9.41 -                domain_crash();
    9.42 +                domain_crash_synchronous();
    9.43              }
    9.44              send_mmio_req(gpa, &mmio_inst, value, 0, 0);
    9.45              return;
    9.46          }
    9.47 -        domain_crash();
    9.48      }
    9.49 -    domain_crash();
    9.50 +
    9.51 +    domain_crash_synchronous();
    9.52  }
    9.53  
    9.54  #endif /* CONFIG_VMX */
    10.1 --- a/xen/arch/x86/x86_32/entry.S	Fri Mar 25 13:40:52 2005 +0000
    10.2 +++ b/xen/arch/x86/x86_32/entry.S	Fri Mar 25 13:46:25 2005 +0000
    10.3 @@ -385,13 +385,17 @@ nvm86_3:/* Rewrite our stack frame and r
    10.4          movb $0,TRAPBOUNCE_flags(%edx)
    10.5          ret
    10.6  .section __ex_table,"a"
    10.7 -	.long  FLT6,domain_crash ,  FLT7,domain_crash ,  FLT8,domain_crash
    10.8 -        .long  FLT9,domain_crash , FLT10,domain_crash , FLT11,domain_crash
    10.9 -        .long FLT12,domain_crash , FLT13,domain_crash , FLT14,domain_crash
   10.10 -        .long FLT15,domain_crash , FLT16,domain_crash , FLT17,domain_crash
   10.11 -	.long FLT18,domain_crash , FLT19,domain_crash , FLT20,domain_crash
   10.12 -        .long FLT21,domain_crash , FLT22,domain_crash , FLT23,domain_crash
   10.13 -        .long FLT24,domain_crash , FLT25,domain_crash , FLT26,domain_crash
   10.14 +	.long  FLT6,domain_crash_synchronous ,  FLT7,domain_crash_synchronous
   10.15 +        .long  FLT8,domain_crash_synchronous ,  FLT9,domain_crash_synchronous
   10.16 +        .long FLT10,domain_crash_synchronous , FLT11,domain_crash_synchronous
   10.17 +        .long FLT12,domain_crash_synchronous , FLT13,domain_crash_synchronous
   10.18 +        .long FLT14,domain_crash_synchronous , FLT15,domain_crash_synchronous
   10.19 +        .long FLT16,domain_crash_synchronous , FLT17,domain_crash_synchronous
   10.20 +	.long FLT18,domain_crash_synchronous , FLT19,domain_crash_synchronous
   10.21 +        .long FLT20,domain_crash_synchronous , FLT21,domain_crash_synchronous
   10.22 +        .long FLT22,domain_crash_synchronous , FLT23,domain_crash_synchronous
   10.23 +        .long FLT24,domain_crash_synchronous , FLT25,domain_crash_synchronous
   10.24 +        .long FLT26,domain_crash_synchronous
   10.25  .previous
   10.26  
   10.27          ALIGN
   10.28 @@ -682,9 +686,9 @@ VFLT3:  movl %gs:(%esi),%eax
   10.29          jmp test_all_events
   10.30  
   10.31  .section __ex_table,"a"
   10.32 -        .long VFLT1,domain_crash
   10.33 -        .long VFLT2,domain_crash
   10.34 -        .long VFLT3,domain_crash
   10.35 +        .long VFLT1,domain_crash_synchronous
   10.36 +        .long VFLT2,domain_crash_synchronous
   10.37 +        .long VFLT3,domain_crash_synchronous
   10.38  .previous
   10.39  
   10.40  .data
    11.1 --- a/xen/arch/x86/x86_64/entry.S	Fri Mar 25 13:40:52 2005 +0000
    11.2 +++ b/xen/arch/x86/x86_64/entry.S	Fri Mar 25 13:46:25 2005 +0000
    11.3 @@ -179,7 +179,7 @@ 2:      movq  $HYPERVISOR_VIRT_START,%ra
    11.4          jb    1f                        # In +ve address space? Then okay.
    11.5          movq  $HYPERVISOR_VIRT_END+60,%rax
    11.6          cmpq  %rax,%rsi
    11.7 -        jb    domain_crash              # Above Xen private area? Then okay.
    11.8 +        jb    domain_crash_synchronous  # Above Xen private area? Then okay.
    11.9  1:      subq  $40,%rsi
   11.10          movq  XREGS_ss+8(%rsp),%rax
   11.11  FLT2:   movq  %rax,32(%rsi)             # SS
   11.12 @@ -230,11 +230,13 @@ FLT14:  movq  %rax,(%rsi)               
   11.13          movb  $0,TRAPBOUNCE_flags(%rdx)
   11.14          ret
   11.15  .section __ex_table,"a"
   11.16 -        .quad  FLT2,domain_crash ,  FLT3,domain_crash ,  FLT4,domain_crash
   11.17 -        .quad  FLT5,domain_crash ,  FLT6,domain_crash ,  FLT7,domain_crash
   11.18 -        .quad  FLT8,domain_crash ,  FLT9,domain_crash , FLT10,domain_crash
   11.19 -        .quad FLT11,domain_crash , FLT12,domain_crash , FLT13,domain_crash
   11.20 -        .quad FLT14,domain_crash
   11.21 +        .quad  FLT2,domain_crash_synchronous ,  FLT3,domain_crash_synchronous
   11.22 +        .quad  FLT4,domain_crash_synchronous ,  FLT5,domain_crash_synchronous
   11.23 +        .quad  FLT6,domain_crash_synchronous ,  FLT7,domain_crash_synchronous
   11.24 +        .quad  FLT8,domain_crash_synchronous ,  FLT9,domain_crash_synchronous
   11.25 +        .quad FLT10,domain_crash_synchronous , FLT11,domain_crash_synchronous
   11.26 +        .quad FLT12,domain_crash_synchronous , FLT13,domain_crash_synchronous
   11.27 +        .quad FLT14,domain_crash_synchronous
   11.28  .previous
   11.29  
   11.30          ALIGN
    12.1 --- a/xen/common/domain.c	Fri Mar 25 13:40:52 2005 +0000
    12.2 +++ b/xen/common/domain.c	Fri Mar 25 13:46:25 2005 +0000
    12.3 @@ -161,12 +161,18 @@ void domain_crash(void)
    12.4      set_bit(DF_CRASHED, &d->d_flags);
    12.5  
    12.6      send_guest_virq(dom0->exec_domain[0], VIRQ_DOM_EXC);
    12.7 -    
    12.8 -    __enter_scheduler();
    12.9 -    BUG();
   12.10 +
   12.11 +    raise_softirq(SCHEDULE_SOFTIRQ);
   12.12  }
   12.13  
   12.14 -extern void trap_to_xendbg(void);
   12.15 +
   12.16 +void domain_crash_synchronous(void)
   12.17 +{
   12.18 +    domain_crash();
   12.19 +    for ( ; ; )
   12.20 +        do_softirq();
   12.21 +}
   12.22 +
   12.23  
   12.24  void domain_shutdown(u8 reason)
   12.25  {
   12.26 @@ -191,18 +197,14 @@ void domain_shutdown(u8 reason)
   12.27          }
   12.28      }
   12.29  
   12.30 -    if ( reason == SHUTDOWN_crash )
   12.31 -    {
   12.32 -        domain_crash();
   12.33 -        BUG();
   12.34 -    }
   12.35 -
   12.36 -    d->shutdown_code = reason;
   12.37 -    set_bit(DF_SHUTDOWN, &d->d_flags);
   12.38 +    if ( (d->shutdown_code = reason) == SHUTDOWN_crash )
   12.39 +        set_bit(DF_CRASHED, &d->d_flags);
   12.40 +    else
   12.41 +        set_bit(DF_SHUTDOWN, &d->d_flags);
   12.42  
   12.43      send_guest_virq(dom0->exec_domain[0], VIRQ_DOM_EXC);
   12.44  
   12.45 -    __enter_scheduler();
   12.46 +    raise_softirq(SCHEDULE_SOFTIRQ);
   12.47  }
   12.48  
   12.49  unsigned int alloc_new_dom_mem(struct domain *d, unsigned int kbytes)
    13.1 --- a/xen/common/schedule.c	Fri Mar 25 13:40:52 2005 +0000
    13.2 +++ b/xen/common/schedule.c	Fri Mar 25 13:46:25 2005 +0000
    13.3 @@ -69,16 +69,13 @@ static void dom_timer_fn(unsigned long d
    13.4  struct schedule_data schedule_data[NR_CPUS];
    13.5  
    13.6  extern struct scheduler sched_bvt_def;
    13.7 -// extern struct scheduler sched_rrobin_def;
    13.8 -// extern struct scheduler sched_atropos_def;
    13.9  static struct scheduler *schedulers[] = { 
   13.10      &sched_bvt_def,
   13.11 -//     &sched_rrobin_def,
   13.12 -//     &sched_atropos_def,
   13.13      NULL
   13.14  };
   13.15  
   13.16 -/* Operations for the current scheduler. */
   13.17 +static void __enter_scheduler(void);
   13.18 +
   13.19  static struct scheduler ops;
   13.20  
   13.21  #define SCHED_OP(fn, ...)                                 \
   13.22 @@ -366,7 +363,7 @@ long sched_adjdom(struct sched_adjdom_cm
   13.23   * - deschedule the current domain (scheduler independent).
   13.24   * - pick a new domain (scheduler dependent).
   13.25   */
   13.26 -void __enter_scheduler(void)
   13.27 +static void __enter_scheduler(void)
   13.28  {
   13.29      struct exec_domain *prev = current, *next = NULL;
   13.30      int                 cpu = prev->processor;
    14.1 --- a/xen/drivers/char/console.c	Fri Mar 25 13:40:52 2005 +0000
    14.2 +++ b/xen/drivers/char/console.c	Fri Mar 25 13:46:25 2005 +0000
    14.3 @@ -594,8 +594,6 @@ static int __init debugtrace_init(void)
    14.4   * **************************************************************
    14.5   */
    14.6  
    14.7 -extern void trap_to_xendbg(void);
    14.8 -
    14.9  void panic(const char *fmt, ...)
   14.10  {
   14.11      va_list args;
    15.1 --- a/xen/include/asm-x86/debugger.h	Fri Mar 25 13:40:52 2005 +0000
    15.2 +++ b/xen/include/asm-x86/debugger.h	Fri Mar 25 13:46:25 2005 +0000
    15.3 @@ -30,6 +30,7 @@
    15.4  #ifndef __X86_DEBUGGER_H__
    15.5  #define __X86_DEBUGGER_H__
    15.6  
    15.7 +#include <xen/softirq.h>
    15.8  #include <asm/processor.h>
    15.9  
   15.10  /* The main trap handlers use these helper macros which include early bail. */
   15.11 @@ -40,78 +41,39 @@
   15.12  
   15.13  int call_with_registers(int (*f)(struct xen_regs *r));
   15.14  
   15.15 -#ifdef XEN_DEBUGGER
   15.16 -
   15.17 -#include <asm/pdb.h>
   15.18 -
   15.19 -static inline int debugger_trap_entry(
   15.20 -    unsigned int vector, struct xen_regs *regs)
   15.21 -{
   15.22 -    int ret = 0;
   15.23 -
   15.24 -    switch ( vector )
   15.25 -    {
   15.26 -    case TRAP_debug:
   15.27 -        if ( pdb_initialized )
   15.28 -        {
   15.29 -            pdb_handle_debug_trap(regs, regs->error_code);
   15.30 -            ret = 1; /* early exit */
   15.31 -        }
   15.32 -        break;
   15.33 -
   15.34 -    case TRAP_int3:
   15.35 -        if ( pdb_initialized && (pdb_handle_exception(vector, regs) == 0) )
   15.36 -            ret = 1; /* early exit */
   15.37 -        break;
   15.38 -
   15.39 -    case TRAP_gp_fault:        
   15.40 -        if ( (VM86_MODE(regs) || !RING_0(regs)) &&
   15.41 -             ((regs->error_code & 3) == 2) &&
   15.42 -             pdb_initialized && (pdb_ctx.system_call != 0) )
   15.43 -        {
   15.44 -            unsigned long cr3 = read_cr3();
   15.45 -            if ( cr3 == pdb_ctx.ptbr )
   15.46 -                pdb_linux_syscall_enter_bkpt(
   15.47 -                    regs, regs->error_code, 
   15.48 -                    current->thread.traps + (regs->error_code>>3));
   15.49 -        }
   15.50 -        break;
   15.51 -    }
   15.52 -
   15.53 -    return ret;
   15.54 -}
   15.55 -
   15.56 -static inline int debugger_trap_fatal(
   15.57 -    unsigned int vector, struct xen_regs *regs)
   15.58 -{
   15.59 -    int ret = 0;
   15.60 -
   15.61 -    switch ( vector )
   15.62 -    {
   15.63 -    case TRAP_page_fault:
   15.64 -        if ( pdb_page_fault_possible )
   15.65 -        {
   15.66 -            pdb_page_fault = 1;
   15.67 -            /* make eax & edx valid to complete the instruction */
   15.68 -            regs->eax = (long)&pdb_page_fault_scratch;
   15.69 -            regs->edx = (long)&pdb_page_fault_scratch;
   15.70 -            ret = 1; /* exit - do not crash! */
   15.71 -        }
   15.72 -        break;
   15.73 -    }
   15.74 -
   15.75 -    return ret;
   15.76 -}
   15.77 -
   15.78 -#define debugger_trap_immediate() ()
   15.79 -
   15.80 -#elif defined(CRASH_DEBUG)
   15.81 +#if defined(CRASH_DEBUG)
   15.82  
   15.83  extern int __trap_to_cdb(struct xen_regs *r);
   15.84  #define debugger_trap_entry(_v, _r) (0)
   15.85  #define debugger_trap_fatal(_v, _r) __trap_to_cdb(_r)
   15.86  #define debugger_trap_immediate() call_with_registers(__trap_to_cdb)
   15.87  
   15.88 +#elif defined(DOMU_DEBUG)
   15.89 +
   15.90 +static inline int debugger_trap_entry(
   15.91 +    unsigned int vector, struct xen_regs *regs)
   15.92 +{
   15.93 +    struct exec_domain *ed = current;
   15.94 +
   15.95 +    if ( !KERNEL_MODE(ed, regs) || (ed->domain->id == 0) )
   15.96 +        return 0;
   15.97 +    
   15.98 +    switch ( vector )
   15.99 +    {
  15.100 +    case TRAP_int3:
  15.101 +    case TRAP_debug:
  15.102 +        set_bit(EDF_CTRLPAUSE, &ed->ed_flags);
  15.103 +        raise_softirq(SCHEDULE_SOFTIRQ);
  15.104 +        return 1;
  15.105 +    }
  15.106 +
  15.107 +    return 0;
  15.108 +}
  15.109 +
  15.110 +#define debugger_trap_fatal(_v, _r) (0)
  15.111 +#define debugger_trap_immediate()
  15.112 +
  15.113 +
  15.114  #elif 0
  15.115  
  15.116  extern int kdb_trap(int, int, struct xen_regs *);
    16.1 --- a/xen/include/asm-x86/vmx_vmcs.h	Fri Mar 25 13:40:52 2005 +0000
    16.2 +++ b/xen/include/asm-x86/vmx_vmcs.h	Fri Mar 25 13:46:25 2005 +0000
    16.3 @@ -207,7 +207,7 @@ extern unsigned int opt_vmx_debug_level;
    16.4      do {                                                        \
    16.5          printk("__vmx_bug at %s:%d\n", __FILE__, __LINE__);     \
    16.6          show_registers(regs);                                   \
    16.7 -        domain_crash();                                         \
    16.8 +        domain_crash_synchronous();                             \
    16.9      } while (0)
   16.10  
   16.11  #endif /* ASM_X86_VMX_VMCS_H__ */
    17.1 --- a/xen/include/xen/sched.h	Fri Mar 25 13:40:52 2005 +0000
    17.2 +++ b/xen/include/xen/sched.h	Fri Mar 25 13:46:25 2005 +0000
    17.3 @@ -218,8 +218,19 @@ struct domain *find_domain_by_id(domid_t
    17.4  struct domain *find_last_domain(void);
    17.5  extern void domain_destruct(struct domain *d);
    17.6  extern void domain_kill(struct domain *d);
    17.7 +extern void domain_shutdown(u8 reason);
    17.8 +
    17.9 +/*
   17.10 + * Mark current domain as crashed. This function returns: the domain is not
   17.11 + * synchronously descheduled from any processor.
   17.12 + */
   17.13  extern void domain_crash(void);
   17.14 -extern void domain_shutdown(u8 reason);
   17.15 +
   17.16 +/*
   17.17 + * Mark current domain as crashed and synchronously deschedule from the local
   17.18 + * processor. This function never returns.
   17.19 + */
   17.20 +extern void domain_crash_synchronous(void) __attribute__((noreturn));
   17.21  
   17.22  void new_thread(struct exec_domain *d,
   17.23                  unsigned long start_pc,
   17.24 @@ -241,8 +252,6 @@ void init_idle_task(void);
   17.25  void domain_wake(struct exec_domain *d);
   17.26  void domain_sleep(struct exec_domain *d);
   17.27  
   17.28 -void __enter_scheduler(void);
   17.29 -
   17.30  extern void context_switch(
   17.31      struct exec_domain *prev, 
   17.32      struct exec_domain *next);