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 v2 4/5] x86_64/mm: map and unmap page tables in destroy_compat_m2p_mapping
Date: Wed, 8 Apr 2020 14:36:54 +0100 [thread overview]
Message-ID: <91728ed9a191160e6405267f5ae05cb6d3724f22.1586352238.git.hongyxia@amazon.com> (raw)
In-Reply-To: <cover.1586352238.git.hongyxia@amazon.com>
In-Reply-To: <cover.1586352238.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>
---
Changed in v2:
- there is pretty much no point in keeping l3_ro_mpt mapped, just fetch
the l3e instead, which also cleans up the code.
---
xen/arch/x86/x86_64/mm.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index d23c7e4f5b..ae8f4dd0b9 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -220,7 +220,7 @@ static void destroy_compat_m2p_mapping(struct mem_hotadd_info *info)
unsigned long i, va, rwva, pt_pfn;
unsigned long smap = info->spfn, emap = info->spfn;
- l3_pgentry_t *l3_ro_mpt;
+ l3_pgentry_t l3e_ro_mpt;
l2_pgentry_t *l2_ro_mpt;
if ( smap > ((RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START) >> 2) )
@@ -229,11 +229,13 @@ static void destroy_compat_m2p_mapping(struct mem_hotadd_info *info)
if ( emap > ((RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START) >> 2) )
emap = (RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START) >> 2;
- l3_ro_mpt = l4e_to_l3e(idle_pg_table[l4_table_offset(HIRO_COMPAT_MPT_VIRT_START)]);
+ l3e_ro_mpt = l3e_from_l4e(idle_pg_table[
+ l4_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
+ l3_table_offset(HIRO_COMPAT_MPT_VIRT_START));
- ASSERT(l3e_get_flags(l3_ro_mpt[l3_table_offset(HIRO_COMPAT_MPT_VIRT_START)]) & _PAGE_PRESENT);
+ ASSERT(l3e_get_flags(l3e_ro_mpt) & _PAGE_PRESENT);
- l2_ro_mpt = l3e_to_l2e(l3_ro_mpt[l3_table_offset(HIRO_COMPAT_MPT_VIRT_START)]);
+ l2_ro_mpt = map_l2t_from_l3e(l3e_ro_mpt);
for ( i = smap; i < emap; )
{
@@ -255,6 +257,8 @@ static void destroy_compat_m2p_mapping(struct mem_hotadd_info *info)
i += 1UL << (L2_PAGETABLE_SHIFT - 2);
}
+ UNMAP_DOMAIN_PAGE(l2_ro_mpt);
+
return;
}
--
2.24.1.AMZN
next prev parent reply other threads:[~2020-04-08 13:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-08 13:36 [PATCH v2 0/5] use new API for Xen page tables Hongyan Xia
2020-04-08 13:36 ` [PATCH v2 1/5] x86/shim: map and unmap page tables in replace_va_mapping Hongyan Xia
2020-04-09 9:42 ` Jan Beulich
2020-04-14 16:53 ` Hongyan Xia
2020-04-15 6:13 ` Jan Beulich
2020-04-08 13:36 ` [PATCH v2 2/5] x86_64/mm: map and unmap page tables in m2p_mapped Hongyan Xia
2020-04-15 7:54 ` Jan Beulich
2020-04-08 13:36 ` [PATCH v2 3/5] x86_64/mm: map and unmap page tables in share_hotadd_m2p_table Hongyan Xia
2020-04-15 7:55 ` Jan Beulich
2020-04-08 13:36 ` Hongyan Xia [this message]
2020-04-15 8:21 ` [PATCH 0/2] x86: high compat r/o M2P table handling adjustments Jan Beulich
2020-04-15 8:23 ` [PATCH 1/2] x86: drop unnecessary page table walking in compat r/o M2P handling Jan Beulich
2020-04-15 9:59 ` Hongyan Xia
2020-04-15 10:34 ` Jan Beulich
2020-04-15 10:50 ` Hongyan Xia
2020-04-15 11:16 ` Wei Liu
2020-04-15 8:23 ` [PATCH 2/2] x86: drop high compat r/o M2P table address range Jan Beulich
2020-04-27 19:52 ` Wei Liu
2020-04-28 6:14 ` [PATCH 0/2] x86: high compat r/o M2P table handling adjustments Jan Beulich
2020-04-15 8:25 ` [PATCH v2 4/5] x86_64/mm: map and unmap page tables in destroy_compat_m2p_mapping Jan Beulich
2020-04-08 13:36 ` [PATCH v2 5/5] x86_64/mm: map and unmap page tables in destroy_m2p_mapping Hongyan Xia
2020-04-15 8:32 ` Jan Beulich
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=91728ed9a191160e6405267f5ae05cb6d3724f22.1586352238.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).