diff mbox series

[RFC,17/84] xxx fixup: avoid shadowing mfn

Message ID 754cbac796a3e4326e2ad6b103d85dbbc3f51ae2.1569489002.git.hongyax@amazon.com (mailing list archive)
State New, archived
Headers show
Series Remove direct map from Xen | expand

Commit Message

Xia, Hongyan Sept. 26, 2019, 9:45 a.m. UTC
From: Wei Liu <wei.liu2@citrix.com>

---
 xen/arch/x86/mm.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

Comments

Wei Liu Sept. 26, 2019, 1:05 p.m. UTC | #1
On Thu, Sep 26, 2019 at 10:45:40AM +0100, hongyax@amazon.com wrote:
> From: Wei Liu <wei.liu2@citrix.com>
> 

Please squash this patch to the previous patch.

Wei.
diff mbox series

Patch

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 0616666221..267e4ceef5 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5185,7 +5185,7 @@  int map_pages_to_xen(
             unsigned int flush_flags =
                 FLUSH_TLB | FLUSH_ORDER(2 * PAGETABLE_ORDER);
             l2_pgentry_t *l2t;
-            mfn_t mfn;
+            mfn_t l2t_mfn;
 
             /* Skip this PTE if there is no change. */
             if ( ((l3e_get_pfn(ol3e) & ~(L2_PAGETABLE_ENTRIES *
@@ -5207,14 +5207,14 @@  int map_pages_to_xen(
                 goto end_of_loop;
             }
 
-            mfn = alloc_xen_pagetable_new();
-            if ( mfn_eq(mfn, INVALID_MFN) )
+            l2t_mfn = alloc_xen_pagetable_new();
+            if ( mfn_eq(l2t_mfn, INVALID_MFN) )
             {
                 ASSERT(rc == -ENOMEM);
                 goto out;
             }
 
-            l2t = map_xen_pagetable_new(mfn);
+            l2t = map_xen_pagetable_new(l2t_mfn);
 
             for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
                 l2e_write(l2t + i,
@@ -5230,7 +5230,8 @@  int map_pages_to_xen(
             if ( (l3e_get_flags(*pl3e) & _PAGE_PRESENT) &&
                  (l3e_get_flags(*pl3e) & _PAGE_PSE) )
             {
-                l3e_write_atomic(pl3e, l3e_from_mfn(mfn, __PAGE_HYPERVISOR));
+                l3e_write_atomic(pl3e,
+                                 l3e_from_mfn(l2t_mfn, __PAGE_HYPERVISOR));
                 UNMAP_XEN_PAGETABLE_NEW(l2t);
                 l2t = NULL;
             }
@@ -5240,7 +5241,7 @@  int map_pages_to_xen(
             if ( l2t )
             {
                 UNMAP_XEN_PAGETABLE_NEW(l2t);
-                free_xen_pagetable_new(mfn);
+                free_xen_pagetable_new(l2t_mfn);
             }
         }
 
@@ -5304,7 +5305,7 @@  int map_pages_to_xen(
                 unsigned int flush_flags =
                     FLUSH_TLB | FLUSH_ORDER(PAGETABLE_ORDER);
                 l1_pgentry_t *l1t;
-                mfn_t mfn;
+                mfn_t l1t_mfn;
 
                 /* Skip this PTE if there is no change. */
                 if ( (((l2e_get_pfn(*pl2e) & ~(L1_PAGETABLE_ENTRIES - 1)) +
@@ -5324,14 +5325,14 @@  int map_pages_to_xen(
                     goto check_l3;
                 }
 
-                mfn = alloc_xen_pagetable_new();
-                if ( mfn_eq(mfn, INVALID_MFN) )
+                l1t_mfn = alloc_xen_pagetable_new();
+                if ( mfn_eq(l1t_mfn, INVALID_MFN) )
                 {
                     ASSERT(rc == -ENOMEM);
                     goto out;
                 }
 
-                l1t = map_xen_pagetable_new(mfn);
+                l1t = map_xen_pagetable_new(l1t_mfn);
 
                 for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                     l1e_write(&l1t[i],
@@ -5346,7 +5347,7 @@  int map_pages_to_xen(
                 if ( (l2e_get_flags(*pl2e) & _PAGE_PRESENT) &&
                      (l2e_get_flags(*pl2e) & _PAGE_PSE) )
                 {
-                    l2e_write_atomic(pl2e, l2e_from_mfn(mfn,
+                    l2e_write_atomic(pl2e, l2e_from_mfn(l1t_mfn,
                                                         __PAGE_HYPERVISOR));
                     UNMAP_XEN_PAGETABLE_NEW(l1t);
                     l1t = NULL;
@@ -5357,7 +5358,7 @@  int map_pages_to_xen(
                 if ( l1t )
                 {
                     UNMAP_XEN_PAGETABLE_NEW(l1t);
-                    free_xen_pagetable_new(mfn);
+                    free_xen_pagetable_new(l1t_mfn);
                 }
             }