ia64/xen-unstable

changeset 2988:0cf9476c362d

bitkeeper revision 1.1159.170.27 (4199eb03e15gd8adslXoDx2C8r41ow)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into freefall.cl.cam.ac.uk:/local/scratch/kaf24/xeno
author kaf24@freefall.cl.cam.ac.uk
date Tue Nov 16 11:56:51 2004 +0000 (2004-11-16)
parents 9edb3993dabc 22d7d9cfcc7e
children 6a8849c4b647
files linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig linux-2.6.9-xen-sparse/arch/xen/configs/xenU_defconfig linux-2.6.9-xen-sparse/arch/xen/i386/kernel/setup.c linux-2.6.9-xen-sparse/arch/xen/i386/mm/pageattr.c linux-2.6.9-xen-sparse/arch/xen/kernel/evtchn.c linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h xen/arch/x86/memory.c
line diff
     1.1 --- a/linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig	Tue Nov 16 00:40:23 2004 +0000
     1.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig	Tue Nov 16 11:56:51 2004 +0000
     1.3 @@ -158,7 +158,7 @@ CONFIG_MAGIC_SYSRQ=y
     1.4  # CONFIG_DEBUG_INFO is not set
     1.5  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
     1.6  # CONFIG_FRAME_POINTER is not set
     1.7 -# CONFIG_4KSTACKS is not set
     1.8 +CONFIG_4KSTACKS=y
     1.9  CONFIG_X86_BIOS_REBOOT=y
    1.10  CONFIG_X86_STD_RESOURCES=y
    1.11  CONFIG_PC=y
     2.1 --- a/linux-2.6.9-xen-sparse/arch/xen/configs/xenU_defconfig	Tue Nov 16 00:40:23 2004 +0000
     2.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/configs/xenU_defconfig	Tue Nov 16 11:56:51 2004 +0000
     2.3 @@ -119,7 +119,7 @@ CONFIG_HAVE_DEC_LOCK=y
     2.4  CONFIG_EARLY_PRINTK=y
     2.5  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
     2.6  # CONFIG_FRAME_POINTER is not set
     2.7 -# CONFIG_4KSTACKS is not set
     2.8 +CONFIG_4KSTACKS=y
     2.9  CONFIG_X86_BIOS_REBOOT=y
    2.10  CONFIG_X86_STD_RESOURCES=y
    2.11  CONFIG_PC=y
     3.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/setup.c	Tue Nov 16 00:40:23 2004 +0000
     3.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/setup.c	Tue Nov 16 11:56:51 2004 +0000
     3.3 @@ -1319,6 +1319,11 @@ void __init setup_arch(char **cmdline_p)
     3.4  
     3.5          unsigned long max_low_pfn;
     3.6  
     3.7 +	/* Force a quick death if the kernel panics. */
     3.8 +	extern int panic_timeout;
     3.9 +	if ( panic_timeout == 0 )
    3.10 +		panic_timeout = 1;
    3.11 +
    3.12  	HYPERVISOR_vm_assist(VMASST_CMD_enable,
    3.13  			     VMASST_TYPE_4gb_segments);
    3.14  
     4.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/mm/pageattr.c	Tue Nov 16 00:40:23 2004 +0000
     4.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/mm/pageattr.c	Tue Nov 16 11:56:51 2004 +0000
     4.3 @@ -119,7 +119,7 @@ static int
     4.4  		if ((pte_val(*kpte) & _PAGE_PSE) == 0) { 
     4.5  			pte_t old = *kpte;
     4.6  			pte_t standard = mk_pte(page, PAGE_KERNEL); 
     4.7 -			set_pte_atomic(kpte, mk_pte(page, prot)); 
     4.8 +			set_pte_batched(kpte, mk_pte(page, prot)); 
     4.9  			if (pte_same(old,standard))
    4.10  				get_page(kpte_page);
    4.11  		} else {
    4.12 @@ -130,7 +130,7 @@ static int
    4.13  			set_pmd_pte(kpte,address,mk_pte(split, PAGE_KERNEL));
    4.14  		}	
    4.15  	} else if ((pte_val(*kpte) & _PAGE_PSE) == 0) { 
    4.16 -		set_pte_atomic(kpte, mk_pte(page, PAGE_KERNEL));
    4.17 +		set_pte_batched(kpte, mk_pte(page, PAGE_KERNEL));
    4.18  		__put_page(kpte_page);
    4.19  	}
    4.20  
    4.21 @@ -171,6 +171,7 @@ int change_page_attr(struct page *page, 
    4.22  		if (err) 
    4.23  			break; 
    4.24  	} 	
    4.25 +	flush_page_update_queue();
    4.26  	spin_unlock_irqrestore(&cpa_lock, flags);
    4.27  	return err;
    4.28  }
     5.1 --- a/linux-2.6.9-xen-sparse/arch/xen/kernel/evtchn.c	Tue Nov 16 00:40:23 2004 +0000
     5.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/kernel/evtchn.c	Tue Nov 16 11:56:51 2004 +0000
     5.3 @@ -467,6 +467,8 @@ void __init init_IRQ(void)
     5.4  {
     5.5      int i;
     5.6  
     5.7 +    irq_ctx_init(0);
     5.8 +
     5.9      spin_lock_init(&irq_mapping_update_lock);
    5.10  
    5.11      /* No VIRQ -> IRQ mappings. */
     6.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h	Tue Nov 16 00:40:23 2004 +0000
     6.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h	Tue Nov 16 11:56:51 2004 +0000
     6.3 @@ -23,13 +23,10 @@ static inline int pgd_present(pgd_t pgd)
     6.4   * within a page table are directly modified.  Thus, the following
     6.5   * hook is made available.
     6.6   */
     6.7 -#ifdef CONFIG_XEN_WRITABLE_PAGETABLES
     6.8 +#define set_pte_batched(pteptr, pteval) \
     6.9 +queue_l1_entry_update(pteptr, (pteval).pte_low)
    6.10  #define set_pte(pteptr, pteval) (*(pteptr) = pteval)
    6.11 -#define set_pte_atomic(pteptr, pteval) (*(pteptr) = pteval)
    6.12 -#else
    6.13 -#define set_pte(pteptr, pteval) xen_l1_entry_update(pteptr, (pteval).pte_low)
    6.14 -#define set_pte_atomic(pteptr, pteval) xen_l1_entry_update(pteptr, (pteval).pte_low)
    6.15 -#endif
    6.16 +#define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval)
    6.17  /*
    6.18   * (pmds are folded into pgds so this doesn't get actually called,
    6.19   * but the define is needed for a generic inline function.)
     7.1 --- a/xen/arch/x86/memory.c	Tue Nov 16 00:40:23 2004 +0000
     7.2 +++ b/xen/arch/x86/memory.c	Tue Nov 16 11:56:51 2004 +0000
     7.3 @@ -1577,7 +1577,7 @@ void ptwr_flush(const int which)
     7.4  {
     7.5      unsigned long  sstat, spte, pte, *ptep, l1va;
     7.6      l1_pgentry_t  *sl1e = NULL, *pl1e, ol1e, nl1e;
     7.7 -    l2_pgentry_t  *pl2e, nl2e;
     7.8 +    l2_pgentry_t  *pl2e;
     7.9      int            i, cpu = smp_processor_id();
    7.10      struct domain *d = current;
    7.11  
    7.12 @@ -1691,8 +1691,7 @@ void ptwr_flush(const int which)
    7.13      if ( (which == PTWR_PT_ACTIVE) && likely(!d->mm.shadow_mode) )
    7.14      {
    7.15          pl2e = &linear_l2_table[ptwr_info[cpu].ptinfo[which].l2_idx];
    7.16 -        nl2e = mk_l2_pgentry(l2_pgentry_val(*pl2e) | _PAGE_PRESENT);
    7.17 -        update_l2e(pl2e, *pl2e, nl2e);
    7.18 +        *pl2e = mk_l2_pgentry(l2_pgentry_val(*pl2e) | _PAGE_PRESENT); 
    7.19      }
    7.20  
    7.21      /*
    7.22 @@ -1711,9 +1710,9 @@ void ptwr_flush(const int which)
    7.23  /* Write page fault handler: check if guest is trying to modify a PTE. */
    7.24  int ptwr_do_page_fault(unsigned long addr)
    7.25  {
    7.26 -    unsigned long    pte, pfn;
    7.27 +    unsigned long    pte, pfn, l2e;
    7.28      struct pfn_info *page;
    7.29 -    l2_pgentry_t    *pl2e, nl2e;
    7.30 +    l2_pgentry_t    *pl2e;
    7.31      int              which, cpu = smp_processor_id();
    7.32      u32              l2_idx;
    7.33  
    7.34 @@ -1739,14 +1738,34 @@ int ptwr_do_page_fault(unsigned long add
    7.35      if ( unlikely(l2_idx >= PGT_va_unknown) )
    7.36          domain_crash(); /* Urk! This L1 is mapped in multiple L2 slots! */
    7.37      l2_idx >>= PGT_va_shift;
    7.38 -        
    7.39 +
    7.40 +    if ( l2_idx == (addr >> L2_PAGETABLE_SHIFT) )
    7.41 +    {
    7.42 +        MEM_LOG("PTWR failure! Pagetable maps itself at %08lx\n", addr);
    7.43 +        domain_crash();
    7.44 +    }
    7.45 +
    7.46      /*
    7.47       * Is the L1 p.t. mapped into the current address space? If so we call it
    7.48       * an ACTIVE p.t., otherwise it is INACTIVE.
    7.49       */
    7.50      pl2e = &linear_l2_table[l2_idx];
    7.51 -    which = (l2_pgentry_val(*pl2e) >> PAGE_SHIFT != pfn) ?
    7.52 -        PTWR_PT_INACTIVE : PTWR_PT_ACTIVE;
    7.53 +    l2e  = l2_pgentry_val(*pl2e);
    7.54 +    which = PTWR_PT_INACTIVE;
    7.55 +    if ( (l2e >> PAGE_SHIFT) == pfn )
    7.56 +    {
    7.57 +        /*
    7.58 +         * If the PRESENT bit is clear, we may be conflicting with the current 
    7.59 +         * ACTIVE p.t. (it may be the same p.t. mapped at another virt addr).
    7.60 +         */
    7.61 +        if ( unlikely(!(l2e & _PAGE_PRESENT)) &&
    7.62 +             ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va )
    7.63 +            ptwr_flush(PTWR_PT_ACTIVE);
    7.64 +        
    7.65 +        /* Now do a final check of the PRESENT bit to set ACTIVE. */
    7.66 +        if ( likely(l2e & _PAGE_PRESENT) )
    7.67 +            which = PTWR_PT_ACTIVE;
    7.68 +    }
    7.69      
    7.70      PTWR_PRINTK("[%c] page_fault on l1 pt at va %08lx, pt for %08x, "
    7.71                  "pfn %08lx\n", PTWR_PRINT_WHICH,
    7.72 @@ -1765,8 +1784,7 @@ int ptwr_do_page_fault(unsigned long add
    7.73      /* For safety, disconnect the L1 p.t. page from current space. */
    7.74      if ( (which == PTWR_PT_ACTIVE) && likely(!current->mm.shadow_mode) )
    7.75      {
    7.76 -        nl2e = mk_l2_pgentry(l2_pgentry_val(*pl2e) & ~_PAGE_PRESENT);
    7.77 -        update_l2e(pl2e, *pl2e, nl2e);
    7.78 +        *pl2e = mk_l2_pgentry(l2e & ~_PAGE_PRESENT);
    7.79          flush_tlb(); /* XXX Multi-CPU guests? */
    7.80      }
    7.81