diff mbox series

[Xen-devel,for-4.11,v6,01/16] x86/mm: skip incrementing mfn if it is not a valid mfn

Message ID 20180321044737.20794-2-julien.grall@arm.com
State Superseded
Headers show
Series xen: Convert page_to_mfn and mfn_to_page to use typesafe MFN | expand

Commit Message

Julien Grall March 21, 2018, 4:47 a.m. UTC
From: Wei Liu <wei.liu2@citrix.com>

In a follow-up patches, 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@citrix.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
[Rework the commit message]

--

Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>

    Changes in v6:
        - Update commit message

    Changes in v5:
        - Patch added
---
 xen/arch/x86/mm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Jan Beulich March 21, 2018, 2:11 p.m. UTC | #1
>>> On 21.03.18 at 05:47, <julien.grall@arm.com> wrote:
> From: Wei Liu <wei.liu2@citrix.com>
> 
> In a follow-up patches, 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@citrix.com>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> [Rework the commit message]

Where did my

Reviewed-by: Jan Beulich <jbeulich@suse.com>

go?

Jan
Wei Liu March 21, 2018, 5:55 p.m. UTC | #2
On Wed, Mar 21, 2018 at 04:47:22AM +0000, Julien Grall wrote:
> From: Wei Liu <wei.liu2@citrix.com>
> 
> In a follow-up patches, some callers will be switched to pass

s/patches/patch/
Julien Grall March 21, 2018, 11:03 p.m. UTC | #3
On 03/21/2018 02:11 PM, Jan Beulich wrote:
>>>> On 21.03.18 at 05:47, <julien.grall@arm.com> wrote:
>> From: Wei Liu <wei.liu2@citrix.com>
>>
>> In a follow-up patches, 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@citrix.com>
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>> [Rework the commit message]
> 
> Where did my
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 
> go?

I considered the rewording as a reason to drop the tags.

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 17558e0c8c..3aed94bda5 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4725,7 +4725,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;
         }
@@ -4750,7 +4751,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;
             }
@@ -4818,7 +4820,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
@@ -4847,7 +4850,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;
                 }
@@ -4892,7 +4896,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) &&