ChangeSet 1.1236.33.1, 2005/03/15 08:15:00+00:00, mafetter@xxxxxxxxxxxxxxxx
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@xxxxxxxxxxxx
arch/x86/mm.c | 2 --
arch/x86/shadow.c | 6 +++---
include/asm-x86/shadow.h | 30 +++++++++++++++++++++++++++---
include/xen/perfc_defn.h | 1 +
4 files changed, 31 insertions(+), 8 deletions(-)
diff -Nru a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c 2005-04-05 12:08:01 -04:00
+++ b/xen/arch/x86/mm.c 2005-04-05 12:08:01 -04:00
@@ -1858,8 +1858,6 @@
break;
#endif /* __x86_64__ */
default:
- printk("do_mmu_update writable update: ma=%p val=%p\n",
- req.ptr, req.val);
if ( likely(get_page_type(page, PGT_writable_page)) )
{
if ( shadow_mode_enabled(d) )
diff -Nru a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c 2005-04-05 12:08:01 -04:00
+++ b/xen/arch/x86/shadow.c 2005-04-05 12:08:01 -04:00
@@ -1197,7 +1197,7 @@
{
l1pte_propagate_from_guest(d, gpl1e[i], &spl1e[i]);
if ( spl1e[i] & _PAGE_PRESENT )
- get_page_from_l1e(mk_l1_pgentry(spl1e[i]), d);
+ shadow_get_page_from_l1e(mk_l1_pgentry(spl1e[i]), d);
}
}
}
@@ -1503,7 +1503,7 @@
unsigned long new = old & ~_PAGE_RW;
if ( is_l1_shadow )
- get_page_from_l1e(mk_l1_pgentry(new), d);
+ shadow_get_page_from_l1e(mk_l1_pgentry(new), d);
count++;
pt[i] = new;
@@ -1724,7 +1724,7 @@
unsigned long opte = *ppte;
unsigned long npte = opte & ~_PAGE_RW;
- get_page_from_l1e(mk_l1_pgentry(npte), d);
+ shadow_get_page_from_l1e(mk_l1_pgentry(npte), d);
*ppte = npte;
put_page_from_l1e(mk_l1_pgentry(opte), d);
diff -Nru a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h 2005-04-05 12:08:01 -04:00
+++ b/xen/include/asm-x86/shadow.h 2005-04-05 12:08:01 -04:00
@@ -215,6 +215,30 @@
/************************************************************************/
+static inline int
+shadow_get_page_from_l1e(l1_pgentry_t l1e, struct domain *d)
+{
+ int res = get_page_from_l1e(l1e, d);
+ struct domain *owner;
+
+ if ( unlikely(!res) && IS_PRIV(d) && !shadow_mode_translate(d) &&
+ (owner = page_get_owner(pfn_to_page(l1_pgentry_to_pfn(l1e)))) &&
+ (d != owner) )
+ {
+ res = get_page_from_l1e(l1e, owner);
+ printk("tried to map page from domain %d into shadow page tables "
+ "of domain %d; %s\n",
+ owner->id, d->id, res ? "success" : "failed");
+ }
+
+ if ( unlikely(!res) )
+ perfc_incrc(shadow_get_page_fail);
+
+ return res;
+}
+
+/************************************************************************/
+
static inline void
__shadow_get_l2e(
struct exec_domain *ed, unsigned long va, unsigned long *psl2e)
@@ -257,7 +281,7 @@
if ( (old_hl2e ^ new_hl2e) & (PAGE_MASK | _PAGE_PRESENT) )
{
if ( new_hl2e & _PAGE_PRESENT )
- get_page_from_l1e(mk_l1_pgentry(new_hl2e), ed->domain);
+ shadow_get_page_from_l1e(mk_l1_pgentry(new_hl2e), ed->domain);
if ( old_hl2e & _PAGE_PRESENT )
put_page_from_l1e(mk_l1_pgentry(old_hl2e), ed->domain);
}
@@ -574,7 +598,7 @@
if ( (old_spte ^ new_spte) & (PAGE_MASK | _PAGE_RW | _PAGE_PRESENT) )
{
if ( new_spte & _PAGE_PRESENT )
- get_page_from_l1e(mk_l1_pgentry(new_spte), d);
+ shadow_get_page_from_l1e(mk_l1_pgentry(new_spte), d);
if ( old_spte & _PAGE_PRESENT )
put_page_from_l1e(mk_l1_pgentry(old_spte), d);
}
@@ -1081,7 +1105,7 @@
if ( (old_spte ^ new_spte) & (PAGE_MASK | _PAGE_RW | _PAGE_PRESENT) )
{
if ( new_spte & _PAGE_PRESENT )
- get_page_from_l1e(mk_l1_pgentry(new_spte), d);
+ shadow_get_page_from_l1e(mk_l1_pgentry(new_spte), d);
if ( old_spte & _PAGE_PRESENT )
put_page_from_l1e(mk_l1_pgentry(old_spte), d);
}
diff -Nru a/xen/include/xen/perfc_defn.h b/xen/include/xen/perfc_defn.h
--- a/xen/include/xen/perfc_defn.h 2005-04-05 12:08:01 -04:00
+++ b/xen/include/xen/perfc_defn.h 2005-04-05 12:08:01 -04:00
@@ -43,6 +43,7 @@
PERFCOUNTER_CPU(shadow_status_hit_head, "hits on head of bucket" )
PERFCOUNTER_CPU(check_pagetable, "calls to check_pagetable" )
PERFCOUNTER_CPU(check_all_pagetables, "calls to check_all_pagetables" )
+PERFCOUNTER_CPU(shadow_get_page_fail, "shadow_get_page_from_l1e fails" )
PERFCOUNTER_CPU(shadow_sync_all, "calls to shadow_sync_all")
PERFCOUNTER_CPU(shadow_make_snapshot, "snapshots created")
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|