ia64/xen-unstable

changeset 4147:2d50ee7a068d

bitkeeper revision 1.1236.33.1 (42369984aBV0c2ogV4Bh1SA0FxWSLA)

Added support for mapping other domain's memory from a privileged
shadowed domain. Should hopefully enable a shadowed dom0 to start
up other domains.

Signed-off-by: michael.fetterman@cl.cam.ac.uk
author mafetter@fleming.research
date Tue Mar 15 08:15:00 2005 +0000 (2005-03-15)
parents 67c3463e70f1
children 5f0125b2f3a9
files xen/arch/x86/mm.c xen/arch/x86/shadow.c xen/include/asm-x86/shadow.h xen/include/xen/perfc_defn.h
line diff
     1.1 --- a/xen/arch/x86/mm.c	Mon Mar 14 22:07:47 2005 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Tue Mar 15 08:15:00 2005 +0000
     1.3 @@ -1858,8 +1858,6 @@ int do_mmu_update(
     1.4                  break;
     1.5  #endif /* __x86_64__ */
     1.6              default:
     1.7 -                printk("do_mmu_update writable update: ma=%p val=%p\n",
     1.8 -                       req.ptr, req.val);
     1.9                  if ( likely(get_page_type(page, PGT_writable_page)) )
    1.10                  {
    1.11                      if ( shadow_mode_enabled(d) )
     2.1 --- a/xen/arch/x86/shadow.c	Mon Mar 14 22:07:47 2005 +0000
     2.2 +++ b/xen/arch/x86/shadow.c	Tue Mar 15 08:15:00 2005 +0000
     2.3 @@ -1197,7 +1197,7 @@ void shadow_map_l1_into_current_l2(unsig
     2.4          {
     2.5              l1pte_propagate_from_guest(d, gpl1e[i], &spl1e[i]);
     2.6              if ( spl1e[i] & _PAGE_PRESENT )
     2.7 -                get_page_from_l1e(mk_l1_pgentry(spl1e[i]), d);
     2.8 +                shadow_get_page_from_l1e(mk_l1_pgentry(spl1e[i]), d);
     2.9          }
    2.10      }
    2.11  }
    2.12 @@ -1503,7 +1503,7 @@ static u32 remove_all_write_access_in_pt
    2.13              unsigned long new = old & ~_PAGE_RW;
    2.14  
    2.15              if ( is_l1_shadow )
    2.16 -                get_page_from_l1e(mk_l1_pgentry(new), d);
    2.17 +                shadow_get_page_from_l1e(mk_l1_pgentry(new), d);
    2.18  
    2.19              count++;
    2.20              pt[i] = new;
    2.21 @@ -1724,7 +1724,7 @@ void __shadow_sync_all(struct domain *d)
    2.22          unsigned long opte = *ppte;
    2.23          unsigned long npte = opte & ~_PAGE_RW;
    2.24  
    2.25 -        get_page_from_l1e(mk_l1_pgentry(npte), d);
    2.26 +        shadow_get_page_from_l1e(mk_l1_pgentry(npte), d);
    2.27          *ppte = npte;
    2.28          put_page_from_l1e(mk_l1_pgentry(opte), d);
    2.29  
     3.1 --- a/xen/include/asm-x86/shadow.h	Mon Mar 14 22:07:47 2005 +0000
     3.2 +++ b/xen/include/asm-x86/shadow.h	Tue Mar 15 08:15:00 2005 +0000
     3.3 @@ -215,6 +215,30 @@ extern int shadow_status_noswap;
     3.4  
     3.5  /************************************************************************/
     3.6  
     3.7 +static inline int
     3.8 +shadow_get_page_from_l1e(l1_pgentry_t l1e, struct domain *d)
     3.9 +{
    3.10 +    int res = get_page_from_l1e(l1e, d);
    3.11 +    struct domain *owner;
    3.12 +
    3.13 +    if ( unlikely(!res) && IS_PRIV(d) && !shadow_mode_translate(d) &&
    3.14 +         (owner = page_get_owner(pfn_to_page(l1_pgentry_to_pfn(l1e)))) &&
    3.15 +         (d != owner) )
    3.16 +    {
    3.17 +        res = get_page_from_l1e(l1e, owner);
    3.18 +        printk("tried to map page from domain %d into shadow page tables "
    3.19 +               "of domain %d; %s\n",
    3.20 +               owner->id, d->id, res ? "success" : "failed");
    3.21 +    }
    3.22 +
    3.23 +    if ( unlikely(!res) )
    3.24 +        perfc_incrc(shadow_get_page_fail);
    3.25 +
    3.26 +    return res;
    3.27 +}
    3.28 +
    3.29 +/************************************************************************/
    3.30 +
    3.31  static inline void
    3.32  __shadow_get_l2e(
    3.33      struct exec_domain *ed, unsigned long va, unsigned long *psl2e)
    3.34 @@ -257,7 +281,7 @@ static inline void
    3.35          if ( (old_hl2e ^ new_hl2e) & (PAGE_MASK | _PAGE_PRESENT) )
    3.36          {
    3.37              if ( new_hl2e & _PAGE_PRESENT )
    3.38 -                get_page_from_l1e(mk_l1_pgentry(new_hl2e), ed->domain);
    3.39 +                shadow_get_page_from_l1e(mk_l1_pgentry(new_hl2e), ed->domain);
    3.40              if ( old_hl2e & _PAGE_PRESENT )
    3.41                  put_page_from_l1e(mk_l1_pgentry(old_hl2e), ed->domain);
    3.42          }
    3.43 @@ -574,7 +598,7 @@ validate_pte_change(
    3.44      if ( (old_spte ^ new_spte) & (PAGE_MASK | _PAGE_RW | _PAGE_PRESENT) )
    3.45      {
    3.46          if ( new_spte & _PAGE_PRESENT )
    3.47 -            get_page_from_l1e(mk_l1_pgentry(new_spte), d);
    3.48 +            shadow_get_page_from_l1e(mk_l1_pgentry(new_spte), d);
    3.49          if ( old_spte & _PAGE_PRESENT )
    3.50              put_page_from_l1e(mk_l1_pgentry(old_spte), d);
    3.51      }
    3.52 @@ -1081,7 +1105,7 @@ shadow_set_l1e(unsigned long va, unsigne
    3.53      if ( (old_spte ^ new_spte) & (PAGE_MASK | _PAGE_RW | _PAGE_PRESENT) )
    3.54      {
    3.55          if ( new_spte & _PAGE_PRESENT )
    3.56 -            get_page_from_l1e(mk_l1_pgentry(new_spte), d);
    3.57 +            shadow_get_page_from_l1e(mk_l1_pgentry(new_spte), d);
    3.58          if ( old_spte & _PAGE_PRESENT )
    3.59              put_page_from_l1e(mk_l1_pgentry(old_spte), d);
    3.60      }
     4.1 --- a/xen/include/xen/perfc_defn.h	Mon Mar 14 22:07:47 2005 +0000
     4.2 +++ b/xen/include/xen/perfc_defn.h	Tue Mar 15 08:15:00 2005 +0000
     4.3 @@ -43,6 +43,7 @@ PERFCOUNTER_CPU(shadow_status_miss,     
     4.4  PERFCOUNTER_CPU(shadow_status_hit_head, "hits on head of bucket" )
     4.5  PERFCOUNTER_CPU(check_pagetable,        "calls to check_pagetable" )
     4.6  PERFCOUNTER_CPU(check_all_pagetables,   "calls to check_all_pagetables" )
     4.7 +PERFCOUNTER_CPU(shadow_get_page_fail,   "shadow_get_page_from_l1e fails" )
     4.8  
     4.9  PERFCOUNTER_CPU(shadow_sync_all,                   "calls to shadow_sync_all")
    4.10  PERFCOUNTER_CPU(shadow_make_snapshot,              "snapshots created")