[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] dom0 runs well in shadow translate mode!
ChangeSet 1.1236.32.11, 2005/03/18 17:01:47+00:00, mafetter@xxxxxxxxxxxxxxxx dom0 runs well in shadow translate mode! Signed-off-by: michael.fetterman@xxxxxxxxxxxx arch/x86/audit.c | 11 + arch/x86/domain.c | 2 arch/x86/extable.c | 9 + arch/x86/mm.c | 51 +++---- arch/x86/shadow.c | 243 ++++++++++++++++++++--------------- arch/x86/vmx.c | 4 arch/x86/x86_32/domain_build.c | 14 +- arch/x86/x86_32/domain_page.c | 8 - arch/x86/x86_32/traps.c | 2 common/page_alloc.c | 9 + include/asm-x86/mm.h | 57 +++++++- include/asm-x86/shadow.h | 177 ++++++++++++++++++++----- include/asm-x86/vmx_platform.h | 3 include/asm-x86/x86_32/domain_page.h | 18 ++ include/xen/perfc_defn.h | 8 + include/xen/sched.h | 1 16 files changed, 437 insertions(+), 180 deletions(-) diff -Nru a/xen/arch/x86/audit.c b/xen/arch/x86/audit.c --- a/xen/arch/x86/audit.c 2005-04-05 12:12:50 -04:00 +++ b/xen/arch/x86/audit.c 2005-04-05 12:12:50 -04:00 @@ -36,7 +36,7 @@ static int l1, l2, oos_count, page_count; #define FILE_AND_LINE 0 -//#define MFN_TO_WATCH 0x4700 +//#define MFN2_TO_WATCH 0x1d8 #if FILE_AND_LINE #define adjust(_p, _a) _adjust((_p), (_a), __FILE__, __LINE__) @@ -56,10 +56,10 @@ void _adjust(struct pfn_info *page, int adjtype ADJUST_EXTRA_ARGS) { -#ifdef MFN_TO_WATCH - if (page_to_pfn(page) == MFN_TO_WATCH) +#ifdef MFN2_TO_WATCH + if (page_to_pfn(page) == MFN2_TO_WATCH) { - APRINTK("adjust(mfn=%p, dir=%d, adjtype=%d) MFN_TO_WATCH", + APRINTK("adjust(mfn=%p, dir=%d, adjtype=%d)", page_to_pfn(page), dir, adjtype); } #endif @@ -547,6 +547,9 @@ adjust_oos_list(); adjust_shadow_tables(); } + + //printk("d->shared_info=%p __pa()=%p\n", d->shared_info, __pa(d->shared_info)); + adjust(virt_to_page(d->shared_info), 1); return errors; } diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c 2005-04-05 12:12:49 -04:00 +++ b/xen/arch/x86/domain.c 2005-04-05 12:12:50 -04:00 @@ -238,7 +238,7 @@ d->shared_info = (void *)alloc_xenheap_page(); memset(d->shared_info, 0, PAGE_SIZE); ed->vcpu_info = &d->shared_info->vcpu_data[ed->eid]; - SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d); + SHARE_PFN_WITH_DOMAIN2(virt_to_page(d->shared_info), d); machine_to_phys_mapping[virt_to_phys(d->shared_info) >> PAGE_SHIFT] = INVALID_M2P_ENTRY; diff -Nru a/xen/arch/x86/extable.c b/xen/arch/x86/extable.c --- a/xen/arch/x86/extable.c 2005-04-05 12:12:51 -04:00 +++ b/xen/arch/x86/extable.c 2005-04-05 12:12:51 -04:00 @@ -3,6 +3,11 @@ #include <xen/spinlock.h> #include <asm/uaccess.h> +#ifdef PERF_COUNTERS +#include <xen/sched.h> +#include <xen/perfc.h> +#endif + extern struct exception_table_entry __start___ex_table[]; extern struct exception_table_entry __stop___ex_table[]; extern struct exception_table_entry __start___pre_ex_table[]; @@ -69,5 +74,9 @@ unsigned long fixup = search_one_table( __start___pre_ex_table, __stop___pre_ex_table-1, addr); DPRINTK("Pre-exception: %p -> %p\n", addr, fixup); +#ifdef PERF_COUNTERS + if ( fixup ) + perfc_incrc(exception_fixed); +#endif return fixup; } diff -Nru a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c 2005-04-05 12:12:50 -04:00 +++ b/xen/arch/x86/mm.c 2005-04-05 12:12:51 -04:00 @@ -262,7 +262,7 @@ gpfn = l1_pgentry_to_pfn(mk_l1_pgentry(l1e)); gmfn = __gpfn_to_mfn(d, gpfn); - if ( unlikely(!gmfn) ) + if ( unlikely(!VALID_MFN(gmfn)) ) return 0; if ( unlikely(shadow_mode_enabled(d)) ) @@ -1088,7 +1088,7 @@ } -void put_page_type(struct pfn_info *page) +void _put_page_type(struct pfn_info *page) { u32 nx, x, y = page->u.inuse.type_info; @@ -1143,7 +1143,7 @@ } -int get_page_type(struct pfn_info *page, u32 type) +int _get_page_type(struct pfn_info *page, u32 type) { u32 nx, x, y = page->u.inuse.type_info; @@ -1286,8 +1286,7 @@ unsigned int cmd = val & MMUEXT_CMD_MASK, type; struct exec_domain *ed = current; struct domain *d = ed->domain, *e; - unsigned long gpfn = ptr >> PAGE_SHIFT; - unsigned long mfn = __gpfn_to_mfn(d, gpfn); + unsigned long mfn = ptr >> PAGE_SHIFT; struct pfn_info *page = &frame_table[mfn]; u32 x, y, _d, _nd; domid_t domid; @@ -1304,15 +1303,6 @@ type = PGT_l1_page_table | PGT_va_mutable; pin_page: - if ( unlikely(percpu_info[cpu].foreign && - (shadow_mode_translate(d) || - shadow_mode_translate(percpu_info[cpu].foreign))) ) - { - // oops -- we should be using the foreign domain's P2M - mfn = __gpfn_to_mfn(FOREIGNDOM, gpfn); - page = &frame_table[mfn]; - } - if ( shadow_mode_enabled(FOREIGNDOM) ) type = PGT_writable_page; @@ -1349,15 +1339,6 @@ #endif /* __x86_64__ */ case MMUEXT_UNPIN_TABLE: - if ( unlikely(percpu_info[cpu].foreign && - (shadow_mode_translate(d) || - shadow_mode_translate(percpu_info[cpu].foreign))) ) - { - // oops -- we should be using the foreign domain's P2M - mfn = __gpfn_to_mfn(FOREIGNDOM, gpfn); - page = &frame_table[mfn]; - } - if ( unlikely(!(okay = get_page_from_pagenr(mfn, FOREIGNDOM))) ) { MEM_LOG("mfn %p bad domain (dom=%p)", @@ -1723,9 +1704,7 @@ cleanup_writable_pagetable(d); if ( unlikely(shadow_mode_enabled(d)) ) - { check_pagetable(ed, "pre-mmu"); /* debug */ - } /* * If we are resuming after preemption, read how much work we have already @@ -1783,8 +1762,7 @@ } cmd = req.ptr & (sizeof(l1_pgentry_t)-1); - gpfn = req.ptr >> PAGE_SHIFT; - mfn = __gpfn_to_mfn(d, gpfn); + mfn = req.ptr >> PAGE_SHIFT; okay = 0; @@ -1867,6 +1845,8 @@ if ( shadow_mode_log_dirty(d) ) __mark_dirty(d, mfn); + gpfn = __mfn_to_gpfn(d, mfn); + ASSERT(gpfn); if ( page_is_page_table(page) ) shadow_mark_mfn_out_of_sync(ed, gpfn, mfn); } @@ -1886,6 +1866,21 @@ break; case MMU_MACHPHYS_UPDATE: + + // HACK ALERT... This about this later... + // + if ( unlikely(shadow_mode_translate(FOREIGNDOM) && IS_PRIV(d)) ) + { + rc = FOREIGNDOM->next_io_page++; + printk("privileged guest dom%d requests mfn=%p for dom%d, gets pfn=%p\n", + d->id, mfn, FOREIGNDOM->id, rc); + set_machinetophys(mfn, rc); + set_p2m_entry(FOREIGNDOM, rc, mfn); + okay = 1; + break; + } + BUG(); + if ( unlikely(!get_page_from_pagenr(mfn, FOREIGNDOM)) ) { MEM_LOG("Could not get page for mach->phys update"); @@ -2250,7 +2245,7 @@ LOCK_BIGLOCK(dom); - if ( !(mfn = __gpfn_to_mfn(dom, gpfn)) ) { + if ( !VALID_MFN(mfn = __gpfn_to_mfn(dom, gpfn)) ) { UNLOCK_BIGLOCK(dom); return -EINVAL; } diff -Nru a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c --- a/xen/arch/x86/shadow.c 2005-04-05 12:12:49 -04:00 +++ b/xen/arch/x86/shadow.c 2005-04-05 12:12:49 -04:00 @@ -191,14 +191,6 @@ unsigned long smfn; int pin = 0; - if ( (psh_type != PGT_snapshot) && - !shadow_promote(d, gpfn, gmfn, psh_type) ) - { - FSH_LOG("promotion of pfn=%p mfn=%p failed! external gnttab refs?\n", - gpfn, gmfn); - return 0; - } - page = alloc_domheap_page(NULL); if ( unlikely(page == NULL) ) { @@ -222,11 +214,15 @@ switch ( psh_type ) { case PGT_l1_shadow: + if ( !shadow_promote(d, gpfn, gmfn, psh_type) ) + goto oom; perfc_incr(shadow_l1_pages); d->arch.shadow_page_count++; break; case PGT_l2_shadow: + if ( !shadow_promote(d, gpfn, gmfn, psh_type) ) + goto oom; perfc_incr(shadow_l2_pages); d->arch.shadow_page_count++; if ( PGT_l2_page_table == PGT_root_page_table ) @@ -235,13 +231,16 @@ break; case PGT_hl2_shadow: + // Treat an hl2 as an L1 for purposes of promotion. + // For external mode domains, treat them as an L2 for purposes of + // pinning. + // + if ( !shadow_promote(d, gpfn, gmfn, PGT_l1_shadow) ) + goto oom; perfc_incr(hl2_table_pages); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |