[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/2] x86/mm: don't open-code p2m_is_pod()
Replace all comparisons against p2m_populate_on_demand (outside of switch() statements) with the designated predicate. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -344,7 +344,7 @@ static int ept_next_level(struct p2m_dom { int rc; - if ( e.sa_p2mt == p2m_populate_on_demand ) + if ( p2m_is_pod(e.sa_p2mt) ) return GUEST_TABLE_POD_PAGE; if ( read_only ) @@ -1071,7 +1071,7 @@ static mfn_t ept_get_entry(struct p2m_do index = gfn_remainder >> (i * EPT_TABLE_ORDER); ept_entry = table + index; - if ( ept_entry->sa_p2mt == p2m_populate_on_demand ) + if ( p2m_is_pod(ept_entry->sa_p2mt) ) { if ( !(q & P2M_ALLOC) ) { @@ -1478,7 +1478,7 @@ static void ept_dump_p2m_table(unsigned ept_entry = table + (gfn_remainder >> order); if ( ret != GUEST_TABLE_MAP_FAILED && is_epte_valid(ept_entry) ) { - if ( ept_entry->sa_p2mt == p2m_populate_on_demand ) + if ( p2m_is_pod(ept_entry->sa_p2mt) ) printk("gfn: %13lx order: %2d PoD\n", gfn, order); else printk("gfn: %13lx order: %2d mfn: %13lx %c%c%c %c%c%c\n", --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -543,7 +543,7 @@ decrease_reservation(struct domain *d, g p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, &cur_order, NULL); n = 1UL << min(order, cur_order); - if ( t == p2m_populate_on_demand ) + if ( p2m_is_pod(t) ) pod += n; else if ( p2m_is_ram(t) ) ram += n; @@ -618,7 +618,7 @@ decrease_reservation(struct domain *d, g if ( order < cur_order ) cur_order = order; n = 1UL << cur_order; - if ( t == p2m_populate_on_demand ) + if ( p2m_is_pod(t) ) { /* This shouldn't be able to fail */ if ( p2m_set_entry(p2m, gfn_add(gfn, i), INVALID_MFN, cur_order, @@ -1332,7 +1332,7 @@ mark_populate_on_demand(struct domain *d p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, &cur_order, NULL); n = 1UL << min(order, cur_order); - if ( ot == p2m_populate_on_demand ) + if ( p2m_is_pod(ot) ) { /* Count how many PoD entries we'll be replacing if successful */ pod_count += n; --- a/xen/arch/x86/mm/p2m-pt.c +++ b/xen/arch/x86/mm/p2m-pt.c @@ -841,7 +841,7 @@ pod_retry_l3: flags = l3e_get_flags(*l3e); if ( !(flags & _PAGE_PRESENT) ) { - if ( p2m_flags_to_type(flags) == p2m_populate_on_demand ) + if ( p2m_is_pod(p2m_flags_to_type(flags)) ) { if ( q & P2M_ALLOC ) { @@ -884,7 +884,7 @@ pod_retry_l2: if ( !(flags & _PAGE_PRESENT) ) { /* PoD: Try to populate a 2-meg chunk */ - if ( p2m_flags_to_type(flags) == p2m_populate_on_demand ) + if ( p2m_is_pod(p2m_flags_to_type(flags)) ) { if ( q & P2M_ALLOC ) { if ( p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_2M) ) @@ -923,7 +923,7 @@ pod_retry_l1: if ( !(flags & _PAGE_PRESENT) && !p2m_is_paging(l1t) ) { /* PoD: Try to populate */ - if ( l1t == p2m_populate_on_demand ) + if ( p2m_is_pod(l1t) ) { if ( q & P2M_ALLOC ) { if ( p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_4K) ) @@ -1094,8 +1094,7 @@ static long p2m_pt_audit_p2m(struct p2m_ if ( !(l2e_get_flags(l2e[i2]) & _PAGE_PRESENT) ) { if ( (l2e_get_flags(l2e[i2]) & _PAGE_PSE) - && ( p2m_flags_to_type(l2e_get_flags(l2e[i2])) - == p2m_populate_on_demand ) ) + && p2m_is_pod(p2m_flags_to_type(l2e_get_flags(l2e[i2]))) ) entry_count+=SUPERPAGE_PAGES; gfn += 1 << (L2_PAGETABLE_SHIFT - PAGE_SHIFT); continue; @@ -1132,7 +1131,7 @@ static long p2m_pt_audit_p2m(struct p2m_ type = p2m_flags_to_type(l1e_get_flags(l1e[i1])); if ( !(l1e_get_flags(l1e[i1]) & _PAGE_PRESENT) ) { - if ( type == p2m_populate_on_demand ) + if ( p2m_is_pod(type) ) entry_count++; continue; } --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -992,7 +992,7 @@ guest_physmap_add_entry(struct domain *d ASSERT(mfn_valid(omfn)); set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY); } - else if ( ot == p2m_populate_on_demand ) + else if ( p2m_is_pod(ot) ) { /* Count how man PoD entries we'll be replacing if successful */ pod_count++; --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -1476,7 +1476,7 @@ static int validate_gl4e(struct vcpu *v, mfn_t gl3mfn = get_gfn_query_unlocked(d, gfn_x(gl3gfn), &p2mt); if ( p2m_is_ram(p2mt) ) sl3mfn = get_shadow_status(d, gl3mfn, SH_type_l3_shadow); - else if ( p2mt != p2m_populate_on_demand ) + else if ( !p2m_is_pod(p2mt) ) result |= SHADOW_SET_ERROR; #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC ) @@ -1535,7 +1535,7 @@ static int validate_gl3e(struct vcpu *v, mfn_t gl2mfn = get_gfn_query_unlocked(d, gfn_x(gl2gfn), &p2mt); if ( p2m_is_ram(p2mt) ) sl2mfn = get_shadow_status(d, gl2mfn, SH_type_l2_shadow); - else if ( p2mt != p2m_populate_on_demand ) + else if ( !p2m_is_pod(p2mt) ) result |= SHADOW_SET_ERROR; #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC ) @@ -1586,7 +1586,7 @@ static int validate_gl2e(struct vcpu *v, mfn_t gl1mfn = get_gfn_query_unlocked(d, gfn_x(gl1gfn), &p2mt); if ( p2m_is_ram(p2mt) ) sl1mfn = get_shadow_status(d, gl1mfn, SH_type_l1_shadow); - else if ( p2mt != p2m_populate_on_demand ) + else if ( !p2m_is_pod(p2mt) ) result |= SHADOW_SET_ERROR; } }
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |