From: "Nuernberger, Stefan" <snu@amazon.de>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"wei.liu2@citrix.com" <wei.liu2@citrix.com>
Cc: "andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
"jbeulich@suse.com" <jbeulich@suse.com>,
"roger.pau@citrix.com" <roger.pau@citrix.com>
Subject: Re: [PATCH RFC 17/55] x86/mm: drop lXe_to_lYe invocations in map_pages_to_xen
Date: Mon, 18 Mar 2019 21:14:25 +0000 [thread overview]
Message-ID: <1552943665.6788.99.camel@amazon.de> (raw)
In-Reply-To: <20190207164456.9260-18-wei.liu2@citrix.com>
On Thu, 2019-02-07 at 16:44 +0000, Wei Liu wrote:
> Map and unmap page tables where necessary.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> xen/arch/x86/mm.c | 40 +++++++++++++++++++++++++++++-----------
> 1 file changed, 29 insertions(+), 11 deletions(-)
>
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index c4cb6fbb60..1ea2974c1f 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -5014,8 +5014,10 @@ int map_pages_to_xen(
> else
> {
> l2_pgentry_t *l2t;
> + mfn_t l2t_mfn = l3e_get_mfn(ol3e);
> +
> + l2t = map_xen_pagetable_new(l2t_mfn);
>
> - l2t = l3e_to_l2e(ol3e);
> for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
> {
> ol2e = l2t[i];
> @@ -5027,10 +5029,12 @@ int map_pages_to_xen(
> {
> unsigned int j;
> l1_pgentry_t *l1t;
> + mfn_t l1t_mfn = l2e_get_mfn(ol2e);
>
> - l1t = l2e_to_l1e(ol2e);
> + l1t = map_xen_pagetable_new(l1t_mfn);
> for ( j = 0; j < L1_PAGETABLE_ENTRIES;
> j++ )
> flush_flags(l1e_get_flags(l1t[j]));
> + UNMAP_XEN_PAGETABLE_NEW(l1t);
> }
> }
> flush_area(virt, flush_flags);
> @@ -5039,9 +5043,9 @@ int map_pages_to_xen(
> ol2e = l2t[i];
> if ( (l2e_get_flags(ol2e) & _PAGE_PRESENT)
> &&
> !(l2e_get_flags(ol2e) & _PAGE_PSE) )
> - free_xen_pagetable(l2e_to_l1e(ol2e));
> + free_xen_pagetable_new(l2e_get_mfn(ol2e)
> );
> }
> - free_xen_pagetable(l2t);
> + free_xen_pagetable_new(l2t_mfn);
> }
> }
>
> @@ -5146,12 +5150,14 @@ int map_pages_to_xen(
> else
> {
> l1_pgentry_t *l1t;
> + mfn_t l1t_mfn = l2e_get_mfn(ol2e);
>
> - l1t = l2e_to_l1e(ol2e);
> + l1t = map_xen_pagetable_new(l1t_mfn);
> for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
> flush_flags(l1e_get_flags(l1t[i]));
> flush_area(virt, flush_flags);
> - free_xen_pagetable(l1t);
> + UNMAP_XEN_PAGETABLE_NEW(l1t);
> + free_xen_pagetable_new(l1t_mfn);
> }
> }
>
> @@ -5165,12 +5171,14 @@ int map_pages_to_xen(
> /* Normal page mapping. */
> if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
> {
> + /* XXX This forces page table to be populated */
> pl1e = virt_to_xen_l1e(virt);
> if ( pl1e == NULL )
> {
> ASSERT(rc == -ENOMEM);
> goto out;
> }
> + UNMAP_XEN_PAGETABLE_NEW(pl1e);
This should be part of patch 15/55 "x86/mm: rewrite virt_to_xen_l1e"
where you adapt the callers of virt_to_xen_l1e to free the returned
pointer.
- Stefan
> }
> else if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
> {
> @@ -5234,9 +5242,11 @@ int map_pages_to_xen(
> }
> }
>
> - pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(virt);
> + pl1e = map_xen_pagetable_new(l2e_get_mfn((*pl2e)));
> + pl1e += l1_table_offset(virt);
> ol1e = *pl1e;
> l1e_write_atomic(pl1e, l1e_from_mfn(mfn, flags));
> + UNMAP_XEN_PAGETABLE_NEW(pl1e);
> if ( (l1e_get_flags(ol1e) & _PAGE_PRESENT) )
> {
> unsigned int flush_flags = FLUSH_TLB |
> FLUSH_ORDER(0);
> @@ -5257,6 +5267,7 @@ int map_pages_to_xen(
> {
> unsigned long base_mfn;
> l1_pgentry_t *l1t;
> + mfn_t l1t_mfn;
>
> if ( locking )
> spin_lock(&map_pgdir_lock);
> @@ -5280,12 +5291,15 @@ int map_pages_to_xen(
> goto check_l3;
> }
>
> - l1t = l2e_to_l1e(ol2e);
> + l1t_mfn = l2e_get_mfn(ol2e);
> + l1t = map_xen_pagetable_new(l1t_mfn);
> +
> base_mfn = l1e_get_pfn(l1t[0]) &
> ~(L1_PAGETABLE_ENTRIES - 1);
> for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
> if ( (l1e_get_pfn(l1t[i]) != (base_mfn + i)) ||
> (l1e_get_flags(l1t[i]) != flags) )
> break;
> + UNMAP_XEN_PAGETABLE_NEW(l1t);
> if ( i == L1_PAGETABLE_ENTRIES )
> {
> l2e_write_atomic(pl2e, l2e_from_pfn(base_mfn,
> @@ -5295,7 +5309,7 @@ int map_pages_to_xen(
> flush_area(virt - PAGE_SIZE,
> FLUSH_TLB_GLOBAL |
> FLUSH_ORDER(PAGETABLE_ORDER));
> - free_xen_pagetable(l2e_to_l1e(ol2e));
> + free_xen_pagetable_new(l1t_mfn);
> }
> else if ( locking )
> spin_unlock(&map_pgdir_lock);
> @@ -5311,6 +5325,7 @@ int map_pages_to_xen(
> {
> unsigned long base_mfn;
> l2_pgentry_t *l2t;
> + mfn_t l2t_mfn;
>
> if ( locking )
> spin_lock(&map_pgdir_lock);
> @@ -5328,7 +5343,9 @@ int map_pages_to_xen(
> goto end_of_loop;
> }
>
> - l2t = l3e_to_l2e(ol3e);
> + l2t_mfn = l3e_get_mfn(ol3e);
> + l2t = map_xen_pagetable_new(l2t_mfn);
> +
> base_mfn = l2e_get_pfn(l2t[0]) & ~(L2_PAGETABLE_ENTRIES
> *
> L1_PAGETABLE_ENTRIES -
> 1);
> for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
> @@ -5336,6 +5353,7 @@ int map_pages_to_xen(
> (base_mfn + (i << PAGETABLE_ORDER))) ||
> (l2e_get_flags(l2t[i]) != l1f_to_lNf(flags)) )
> break;
> + UNMAP_XEN_PAGETABLE_NEW(l2t);
> if ( i == L2_PAGETABLE_ENTRIES )
> {
> l3e_write_atomic(pl3e, l3e_from_pfn(base_mfn,
> @@ -5345,7 +5363,7 @@ int map_pages_to_xen(
> flush_area(virt - PAGE_SIZE,
> FLUSH_TLB_GLOBAL |
> FLUSH_ORDER(2*PAGETABLE_ORDER));
> - free_xen_pagetable(l3e_to_l2e(ol3e));
> + free_xen_pagetable_new(l2t_mfn);
> }
> else if ( locking )
> spin_unlock(&map_pgdir_lock);
Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-03-18 21:14 UTC|newest]
Thread overview: 119+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-07 16:44 [PATCH RFC 00/55] x86: use domheap page for xen page tables Wei Liu
2019-02-07 16:44 ` [PATCH RFC 01/55] x86/mm: defer clearing page in virt_to_xen_lXe Wei Liu
2019-03-15 14:38 ` Jan Beulich
2019-04-09 12:21 ` Wei Liu
2019-04-09 12:21 ` [Xen-devel] " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 02/55] x86: move some xen mm function declarations Wei Liu
2019-03-15 14:42 ` Jan Beulich
2019-02-07 16:44 ` [PATCH RFC 03/55] x86: introduce a new set of APIs to manage Xen page tables Wei Liu
2019-02-07 16:44 ` [PATCH RFC 04/55] x86/mm: introduce l{1, 2}t local variables to map_pages_to_xen Wei Liu
2019-03-15 15:36 ` Jan Beulich
2019-04-09 12:22 ` Wei Liu
2019-04-09 12:22 ` [Xen-devel] " Wei Liu
2019-04-09 12:49 ` Jan Beulich
2019-04-09 12:49 ` [Xen-devel] " Jan Beulich
2019-04-09 12:59 ` Wei Liu
2019-04-09 12:59 ` [Xen-devel] " Wei Liu
2019-04-09 13:20 ` Jan Beulich
2019-04-09 13:20 ` [Xen-devel] " Jan Beulich
2019-02-07 16:44 ` [PATCH RFC 05/55] x86/mm: introduce l{1, 2}t local variables to modify_xen_mappings Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-02-07 16:44 ` [PATCH RFC 06/55] x86/mm: map_pages_to_xen should have one exit path Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-04-09 12:22 ` Wei Liu
2019-04-09 12:22 ` [Xen-devel] " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 07/55] x86/mm: add an end_of_loop label in map_pages_to_xen Wei Liu
2019-03-15 15:40 ` Jan Beulich
2019-04-09 12:22 ` Wei Liu
2019-04-09 12:22 ` [Xen-devel] " Wei Liu
2019-04-09 12:50 ` Jan Beulich
2019-04-09 12:50 ` [Xen-devel] " Jan Beulich
2019-03-18 21:14 ` Nuernberger, Stefan
2019-02-07 16:44 ` [PATCH RFC 08/55] x86/mm: make sure there is one exit path for modify_xen_mappings Wei Liu
2019-02-07 16:44 ` [PATCH RFC 09/55] x86/mm: add an end_of_loop label in modify_xen_mappings Wei Liu
2019-02-07 16:44 ` [PATCH RFC 10/55] x86/mm: change pl2e to l2t in virt_to_xen_l2e Wei Liu
2019-02-07 16:44 ` [PATCH RFC 11/55] x86/mm: change pl1e to l1t in virt_to_xen_l1e Wei Liu
2019-02-07 16:44 ` [PATCH RFC 12/55] x86/mm: change pl3e to l3t in virt_to_xen_l3e Wei Liu
2019-02-07 16:44 ` [PATCH RFC 13/55] x86/mm: rewrite virt_to_xen_l3e Wei Liu
2019-04-08 15:55 ` Jan Beulich
2019-04-08 15:55 ` [Xen-devel] " Jan Beulich
2019-04-09 12:27 ` Wei Liu
2019-04-09 12:27 ` [Xen-devel] " Wei Liu
2019-04-09 12:52 ` Jan Beulich
2019-04-09 12:52 ` [Xen-devel] " Jan Beulich
2019-02-07 16:44 ` [PATCH RFC 14/55] x86/mm: rewrite xen_to_virt_l2e Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-04-09 12:27 ` Wei Liu
2019-04-09 12:27 ` [Xen-devel] " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 15/55] x86/mm: rewrite virt_to_xen_l1e Wei Liu
2019-02-07 16:44 ` [PATCH RFC 16/55] x86/mm: switch to new APIs in map_pages_to_xen Wei Liu
2019-02-08 17:58 ` Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-02-07 16:44 ` [PATCH RFC 17/55] x86/mm: drop lXe_to_lYe invocations " Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan [this message]
2019-02-07 16:44 ` [PATCH RFC 18/55] x86/mm: switch to new APIs in modify_xen_mappings Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-04-09 12:22 ` Wei Liu
2019-04-09 12:22 ` [Xen-devel] " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 19/55] x86/mm: drop lXe_to_lYe invocations from modify_xen_mappings Wei Liu
2019-02-07 16:44 ` [PATCH RFC 20/55] x86/mm: switch to new APIs in arch_init_memory Wei Liu
2019-02-07 16:44 ` [PATCH RFC 21/55] x86_64/mm: introduce pl2e in paging_init Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-02-07 16:44 ` [PATCH RFC 22/55] x86_64/mm: switch to new APIs " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 23/55] x86_64/mm: drop l4e_to_l3e invocation from paging_init Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-04-09 12:22 ` Wei Liu
2019-04-09 12:22 ` [Xen-devel] " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 24/55] x86_64/mm.c: remove code that serves no purpose in setup_m2p_table Wei Liu
2019-02-07 16:44 ` [PATCH RFC 25/55] x86_64/mm: introduce pl2e " Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-02-07 16:44 ` [PATCH RFC 26/55] x86_64/mm: switch to new APIs " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 27/55] x86_64/mm: drop lXe_to_lYe invocations from setup_m2p_table Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-04-09 12:30 ` Wei Liu
2019-04-09 12:30 ` [Xen-devel] " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 28/55] efi: use new page table APIs in copy_mapping Wei Liu
2019-02-07 16:44 ` [PATCH RFC 29/55] efi: avoid using global variable " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 30/55] efi: use new page table APIs in efi_init_memory Wei Liu
2019-02-07 16:44 ` [PATCH RFC 31/55] efi: add emacs block to boot.c Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-04-09 12:23 ` Wei Liu
2019-04-09 12:23 ` [Xen-devel] " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 32/55] efi: switch EFI L4 table to use new APIs Wei Liu
2019-03-18 21:14 ` Nuernberger, Stefan
2019-04-09 12:23 ` Wei Liu
2019-04-09 12:23 ` [Xen-devel] " Wei Liu
2019-04-09 12:56 ` Jan Beulich
2019-04-09 12:56 ` [Xen-devel] " Jan Beulich
2019-04-09 13:00 ` Wei Liu
2019-04-09 13:00 ` [Xen-devel] " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 33/55] x86/smpboot: add emacs block Wei Liu
2019-02-07 16:44 ` [PATCH RFC 34/55] x86/smpboot: clone_mapping should have one exit path Wei Liu
2019-02-07 16:44 ` [PATCH RFC 35/55] x86/smpboot: switch pl3e to use new APIs in clone_mapping Wei Liu
2019-02-07 16:44 ` [PATCH RFC 36/55] x86/smpboot: switch pl2e " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 37/55] x86/smpboot: switch pl1e " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 38/55] x86/smpboot: drop lXe_to_lYe invocations from cleanup_cpu_root_pgt Wei Liu
2019-02-07 16:44 ` [PATCH RFC 39/55] x86: switch root_pgt to mfn_t and use new APIs Wei Liu
2019-03-19 16:45 ` Nuernberger, Stefan
2019-04-09 12:23 ` Wei Liu
2019-04-09 12:23 ` [Xen-devel] " Wei Liu
2019-02-07 16:44 ` [PATCH RFC 40/55] x86/shim: map and unmap page tables in replace_va_mapping Wei Liu
2019-02-07 16:44 ` [PATCH RFC 41/55] x86_64/mm: map and unmap page tables in m2p_mapped Wei Liu
2019-03-19 16:45 ` Nuernberger, Stefan
2019-02-07 16:44 ` [PATCH RFC 42/55] x86_64/mm: map and unmap page tables in share_hotadd_m2p_table Wei Liu
2019-03-19 16:45 ` Nuernberger, Stefan
2019-02-07 16:44 ` [PATCH RFC 43/55] x86_64/mm: map and unmap page tables in destroy_compat_m2p_mapping Wei Liu
2019-02-07 16:44 ` [PATCH RFC 44/55] x86_64/mm: map and unmap page tables in destroy_m2p_mapping Wei Liu
2019-02-07 16:44 ` [PATCH RFC 45/55] x86_64/mm: map and unmap page tables in setup_compat_m2p_table Wei Liu
2019-02-07 16:44 ` [PATCH RFC 46/55] x86_64/mm: map and unmap page tables in cleanup_frame_table Wei Liu
2019-02-07 16:44 ` [PATCH RFC 47/55] x86_64/mm: map and unmap page tables in subarch_init_memory Wei Liu
2019-02-07 16:44 ` [PATCH RFC 48/55] x86_64/mm: map and unmap page tables in subarch_memory_op Wei Liu
2019-02-07 16:44 ` [PATCH RFC 49/55] x86/smpboot: remove lXe_to_lYe in cleanup_cpu_root_pgt Wei Liu
2019-02-07 16:44 ` [PATCH RFC 50/55] x86/pv: properly map and unmap page tables in mark_pv_pt_pages_rdonly Wei Liu
2019-02-07 16:44 ` [PATCH RFC 51/55] x86/pv: properly map and unmap page table in dom0_construct_pv Wei Liu
2019-02-07 16:44 ` [PATCH RFC 52/55] x86: remove lXe_to_lYe in __start_xen Wei Liu
2019-02-07 16:44 ` [PATCH RFC 53/55] x86/mm: drop old page table APIs Wei Liu
2019-02-07 16:44 ` [PATCH RFC 54/55] x86: switch to use domheap page for page tables Wei Liu
2019-02-07 16:44 ` [PATCH RFC 55/55] x86/mm: drop _new suffix from page table APIs Wei Liu
2019-03-18 21:14 ` [PATCH RFC 00/55] x86: use domheap page for xen page tables Nuernberger, Stefan
2019-03-28 12:52 ` Nuernberger, Stefan
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=1552943665.6788.99.camel@amazon.de \
--to=snu@amazon.de \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.com \
--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).