P2M superpages fixes
Hello,
This patch addresses three issues in the p2m superpages:
- return -EINVAL if the guest is trying to request a page_order not supported by current implementation (0 or 9).
- check for error (as it used to be) on guest_pyshmap_add_page in populate_physmap()
- Re-insert missing shadow code from the original patch that was submitted to xen-devel, to remove mappings when we're removing a p2m 2mb page.
Signed-off-by Gianluca Guida <[email protected]>
xen/arch/x86/mm/p2m.c +8 -0
@@ -939,6 +939,14 @@ guest_physmap_add_entry(struct domain *dP2M_DEBUG ("adding gfn=%#lx mfn=%#lx\n" , gfn, mfn); +if ( page_order && (page_order !=9 ) ) + { +/* Current implementation supports only 4kb and 2Mb pages. */ +gdprintk (XENLOG_ERR ,"request of P2M %d page order not supported.\n" , + page_order); +return -EINVAL ; + } + omfn =gfn_to_mfn (d, gfn, &ot);if (p2m_is_ram (ot) ) {
xen/arch/x86/mm/shadow/common.c +20 -0
@@ -3354,6 +3354,26 @@ shadow_write_p2m_entry(struct vcpu *v, u } } +/* If we're removing a superpage mapping from the p2m, remove all the +* MFNs covered by it from the shadows too. */ +if ( level ==2 && (l1e_get_flags (*p) & _PAGE_PRESENT) && + (l1e_get_flags (*p) & _PAGE_PSE) ) + { +unsigned int i; +mfn_t mfn =_mfn (l1e_get_pfn (*p)); +p2m_type_t p2mt =p2m_flags_to_type (l1e_get_flags (*p)); +if (p2m_is_valid (p2mt) &&mfn_valid (mfn) ) + { +for ( i =0 ; i <L1_PAGETABLE_ENTRIES ; i++ ) + { +sh_remove_all_shadows_and_parents (v, mfn); +if (sh_remove_all_mappings (v, mfn) ) +flush_tlb_mask (d->domain_dirty_cpumask); + mfn =_mfn (mfn_x (mfn) +1 ); + } + } + } +/* Update the entry with new content */ safe_write_pte (p, new);
xen/common/memory.c +2 -1
@@ -122,7 +122,8 @@ static void populate_physmap(struct memo } mfn =page_to_mfn (page); -guest_physmap_add_page (d, gpfn, mfn, a->extent_order); +if (guest_physmap_add_page (d, gpfn, mfn, a->extent_order) ) + goto out;if ( !paging_mode_translate (d) ) {
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel