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 2/5] x86_64/mm: map and unmap page tables in m2p_mapped
Date: Wed, 8 Apr 2020 14:36:52 +0100 [thread overview]
Message-ID: <e8a945defb5a4209d1f10b5f98b16a854a911c5c.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:
- avoid adding goto labels, simply get the PTE and unmap quickly.
- code style fixes.
---
xen/arch/x86/x86_64/mm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index cee836ec37..8e0caa7327 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -129,14 +129,14 @@ static mfn_t alloc_hotadd_mfn(struct mem_hotadd_info *info)
static int m2p_mapped(unsigned long spfn)
{
unsigned long va;
- l3_pgentry_t *l3_ro_mpt;
- l2_pgentry_t *l2_ro_mpt;
+ l3_pgentry_t l3e_ro_mpt;
+ l2_pgentry_t l2e_ro_mpt;
va = RO_MPT_VIRT_START + spfn * sizeof(*machine_to_phys_mapping);
- l3_ro_mpt = l4e_to_l3e(idle_pg_table[l4_table_offset(va)]);
+ l3e_ro_mpt = l3e_from_l4e(idle_pg_table[l4_table_offset(va)],
+ l3_table_offset(va));
- switch ( l3e_get_flags(l3_ro_mpt[l3_table_offset(va)]) &
- (_PAGE_PRESENT |_PAGE_PSE))
+ switch ( l3e_get_flags(l3e_ro_mpt) & (_PAGE_PRESENT | _PAGE_PSE) )
{
case _PAGE_PSE|_PAGE_PRESENT:
return M2P_1G_MAPPED;
@@ -146,9 +146,9 @@ static int m2p_mapped(unsigned long spfn)
default:
return M2P_NO_MAPPED;
}
- l2_ro_mpt = l3e_to_l2e(l3_ro_mpt[l3_table_offset(va)]);
+ l2e_ro_mpt = l2e_from_l3e(l3e_ro_mpt, l2_table_offset(va));
- if (l2e_get_flags(l2_ro_mpt[l2_table_offset(va)]) & _PAGE_PRESENT)
+ if ( l2e_get_flags(l2e_ro_mpt) & _PAGE_PRESENT )
return M2P_2M_MAPPED;
return M2P_NO_MAPPED;
--
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 ` Hongyan Xia [this message]
2020-04-15 7:54 ` [PATCH v2 2/5] x86_64/mm: map and unmap page tables in m2p_mapped 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 ` [PATCH v2 4/5] x86_64/mm: map and unmap page tables in destroy_compat_m2p_mapping Hongyan Xia
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=e8a945defb5a4209d1f10b5f98b16a854a911c5c.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).