[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/mm: skip incrementing mfn if it is not a valid mfn
commit acf92c83b58e404374300397801deb80fb8d883e Author: Wei Liu <wei.liu2@xxxxxxxxxx> AuthorDate: Fri Mar 9 17:20:14 2018 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Thu Apr 5 18:43:42 2018 +0100 x86/mm: skip incrementing mfn if it is not a valid mfn In a follow-up patch, some callers will be switched to pass INVALID_MFN instead of zero for non-present mappings. So skip incrementing mfn if it is not a valid one. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Signed-off-by: Julien Grall <julien.grall@xxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/mm.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 6d39d2c8ab..488e66a344 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4775,7 +4775,8 @@ int map_pages_to_xen( } virt += 1UL << L3_PAGETABLE_SHIFT; - mfn += 1UL << (L3_PAGETABLE_SHIFT - PAGE_SHIFT); + if ( !mfn_eq(_mfn(mfn), INVALID_MFN) ) + mfn += 1UL << (L3_PAGETABLE_SHIFT - PAGE_SHIFT); nr_mfns -= 1UL << (L3_PAGETABLE_SHIFT - PAGE_SHIFT); continue; } @@ -4800,7 +4801,8 @@ int map_pages_to_xen( if ( i > nr_mfns ) i = nr_mfns; virt += i << PAGE_SHIFT; - mfn += i; + if ( !mfn_eq(_mfn(mfn), INVALID_MFN) ) + mfn += i; nr_mfns -= i; continue; } @@ -4868,7 +4870,8 @@ int map_pages_to_xen( } virt += 1UL << L2_PAGETABLE_SHIFT; - mfn += 1UL << PAGETABLE_ORDER; + if ( !mfn_eq(_mfn(mfn), INVALID_MFN) ) + mfn += 1UL << PAGETABLE_ORDER; nr_mfns -= 1UL << PAGETABLE_ORDER; } else @@ -4897,7 +4900,8 @@ int map_pages_to_xen( if ( i > nr_mfns ) i = nr_mfns; virt += i << L1_PAGETABLE_SHIFT; - mfn += i; + if ( !mfn_eq(_mfn(mfn), INVALID_MFN) ) + mfn += i; nr_mfns -= i; goto check_l3; } @@ -4942,7 +4946,8 @@ int map_pages_to_xen( } virt += 1UL << L1_PAGETABLE_SHIFT; - mfn += 1UL; + if ( !mfn_eq(_mfn(mfn), INVALID_MFN) ) + mfn += 1UL; nr_mfns -= 1UL; if ( (flags == PAGE_HYPERVISOR) && -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |