ia64/xen-unstable

changeset 1768:c4061a2a3309

bitkeeper revision 1.1071.1.2 (40f3eed8kdZ959gB_ZYkHRPFFEGkKg)

Fix domain death to stop all CPUs running over the defunct page tables.
author kaf24@scramble.cl.cam.ac.uk
date Tue Jul 13 14:16:56 2004 +0000 (2004-07-13)
parents f99dd2296127
children a37ede4b5d41
files xen/arch/x86/domain.c xen/arch/x86/x86_32/mm.c xen/common/kernel.c xen/include/asm-x86/mm.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Tue Jul 13 13:13:40 2004 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Tue Jul 13 14:16:56 2004 +0000
     1.3 @@ -445,12 +445,8 @@ void domain_relinquish_memory(struct dom
     1.4      struct pfn_info  *page;
     1.5      unsigned long     x, y;
     1.6  
     1.7 -    /*
     1.8 -     * If we're executing the idle task then we may still be running over the 
     1.9 -     * dead domain's page tables. We'd better fix that before freeing them!
    1.10 -     */
    1.11 -    if ( is_idle_task(current) )
    1.12 -        write_ptbase(&current->mm);
    1.13 +    /* Ensure that noone is running over the dead domain's page tables. */
    1.14 +    synchronise_pagetables(~0UL);
    1.15  
    1.16      /* Exit shadow mode before deconstructing final guest page table. */
    1.17      shadow_mode_disable(d);
     2.1 --- a/xen/arch/x86/x86_32/mm.c	Tue Jul 13 13:13:40 2004 +0000
     2.2 +++ b/xen/arch/x86/x86_32/mm.c	Tue Jul 13 14:16:56 2004 +0000
     2.3 @@ -129,6 +129,22 @@ void __init zap_low_mappings(void)
     2.4  }
     2.5  
     2.6  
     2.7 +/*
     2.8 + * Allows shooting down of borrowed page-table use on specific CPUs.
     2.9 + * Specifically, we borrow page tables when running the idle domain.
    2.10 + */
    2.11 +static void __synchronise_pagetables(void *mask)
    2.12 +{
    2.13 +    struct domain *d = current;
    2.14 +    if ( ((unsigned long)mask & (1<<d->processor)) && is_idle_task(d) )
    2.15 +        write_ptbase(&d->mm);
    2.16 +}
    2.17 +void synchronise_pagetables(unsigned long cpu_mask)
    2.18 +{
    2.19 +    __synchronise_pagetables((void *)cpu_mask);
    2.20 +    smp_call_function(__synchronise_pagetables, (void *)cpu_mask, 1, 1);
    2.21 +}
    2.22 +
    2.23  long do_stack_switch(unsigned long ss, unsigned long esp)
    2.24  {
    2.25      int nr = smp_processor_id();
     3.1 --- a/xen/common/kernel.c	Tue Jul 13 13:13:40 2004 +0000
     3.2 +++ b/xen/common/kernel.c	Tue Jul 13 14:16:56 2004 +0000
     3.3 @@ -225,7 +225,6 @@ void cmain(unsigned long magic, multiboo
     3.4  
     3.5      init_frametable((void *)FRAMETABLE_VIRT_START, max_page);
     3.6  
     3.7 -
     3.8  #elif defined(__x86_64__)
     3.9  
    3.10      init_frametable(__va(xenheap_phys_end), max_page);
     4.1 --- a/xen/include/asm-x86/mm.h	Tue Jul 13 13:13:40 2004 +0000
     4.2 +++ b/xen/include/asm-x86/mm.h	Tue Jul 13 14:16:56 2004 +0000
     4.3 @@ -277,6 +277,12 @@ static inline int get_page_and_type(stru
     4.4  int check_descriptor(unsigned long a, unsigned long b);
     4.5  
     4.6  /*
     4.7 + * Use currently-executing domain's pagetables on the specified CPUs.
     4.8 + * i.e., stop borrowing someone else's tables if you are the idle domain.
     4.9 + */
    4.10 +void synchronise_pagetables(unsigned long cpu_mask);
    4.11 +
    4.12 +/*
    4.13   * The MPT (machine->physical mapping table) is an array of word-sized
    4.14   * values, indexed on machine frame number. It is expected that guest OSes
    4.15   * will use it to store a "physical" frame number to give the appearance of