[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Clean up map_domain_page().
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Date 1180002819 -3600 # Node ID acee9e2c6f8be4f4e89d0f402d05de4970edb24e # Parent 12a12637af464e031c2f08cbf5825e387e899f78 Clean up map_domain_page(). Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- xen/arch/x86/hvm/vlapic.c | 11 ++++++----- xen/arch/x86/mm/shadow/multi.c | 3 ++- xen/arch/x86/x86_32/domain_page.c | 20 ++++++++------------ xen/include/asm-x86/hap.h | 12 ------------ 4 files changed, 16 insertions(+), 30 deletions(-) diff -r 12a12637af46 -r acee9e2c6f8b xen/arch/x86/hvm/vlapic.c --- a/xen/arch/x86/hvm/vlapic.c Thu May 24 10:50:07 2007 +0100 +++ b/xen/arch/x86/hvm/vlapic.c Thu May 24 11:33:39 2007 +0100 @@ -918,16 +918,16 @@ int vlapic_init(struct vcpu *v) vlapic->regs_page = alloc_domheap_page(NULL); if ( vlapic->regs_page == NULL ) { - dprintk(XENLOG_ERR, "malloc vlapic regs_page error for vcpu %x\n", - v->vcpu_id); + dprintk(XENLOG_ERR, "alloc vlapic regs error: %d/%d\n", + v->domain->domain_id, v->vcpu_id); return -ENOMEM; } vlapic->regs = map_domain_page_global(page_to_mfn(vlapic->regs_page)); if ( vlapic->regs == NULL ) { - dprintk(XENLOG_ERR, "malloc vlapic regs error for vcpu %x\n", - v->vcpu_id); + dprintk(XENLOG_ERR, "map vlapic regs error: %d/%d\n", + v->domain->domain_id, v->vcpu_id); return -ENOMEM; } @@ -935,7 +935,8 @@ int vlapic_init(struct vcpu *v) vlapic_reset(vlapic); - vlapic->hw.apic_base_msr = MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE; + vlapic->hw.apic_base_msr = (MSR_IA32_APICBASE_ENABLE | + APIC_DEFAULT_PHYS_BASE); if ( v->vcpu_id == 0 ) vlapic->hw.apic_base_msr |= MSR_IA32_APICBASE_BSP; diff -r 12a12637af46 -r acee9e2c6f8b xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Thu May 24 10:50:07 2007 +0100 +++ b/xen/arch/x86/mm/shadow/multi.c Thu May 24 11:33:39 2007 +0100 @@ -3487,6 +3487,7 @@ sh_update_cr3(struct vcpu *v, int do_loc v->arch.paging.shadow.guest_vtable = sh_map_domain_page_global(gmfn); /* PAGING_LEVELS==4 implies 64-bit, which means that * map_domain_page_global can't fail */ + BUG_ON(v->arch.paging.shadow.guest_vtable == NULL); } else v->arch.paging.shadow.guest_vtable = __linear_l4_table; @@ -3519,7 +3520,7 @@ sh_update_cr3(struct vcpu *v, int do_loc v->arch.paging.shadow.guest_vtable = sh_map_domain_page_global(gmfn); /* Does this really need map_domain_page_global? Handle the * error properly if so. */ - ASSERT( v->arch.paging.shadow.guest_vtable ); + BUG_ON(v->arch.paging.shadow.guest_vtable == NULL); /* XXX */ } else v->arch.paging.shadow.guest_vtable = __linear_l2_table; diff -r 12a12637af46 -r acee9e2c6f8b xen/arch/x86/x86_32/domain_page.c --- a/xen/arch/x86/x86_32/domain_page.c Thu May 24 10:50:07 2007 +0100 +++ b/xen/arch/x86/x86_32/domain_page.c Thu May 24 11:33:39 2007 +0100 @@ -98,7 +98,7 @@ void *map_domain_page(unsigned long mfn) cache->tlbflush_timestamp = tlbflush_current_time(); idx = find_first_zero_bit(cache->inuse, MAPCACHE_ENTRIES); - ASSERT(idx < MAPCACHE_ENTRIES); + BUG_ON(idx >= MAPCACHE_ENTRIES); } set_bit(idx, cache->inuse); @@ -218,25 +218,21 @@ void *map_domain_page_global(unsigned lo idx = find_first_zero_bit(inuse, GLOBALMAP_BITS); va = IOREMAP_VIRT_START + (idx << PAGE_SHIFT); - if ( va >= FIXADDR_START ) - { - va = 0; - goto fail; + if ( unlikely(va >= FIXADDR_START) ) + { + spin_unlock(&globalmap_lock); + return NULL; } } set_bit(idx, inuse); inuse_cursor = idx + 1; - fail: spin_unlock(&globalmap_lock); - if ( likely(va != 0) ) - { - pl2e = virt_to_xen_l2e(va); - pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(va); - l1e_write(pl1e, l1e_from_pfn(mfn, __PAGE_HYPERVISOR)); - } + pl2e = virt_to_xen_l2e(va); + pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(va); + l1e_write(pl1e, l1e_from_pfn(mfn, __PAGE_HYPERVISOR)); return (void *)va; } diff -r 12a12637af46 -r acee9e2c6f8b xen/include/asm-x86/hap.h --- a/xen/include/asm-x86/hap.h Thu May 24 10:50:07 2007 +0100 +++ b/xen/include/asm-x86/hap.h Thu May 24 11:33:39 2007 +0100 @@ -46,18 +46,6 @@ hap_unmap_domain_page(void *p) hap_unmap_domain_page(void *p) { unmap_domain_page(p); -} - -static inline void * -hap_map_domain_page_global(mfn_t mfn) -{ - return map_domain_page_global(mfn_x(mfn)); -} - -static inline void -hap_unmap_domain_page_global(void *p) -{ - unmap_domain_page_global(p); } /************************************************/ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |