xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Hongyan Xia <hx242@xen.org>
To: xen-devel@lists.xenproject.org
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	julien@xen.org, "Wei Liu" <wl@xen.org>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH 5/6] x86/pv: map and unmap page tables in mark_pv_pt_pages_rdonly
Date: Fri, 17 Apr 2020 10:52:07 +0100	[thread overview]
Message-ID: <9287363e13924f4a633b47b53c23b3466e26e4a8.1587116799.git.hongyxia@amazon.com> (raw)
In-Reply-To: <cover.1587116799.git.hongyxia@amazon.com>
In-Reply-To: <cover.1587116799.git.hongyxia@amazon.com>

From: Wei Liu <wei.liu2@citrix.com>

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
---
 xen/arch/x86/pv/dom0_build.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 5678da782d..28a939b68a 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -50,17 +50,17 @@ static __init void mark_pv_pt_pages_rdonly(struct domain *d,
     unsigned long count;
     struct page_info *page;
     l4_pgentry_t *pl4e;
-    l3_pgentry_t *pl3e;
-    l2_pgentry_t *pl2e;
-    l1_pgentry_t *pl1e;
+    l3_pgentry_t *pl3e, *l3t;
+    l2_pgentry_t *pl2e, *l2t;
+    l1_pgentry_t *pl1e, *l1t;
 
     pl4e = l4start + l4_table_offset(vpt_start);
-    pl3e = l4e_to_l3e(*pl4e);
-    pl3e += l3_table_offset(vpt_start);
-    pl2e = l3e_to_l2e(*pl3e);
-    pl2e += l2_table_offset(vpt_start);
-    pl1e = l2e_to_l1e(*pl2e);
-    pl1e += l1_table_offset(vpt_start);
+    l3t = map_l3t_from_l4e(*pl4e);
+    pl3e = l3t + l3_table_offset(vpt_start);
+    l2t = map_l2t_from_l3e(*pl3e);
+    pl2e = l2t + l2_table_offset(vpt_start);
+    l1t = map_l1t_from_l2e(*pl2e);
+    pl1e = l1t + l1_table_offset(vpt_start);
     for ( count = 0; count < nr_pt_pages; count++ )
     {
         l1e_remove_flags(*pl1e, _PAGE_RW);
@@ -85,12 +85,20 @@ static __init void mark_pv_pt_pages_rdonly(struct domain *d,
             if ( !((unsigned long)++pl2e & (PAGE_SIZE - 1)) )
             {
                 if ( !((unsigned long)++pl3e & (PAGE_SIZE - 1)) )
-                    pl3e = l4e_to_l3e(*++pl4e);
-                pl2e = l3e_to_l2e(*pl3e);
+                {
+                    unmap_domain_page(l3t);
+                    pl3e = l3t = map_l3t_from_l4e(*++pl4e);
+                }
+                unmap_domain_page(l2t);
+                pl2e = l2t = map_l2t_from_l3e(*pl3e);
             }
-            pl1e = l2e_to_l1e(*pl2e);
+            unmap_domain_page(l1t);
+            pl1e = l1t = map_l1t_from_l2e(*pl2e);
         }
     }
+    unmap_domain_page(l1t);
+    unmap_domain_page(l2t);
+    unmap_domain_page(l3t);
 }
 
 static __init void setup_pv_physmap(struct domain *d, unsigned long pgtbl_pfn,
-- 
2.24.1.AMZN



  parent reply	other threads:[~2020-04-17  9:52 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17  9:52 [PATCH 0/6] convert more Xen page table code to the new API Hongyan Xia
2020-04-17  9:52 ` [PATCH 1/6] x86_64/mm: map and unmap page tables in cleanup_frame_table Hongyan Xia
2020-04-24  8:58   ` Julien Grall
2020-04-24  8:59     ` Julien Grall
2020-04-24  8:59   ` Julien Grall
2020-04-24  9:21     ` Hongyan Xia
2020-04-24  9:24       ` Julien Grall
2020-04-24  9:02   ` Julien Grall
2020-04-24 11:12     ` Jan Beulich
2020-04-28 15:11     ` Jan Beulich
2020-04-17  9:52 ` [PATCH 2/6] x86_64/mm: map and unmap page tables in subarch_init_memory Hongyan Xia
2020-04-24  9:04   ` Julien Grall
2020-04-28 15:12     ` Jan Beulich
2020-04-17  9:52 ` [PATCH 3/6] x86_64/mm: map and unmap page tables in subarch_memory_op Hongyan Xia
2020-04-24  9:06   ` Julien Grall
2020-04-28 15:23     ` Jan Beulich
2020-04-17  9:52 ` [PATCH 4/6] x86/smpboot: map and unmap page tables in cleanup_cpu_root_pgt Hongyan Xia
2020-04-24  9:13   ` Julien Grall
2020-04-28 15:26     ` Jan Beulich
2020-04-17  9:52 ` Hongyan Xia [this message]
2020-04-24  9:16   ` [PATCH 5/6] x86/pv: map and unmap page tables in mark_pv_pt_pages_rdonly Julien Grall
2020-04-28 15:33   ` Jan Beulich
2020-04-28 15:49     ` Wei Liu
2020-04-28 15:55     ` Hongyan Xia
2020-04-28 15:59       ` Hongyan Xia
2020-04-29  9:26         ` Hongyan Xia
2020-04-29 11:04           ` Jan Beulich
2020-04-29 12:29             ` Hongyan Xia
2020-04-29 13:31               ` Jan Beulich
2020-04-17  9:52 ` [PATCH 6/6] x86/pv: map and unmap page table in dom0_construct_pv Hongyan Xia
2020-04-24  9:18   ` Julien Grall
2020-04-28 15:34     ` Jan Beulich
2020-04-24  8:07 ` [PATCH 0/6] convert more Xen page table code to the new API Hongyan Xia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9287363e13924f4a633b47b53c23b3466e26e4a8.1587116799.git.hongyxia@amazon.com \
    --to=hx242@xen.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).