direct-io.hg

changeset 12900:3e2b6365ba75

[XEN] The shadow FAST_FAULT_PATH optimisation assumes that pages never
transition between mmio and RAM-backed. This isn't true after a
an add_to_physmap memory op. Fix this by just blowing the shadow tables
after every such operation; they're rare enough that the performance
hit is not a concern.

Signed-off-by: Steven Smith <sos22@cam.ac.uk>
Acked-by: Tim Deegan <Tim.Deegan@xensource.com>
author ssmith@localhost.localdomain
date Mon Dec 11 11:16:29 2006 -0800 (2006-12-11)
parents 0bea8e773508
children aabceba1dbc5
files xen/arch/x86/mm.c xen/arch/x86/mm/shadow/common.c xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/xen/arch/x86/mm.c	Tue Dec 05 17:01:34 2006 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Mon Dec 11 11:16:29 2006 -0800
     1.3 @@ -2968,7 +2968,17 @@ long arch_memory_op(int op, XEN_GUEST_HA
     1.4          guest_physmap_add_page(d, xatp.gpfn, mfn);
     1.5  
     1.6          UNLOCK_BIGLOCK(d);
     1.7 -        
     1.8 +
     1.9 +        /* If we're doing FAST_FAULT_PATH, then shadow mode may have
    1.10 +           cached the fact that this is an mmio region in the shadow
    1.11 +           page tables.  Blow the tables away to remove the cache.
    1.12 +           This is pretty heavy handed, but this is a rare operation
    1.13 +           (it might happen a dozen times during boot and then never
    1.14 +           again), so it doesn't matter too much. */
    1.15 +        shadow_lock(d);
    1.16 +        shadow_blow_tables(d);
    1.17 +        shadow_unlock(d);
    1.18 +
    1.19          put_domain(d);
    1.20  
    1.21          break;
     2.1 --- a/xen/arch/x86/mm/shadow/common.c	Tue Dec 05 17:01:34 2006 +0000
     2.2 +++ b/xen/arch/x86/mm/shadow/common.c	Mon Dec 11 11:16:29 2006 -0800
     2.3 @@ -733,7 +733,7 @@ void shadow_prealloc(struct domain *d, u
     2.4  
     2.5  /* Deliberately free all the memory we can: this will tear down all of
     2.6   * this domain's shadows */
     2.7 -static void shadow_blow_tables(struct domain *d) 
     2.8 +void shadow_blow_tables(struct domain *d) 
     2.9  {
    2.10      struct list_head *l, *t;
    2.11      struct shadow_page_info *sp;
     3.1 --- a/xen/include/asm-x86/shadow.h	Tue Dec 05 17:01:34 2006 +0000
     3.2 +++ b/xen/include/asm-x86/shadow.h	Mon Dec 11 11:16:29 2006 -0800
     3.3 @@ -540,6 +540,9 @@ extern int shadow_remove_write_access(st
     3.4   * Returns non-zero if we need to flush TLBs. */
     3.5  extern int shadow_remove_all_mappings(struct vcpu *v, mfn_t target_mfn);
     3.6  
     3.7 +/* Remove all mappings from the shadows. */
     3.8 +extern void shadow_blow_tables(struct domain *d);
     3.9 +
    3.10  void
    3.11  shadow_remove_all_shadows_and_parents(struct vcpu *v, mfn_t gmfn);
    3.12  /* This is a HVM page that we thing is no longer a pagetable.