Re: [Xen-devel] [PATCH v2 22/55] x86_64/mm: switch to new APIs in paging_init

2019-10-01 Thread Hongyan Xia
On 01/10/2019 12:51, Wei Liu wrote: On Mon, Sep 30, 2019 at 11:33:14AM +0100, Hongyan Xia wrote: From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed since v1: * use a global mapping for compat_idle_pg_table_l2, otherwise l2_ro_mpt will unmap it. Hmmm... I

Re: [Xen-devel] [PATCH v2 39/55] x86: switch root_pgt to mfn_t and use new APIs

2019-10-01 Thread Hongyan Xia
On 30/09/2019 11:33, Hongyan Xia wrote: From: Wei Liu This then requires moving declaration of root page table mfn into mm.h and modify setup_cpu_root_pgt to have a single exit path. We also need to force map_domain_page to use direct map when switching per-domain mappings. This is contrary

Re: [Xen-devel] [PATCH v2 39/55] x86: switch root_pgt to mfn_t and use new APIs

2019-10-01 Thread Hongyan Xia
On 01/10/2019 16:20, Wei Liu wrote: On Tue, Oct 01, 2019 at 02:54:19PM +0100, Hongyan Xia wrote: On 30/09/2019 11:33, Hongyan Xia wrote: From: Wei Liu This then requires moving declaration of root page table mfn into mm.h and modify setup_cpu_root_pgt to have a single exit path. We also

[Xen-devel] [PATCH v3 2/9] x86: introduce a new set of APIs to manage Xen page tables

2019-10-02 Thread Hongyan Xia
From: Wei Liu We are going to switch to using domheap page for page tables. A new set of APIs is introduced to allocate, map, unmap and free pages for page tables. The allocation and deallocation work on mfn_t but not page_info, because they are required to work even before frame table is set

[Xen-devel] [PATCH v3 7/9] x86/mm: make sure there is one exit path for modify_xen_mappings

2019-10-02 Thread Hongyan Xia
From: Wei Liu We will soon need to handle dynamically mapping / unmapping page tables in the said function. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/mm.c

[Xen-devel] [PATCH v3 8/9] x86/mm: add an end_of_loop label in modify_xen_mappings

2019-10-02 Thread Hongyan Xia
From: Wei Liu We will soon need to clean up mappings whenever the out most loop is ended. Add a new label and turn relevant continue's into goto's. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff

[Xen-devel] [PATCH v3 5/9] x86/mm: map_pages_to_xen should have one exit path

2019-10-02 Thread Hongyan Xia
From: Wei Liu We will soon rewrite the function to handle dynamically mapping and unmapping of page tables. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 34 +++--- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git

[Xen-devel] [PATCH v3 1/9] x86: move some xen mm function declarations

2019-10-02 Thread Hongyan Xia
From: Wei Liu They were put into page.h but mm.h is more appropriate. The real reason is that I will be adding some new functions which takes mfn_t. It turns out it is a bit difficult to do in page.h. No functional change. Signed-off-by: Wei Liu --- xen/include/asm-x86/mm.h | 5 +

[Xen-devel] [PATCH v3 0/9] Add alternative API for Xen PTEs

2019-10-02 Thread Hongyan Xia
This batch adds an alternative alloc-map-unmap-free Xen PTE API to the normal alloc-free on the xenheap, in preparation of switching to domheap for Xen page tables. Since map and unmap are basically no-ops now, and other changes are cosmetic to ease future patches, this batch does not introduce

[Xen-devel] [PATCH v3 3/9] x86/mm: introduce l{1, 2}t local variables to map_pages_to_xen

2019-10-02 Thread Hongyan Xia
From: Wei Liu The pl2e and pl1e variables are heavily (ab)used in that function. It is fine at the moment because all page tables are always mapped so there is no need to track the life time of each variable. We will soon have the requirement to map and unmap page tables. We need to track the

[Xen-devel] [PATCH v3 6/9] x86/mm: add an end_of_loop label in map_pages_to_xen

2019-10-02 Thread Hongyan Xia
From: Wei Liu We will soon need to clean up mappings whenever the out most loop is ended. Add a new label and turn relevant continue's into goto's. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git

[Xen-devel] [PATCH v3 4/9] x86/mm: introduce l{1, 2}t local variables to modify_xen_mappings

2019-10-02 Thread Hongyan Xia
From: Wei Liu The pl2e and pl1e variables are heavily (ab)used in that function. It is fine at the moment because all page tables are always mapped so there is no need to track the life time of each variable. We will soon have the requirement to map and unmap page tables. We need to track the

[Xen-devel] [PATCH v3 9/9] x86/mm: change pl*e to l*t in virt_to_xen_l*e

2019-10-02 Thread Hongyan Xia
From: Wei Liu We will need to have a variable named pl*e when we rewrite virt_to_xen_l*e. Change pl*e to l*t to reflect better its purpose. This will make reviewing later patch easier. No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- xen/arch/x86/mm.c | 42

[Xen-devel] [PATCH v2 45/55] x86_64/mm: map and unmap page tables in setup_compat_m2p_table

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 1d2ebd642f..e8ed04006f 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c

[Xen-devel] [PATCH v2 10/55] x86/mm: change pl2e to l2t in virt_to_xen_l2e

2019-09-30 Thread Hongyan Xia
From: Wei Liu We will need to have a variable named pl2e when we rewrite virt_to_xen_l2e. Change pl2e to l2t to reflect better its purpose. This will make reviewing later patch easier. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 14 +++--- 1 file changed, 7

[Xen-devel] [PATCH v2 18/55] x86/mm: switch to new APIs in modify_xen_mappings

2019-09-30 Thread Hongyan Xia
From: Wei Liu Page tables allocated in that function should be mapped and unmapped now. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed since v1: * remove redundant lines --- xen/arch/x86/mm.c | 33 ++--- 1 file changed, 22 insertions(+), 11

[Xen-devel] [PATCH v2 01/55] x86/mm: defer clearing page in virt_to_xen_lXe

2019-09-30 Thread Hongyan Xia
From: Wei Liu Defer the call to clear_page to the point when we're sure the page is going to become a page table. This is a minor optimisation. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

[Xen-devel] [PATCH v2 12/55] x86/mm: change pl3e to l3t in virt_to_xen_l3e

2019-09-30 Thread Hongyan Xia
From: Wei Liu We will need to have a variable named pl3e when we rewrite virt_to_xen_l3e. Change pl3e to l3t to reflect better its purpose. This will make reviewing later patch easier. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 14 +++--- 1 file changed, 7

[Xen-devel] [PATCH v2 40/55] x86/shim: map and unmap page tables in replace_va_mapping

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/pv/shim.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c index 324ca27f93..cf638fa965 100644 --- a/xen/arch/x86/pv/shim.c +++

[Xen-devel] [PATCH v2 22/55] x86_64/mm: switch to new APIs in paging_init

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed since v1: * use a global mapping for compat_idle_pg_table_l2, otherwise l2_ro_mpt will unmap it. --- xen/arch/x86/x86_64/mm.c | 50 +--- 1 file changed, 37 insertions(+), 13

[Xen-devel] [PATCH v2 49/55] x86/smpboot: remove lXe_to_lYe in cleanup_cpu_root_pgt

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/smpboot.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index ca8fc6d485..9fe0ef18a1 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@

[Xen-devel] [PATCH v2 20/55] x86/mm: switch to new APIs in arch_init_memory

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 6fb8c92543..8706dc0174 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -353,19 +353,22 @@ void

[Xen-devel] [PATCH v2 23/55] x86_64/mm: drop l4e_to_l3e invocation from paging_init

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index c8c71564ba..c1daa04cf5 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@

[Xen-devel] [PATCH v2 34/55] x86/smpboot: clone_mapping should have one exit path

2019-09-30 Thread Hongyan Xia
From: Wei Liu We will soon need to clean up page table mappings in the exit path. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/smpboot.c | 35 --- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/smpboot.c

[Xen-devel] [PATCH v2 25/55] x86_64/mm: introduce pl2e in setup_m2p_table

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 103932720b..f31bd4ffde 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c

[Xen-devel] [PATCH v2 21/55] x86_64/mm: introduce pl2e in paging_init

2019-09-30 Thread Hongyan Xia
From: Wei Liu Introduce pl2e so that we can use l2_ro_mpt to point to the page table itself. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c

[Xen-devel] [PATCH v2 32/55] efi: switch EFI L4 table to use new APIs

2019-09-30 Thread Hongyan Xia
From: Wei Liu This requires storing the MFN instead of linear address of the L4 table. Adjust code accordingly. Signed-off-by: Wei Liu --- xen/arch/x86/efi/runtime.h | 12 +--- xen/common/efi/boot.c | 8 ++-- xen/common/efi/efi.h | 3 ++- xen/common/efi/runtime.c |

[Xen-devel] [PATCH v2 13/55] x86/mm: rewrite virt_to_xen_l3e

2019-09-30 Thread Hongyan Xia
From: Wei Liu Rewrite that function to use the new APIs. Modify its callers to unmap the pointer returned. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 61 +-- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/mm.c

[Xen-devel] [PATCH v2 06/55] x86/mm: map_pages_to_xen should have one exit path

2019-09-30 Thread Hongyan Xia
From: Wei Liu We will soon rewrite the function to handle dynamically mapping and unmapping of page tables. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 34 +++--- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git

[Xen-devel] [PATCH v2 05/55] x86/mm: introduce l{1, 2}t local variables to modify_xen_mappings

2019-09-30 Thread Hongyan Xia
From: Wei Liu The pl2e and pl1e variables are heavily (ab)used in that function. It is fine at the moment because all page tables are always mapped so there is no need to track the life time of each variable. We will soon have the requirement to map and unmap page tables. We need to track the

[Xen-devel] [PATCH v2 07/55] x86/mm: add an end_of_loop label in map_pages_to_xen

2019-09-30 Thread Hongyan Xia
From: Wei Liu We will soon need to clean up mappings whenever the out most loop is ended. Add a new label and turn relevant continue's into goto's. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git

[Xen-devel] [PATCH v2 30/55] efi: use new page table APIs in efi_init_memory

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/common/efi/boot.c | 39 +++ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 64a287690a..1d1420f02c 100644 --- a/xen/common/efi/boot.c +++

[Xen-devel] [PATCH v2 26/55] x86_64/mm: switch to new APIs in setup_m2p_table

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index f31bd4ffde..d452ed3966 100644 --- a/xen/arch/x86/x86_64/mm.c +++

[Xen-devel] [PATCH v2 29/55] efi: avoid using global variable in copy_mapping

2019-09-30 Thread Hongyan Xia
From: Wei Liu We will soon switch efi_l4_table to use ephemeral mapping. Make copy_mapping take a pointer to the mapping instead of using the global variable. No functional change intended. Signed-off-by: Wei Liu --- xen/common/efi/boot.c | 11 ++- 1 file changed, 6 insertions(+), 5

[Xen-devel] [PATCH v2 31/55] efi: add emacs block to boot.c

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/common/efi/boot.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 1d1420f02c..3868293d06 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -1705,3 +1705,13 @@ void

[Xen-devel] [PATCH v2 33/55] x86/smpboot: add emacs block

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/smpboot.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 5b3be25f8a..55b99644af 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -1378,3 +1378,13 @@

[Xen-devel] [PATCH v2 08/55] x86/mm: make sure there is one exit path for modify_xen_mappings

2019-09-30 Thread Hongyan Xia
From: Wei Liu We will soon need to handle dynamically mapping / unmapping page tables in the said function. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/mm.c

[Xen-devel] [PATCH v2 11/55] x86/mm: change pl1e to l1t in virt_to_xen_l1e

2019-09-30 Thread Hongyan Xia
From: Wei Liu We will need to have a variable named pl1e when we rewrite virt_to_xen_l1e. Change pl1e to l1t to reflect better its purpose. This will make reviewing later patch easier. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 14 +++--- 1 file changed, 7

[Xen-devel] [PATCH v2 38/55] x86/smpboot: drop lXe_to_lYe invocations from cleanup_cpu_root_pgt

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/smpboot.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 956e1bdbcc..c55aaa65a2 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@

[Xen-devel] [PATCH v2 00/55] Switch to domheap for Xen PTEs

2019-09-30 Thread Hongyan Xia
This series is mostly Wei's effort to switch from xenheap to domheap for Xen page tables. In addition, I have also merged several bug fixes from my "Remove direct map from Xen" series [1]. As the title suggests, this series switches from xenheap to domheap for Xen PTEs. This is needed to achieve

[Xen-devel] [PATCH v2 27/55] x86_64/mm: drop lXe_to_lYe invocations from setup_m2p_table

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index d452ed3966..c41715cd56 100644 --- a/xen/arch/x86/x86_64/mm.c +++

[Xen-devel] [PATCH v2 16/55] x86/mm: switch to new APIs in map_pages_to_xen

2019-09-30 Thread Hongyan Xia
From: Wei Liu Page tables allocated in that function should be mapped and unmapped now. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed since v1: * remove redundant lines --- xen/arch/x86/mm.c | 34 +++--- 1 file changed, 23 insertions(+), 11

[Xen-devel] [PATCH v2 47/55] x86_64/mm: map and unmap page tables in subarch_init_memory

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 8d13c994af..7a02fcee18 100644 --- a/xen/arch/x86/x86_64/mm.c +++

[Xen-devel] [PATCH v2 15/55] x86/mm: rewrite virt_to_xen_l1e

2019-09-30 Thread Hongyan Xia
From: Wei Liu Rewrite this function to use new APIs. Modify its callers to unmap the pointer returned. Signed-off-by: Wei Liu --- xen/arch/x86/domain_page.c | 10 ++ xen/arch/x86/mm.c | 30 +- 2 files changed, 31 insertions(+), 9 deletions(-) diff

[Xen-devel] [PATCH v2 54/55] x86: switch to use domheap page for page tables

2019-09-30 Thread Hongyan Xia
From: Wei Liu Modify all the _new APIs to handle domheap pages. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index c9be239d53..a2d2d01660 100644 --- a/xen/arch/x86/mm.c +++

[Xen-devel] [PATCH v2 03/55] x86: introduce a new set of APIs to manage Xen page tables

2019-09-30 Thread Hongyan Xia
From: Wei Liu We are going to switch to using domheap page for page tables. A new set of APIs is introduced to allocate, map, unmap and free pages for page tables. The allocation and deallocation work on mfn_t but not page_info, because they are required to work even before frame table is set

[Xen-devel] [PATCH v2 28/55] efi: use new page table APIs in copy_mapping

2019-09-30 Thread Hongyan Xia
From: Wei Liu After inspection ARM doesn't have alloc_xen_pagetable so this function is x86 only, which means it is safe for us to change. Signed-off-by: Wei Liu --- XXX test this in gitlab ci to be sure. --- xen/common/efi/boot.c | 16 +++- 1 file changed, 11 insertions(+), 5

[Xen-devel] [PATCH v2 44/55] x86_64/mm: map and unmap page tables in destroy_m2p_mapping

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 2fff5f9306..1d2ebd642f 100644 --- a/xen/arch/x86/x86_64/mm.c +++

[Xen-devel] [PATCH v2 14/55] x86/mm: rewrite xen_to_virt_l2e

2019-09-30 Thread Hongyan Xia
From: Wei Liu Rewrite that function to use the new APIs. Modify its callers to unmap the pointer returned. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 46 +- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/mm.c

[Xen-devel] [PATCH v2 43/55] x86_64/mm: map and unmap page tables in destroy_compat_m2p_mapping

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index e0d2190be1..2fff5f9306 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c

[Xen-devel] [PATCH v2 37/55] x86/smpboot: switch pl1e to use new APIs in clone_mapping

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/smpboot.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index d327c062b1..956e1bdbcc 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c

[Xen-devel] [PATCH v2 35/55] x86/smpboot: switch pl3e to use new APIs in clone_mapping

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/smpboot.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 716dc1512d..db39f5cbb2 100644 --- a/xen/arch/x86/smpboot.c +++

[Xen-devel] [PATCH v2 46/55] x86_64/mm: map and unmap page tables in cleanup_frame_table

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index e8ed04006f..8d13c994af 100644 --- a/xen/arch/x86/x86_64/mm.c +++

[Xen-devel] [PATCH v2 48/55] x86_64/mm: map and unmap page tables in subarch_memory_op

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 7a02fcee18..a1c69d7f0e 100644 --- a/xen/arch/x86/x86_64/mm.c +++

[Xen-devel] [PATCH v2 04/55] x86/mm: introduce l{1, 2}t local variables to map_pages_to_xen

2019-09-30 Thread Hongyan Xia
From: Wei Liu The pl2e and pl1e variables are heavily (ab)used in that function. It is fine at the moment because all page tables are always mapped so there is no need to track the life time of each variable. We will soon have the requirement to map and unmap page tables. We need to track the

[Xen-devel] [PATCH v2 19/55] x86/mm: drop lXe_to_lYe invocations from modify_xen_mappings

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 28 +++- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index a812ef0244..6fb8c92543 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5532,8

[Xen-devel] [PATCH v2 51/55] x86/pv: properly map and unmap page table in dom0_construct_pv

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/pv/dom0_build.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index d7d42568fb..39cb68f7da 100644 --- a/xen/arch/x86/pv/dom0_build.c +++

[Xen-devel] [PATCH v2 55/55] x86/mm: drop _new suffix for page table APIs

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed since v1: - Fix rebase conflicts against new master and other changes since v1. --- xen/arch/x86/domain.c| 4 +- xen/arch/x86/domain_page.c | 2 +- xen/arch/x86/efi/runtime.h | 4 +- xen/arch/x86

[Xen-devel] [PATCH v2 24/55] x86_64/mm.c: remove code that serves no purpose in setup_m2p_table

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index c1daa04cf5..103932720b 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -480,8 +480,6 @@

[Xen-devel] [PATCH v2 53/55] x86/mm: drop old page table APIs

2019-09-30 Thread Hongyan Xia
From: Wei Liu Now that we've switched all users to the new APIs, the old ones aren't needed anymore. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 16 xen/include/asm-x86/mm.h | 2 -- xen/include/asm-x86/page.h | 5 - 3 files changed, 23 deletions(-) diff

[Xen-devel] [PATCH v2 36/55] x86/smpboot: switch pl2e to use new APIs in clone_mapping

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/smpboot.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index db39f5cbb2..d327c062b1 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c

[Xen-devel] [PATCH v2 09/55] x86/mm: add an end_of_loop label in modify_xen_mappings

2019-09-30 Thread Hongyan Xia
From: Wei Liu We will soon need to clean up mappings whenever the out most loop is ended. Add a new label and turn relevant continue's into goto's. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff

[Xen-devel] [PATCH v2 39/55] x86: switch root_pgt to mfn_t and use new APIs

2019-09-30 Thread Hongyan Xia
From: Wei Liu This then requires moving declaration of root page table mfn into mm.h and modify setup_cpu_root_pgt to have a single exit path. We also need to force map_domain_page to use direct map when switching per-domain mappings. This is contrary to our end goal of removing direct map, but

[Xen-devel] [PATCH v2 42/55] x86_64/mm: map and unmap page tables in share_hotadd_m2p_table

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 5c5b91b785..e0d2190be1 100644 --- a/xen/arch/x86/x86_64/mm.c +++

[Xen-devel] [PATCH v2 17/55] x86/mm: drop lXe_to_lYe invocations in map_pages_to_xen

2019-09-30 Thread Hongyan Xia
From: Wei Liu Map and unmap page tables where necessary. Signed-off-by: Wei Liu --- 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 5bb86935f4..08af71a261 100644 ---

[Xen-devel] [PATCH v2 41/55] x86_64/mm: map and unmap page tables in m2p_mapped

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/x86_64/mm.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index c41715cd56..5c5b91b785 100644 --- a/xen/arch/x86/x86_64/mm.c +++

[Xen-devel] [PATCH v2 52/55] x86: remove lXe_to_lYe in __start_xen

2019-09-30 Thread Hongyan Xia
From: Wei Liu Properly map and unmap page tables where necessary. Signed-off-by: Wei Liu --- xen/arch/x86/setup.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index dec60d0301..d27bcf1724 100644 ---

[Xen-devel] [PATCH v2 02/55] x86: move some xen mm function declarations

2019-09-30 Thread Hongyan Xia
From: Wei Liu They were put into page.h but mm.h is more appropriate. The real reason is that I will be adding some new functions which takes mfn_t. It turns out it is a bit difficult to do in page.h. No functional change. Signed-off-by: Wei Liu --- xen/include/asm-x86/mm.h | 5 +

[Xen-devel] [PATCH v2 50/55] x86/pv: properly map and unmap page tables in mark_pv_pt_pages_rdonly

2019-09-30 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu --- xen/arch/x86/pv/dom0_build.c | 35 +++ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index 1bd53e9c08..d7d42568fb 100644 ---

[Xen-devel] [PATCH v4 3/9] x86/mm: introduce l{1, 2}t local variables to map_pages_to_xen

2019-12-04 Thread Hongyan Xia
From: Wei Liu The pl2e and pl1e variables are heavily (ab)used in that function. It is fine at the moment because all page tables are always mapped so there is no need to track the life time of each variable. We will soon have the requirement to map and unmap page tables. We need to track the

[Xen-devel] [PATCH v4 9/9] x86/mm: change pl*e to l*t in virt_to_xen_l*e

2019-12-04 Thread Hongyan Xia
From: Wei Liu We will need to have a variable named pl*e when we rewrite virt_to_xen_l*e. Change pl*e to l*t to reflect better its purpose. This will make reviewing later patch easier. No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- xen

[Xen-devel] [PATCH v4 0/9] Add alternative API for Xen PTEs

2019-12-04 Thread Hongyan Xia
NOTE: My email address has changed due to some HR management. I have lost all my previous emails and I could only salvage some of the comments to v3 from the mailing list archive. I will reply to the comments from v3 in this v4 series. This batch adds an alternative alloc-map-unmap-free Xen PTE

[Xen-devel] [PATCH v4 7/9] x86/mm: make sure there is one exit path for modify_xen_mappings

2019-12-04 Thread Hongyan Xia
From: Wei Liu We will soon need to handle dynamically mapping / unmapping page tables in the said function. No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed since v3: - remove asserts on rc since it never gets changed to anything else. --- xen/arch/x86

[Xen-devel] [PATCH v4 8/9] x86/mm: add an end_of_loop label in modify_xen_mappings

2019-12-04 Thread Hongyan Xia
From: Wei Liu We will soon need to clean up mappings whenever the out most loop is ended. Add a new label and turn relevant continue's into goto's. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff

[Xen-devel] [PATCH v4 1/9] x86: move some xen mm function declarations

2019-12-04 Thread Hongyan Xia
From: Wei Liu They were put into page.h but mm.h is more appropriate. The real reason is that I will be adding some new functions which takes mfn_t. It turns out it is a bit difficult to do in page.h. No functional change. Signed-off-by: Wei Liu Acked-by: Jan Beulich --- Changed since v3:

[Xen-devel] [PATCH v4 6/9] x86/mm: add an end_of_loop label in map_pages_to_xen

2019-12-04 Thread Hongyan Xia
From: Wei Liu We will soon need to clean up mappings whenever the out most loop is ended. Add a new label and turn relevant continue's into goto's. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git

[Xen-devel] [PATCH v4 4/9] x86/mm: introduce l{1, 2}t local variables to modify_xen_mappings

2019-12-04 Thread Hongyan Xia
From: Wei Liu The pl2e and pl1e variables are heavily (ab)used in that function. It is fine at the moment because all page tables are always mapped so there is no need to track the life time of each variable. We will soon have the requirement to map and unmap page tables. We need to track the

[Xen-devel] [PATCH v4 5/9] x86/mm: map_pages_to_xen would better have one exit path

2019-12-04 Thread Hongyan Xia
From: Wei Liu We will soon rewrite the function to handle dynamically mapping and unmapping of page tables. No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed since v3: - remove asserts on rc since rc never gets changed to anything else - reword commit

[Xen-devel] [PATCH v4 2/9] x86: introduce a new set of APIs to manage Xen page tables

2019-12-04 Thread Hongyan Xia
to use domheap and dynamic mappings when usage of old APIs is eliminated. No functional change intended in this patch. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed since v3: - const qualify unmap_xen_pagetable_new(). - remove redundant parentheses. --- xen/arch/x86/mm.c

[Xen-devel] [PATCH v2 1/2] x86/mm: factor out the code for shattering an l3 PTE

2019-12-09 Thread Hongyan Xia
map_pages_to_xen and modify_xen_mappings are performing almost exactly the same operations when shattering an l3 PTE, the only difference being whether we want to flush. Signed-off-by: Hongyan Xia --- Changes in v2: - improve asm. - re-read pl3e from memory when taking the lock. - move

[Xen-devel] [PATCH v2 0/2] Refactor super page shattering

2019-12-09 Thread Hongyan Xia
it per-level for now. tree: https://xenbits.xen.org/git-http/people/hx242/xen.git int_review --- Changes in v2: - rebase. - improve asm code. - avoid stale values when taking the lock. - move allocation of PTE tables inside the shatter function. Hongyan Xia (2): x86/mm: factor out the code

[Xen-devel] [PATCH v2 2/2] x86/mm: factor out the code for shattering an l2 PTE

2019-12-09 Thread Hongyan Xia
map_pages_to_xen and modify_xen_mappings are performing almost exactly the same operations when shattering an l2 PTE, the only difference being whether we want to flush. Signed-off-by: Hongyan Xia --- Changes in v2: - improve asm. - re-read pl2e from memory when taking the lock. - move

[Xen-devel] [PATCH] xen/page_alloc: statically allocate bootmem_region_list

2019-12-17 Thread Hongyan Xia
The existing code assumes that the first mfn passed to the boot allocator is mapped, which creates problems when, e.g., we do not have a direct map, and may create other bootstrapping problems in the future. Make it static. The size is kept the same as before (1 page). Signed-off-by: Hongyan Xia

[Xen-devel] [PATCH v3 2/2] x86/mm: factor out the code for shattering an l2 PTE

2019-12-11 Thread Hongyan Xia
map_pages_to_xen and modify_xen_mappings are performing almost exactly the same operations when shattering an l2 PTE, the only difference being whether we want to flush. Signed-off-by: Hongyan Xia --- Changes in v3: - style and indentation changes. - return -ENOMEM instead of -1. Changes in v2

[Xen-devel] [PATCH v3 0/2] Refactor super page shattering

2019-12-11 Thread Hongyan Xia
. Hongyan Xia (2): x86/mm: factor out the code for shattering an l3 PTE x86/mm: factor out the code for shattering an l2 PTE xen/arch/x86/mm.c | 194 +++--- 1 file changed, 98 insertions(+), 96 deletions(-) -- 2.17.1

[Xen-devel] [PATCH v3 1/2] x86/mm: factor out the code for shattering an l3 PTE

2019-12-11 Thread Hongyan Xia
map_pages_to_xen and modify_xen_mappings are performing almost exactly the same operations when shattering an l3 PTE, the only difference being whether we want to flush. Signed-off-by: Hongyan Xia --- Changes in v3: - style and indentation changes. - return -ENOMEM instead of -1. Changes in v2

[Xen-devel] [PATCH v4 2/2] x86/mm: factor out the code for shattering an l2 PTE

2019-12-12 Thread Hongyan Xia
map_pages_to_xen and modify_xen_mappings are performing almost exactly the same operations when shattering an l2 PTE, the only difference being whether we want to flush. Signed-off-by: Hongyan Xia --- Changes in v4: - use false/true instead of -1/0 to indicate failure/success. - remove

[Xen-devel] [PATCH v4 0/2] Refactor super page shattering

2019-12-12 Thread Hongyan Xia
stale values when taking the lock. - move allocation of PTE tables inside the shatter function. Hongyan Xia (2): x86/mm: factor out the code for shattering an l3 PTE x86/mm: factor out the code for shattering an l2 PTE xen/arch/x86/mm.c | 194 +++--- 1 file

[Xen-devel] [PATCH v4 1/2] x86/mm: factor out the code for shattering an l3 PTE

2019-12-12 Thread Hongyan Xia
map_pages_to_xen and modify_xen_mappings are performing almost exactly the same operations when shattering an l3 PTE, the only difference being whether we want to flush. Signed-off-by: Hongyan Xia --- Changes in v4: - use false/true instead of -1/0 to indicate failure/success. - remove

[Xen-devel] [PATCH 2/2] x86/mm: factor out the code for shattering an l2 PTE

2019-12-06 Thread Hongyan Xia
map_pages_to_xen and modify_xen_mappings are performing almost exactly the same operations when shattering an l2 PTE, the only difference being whether we want to flush. Signed-off-by: Hongyan Xia --- xen/arch/x86/mm.c | 81 ++- 1 file changed, 38

[Xen-devel] [PATCH 0/2] Refactor super page shattering

2019-12-06 Thread Hongyan Xia
it per-level for now. Hongyan Xia (2): x86/mm: factor out the code for shattering an l3 PTE x86/mm: factor out the code for shattering an l2 PTE xen/arch/x86/mm.c | 166 ++ 1 file changed, 78 insertions(+), 88 deletions(-) -- 2.17.1

[Xen-devel] [PATCH 1/2] x86/mm: factor out the code for shattering an l3 PTE

2019-12-06 Thread Hongyan Xia
map_pages_to_xen and modify_xen_mappings are performing almost exactly the same operations when shattering an l3 PTE, the only difference being whether we want to flush. Signed-off-by: Hongyan Xia --- xen/arch/x86/mm.c | 85 ++- 1 file changed, 40

[Xen-devel] [PATCH v2] x86/mm: switch to new APIs in arch_init_memory

2020-02-27 Thread Hongyan Xia
the UNMAP_DOMAIN_PAGE macro to nullify the variable after unmapping, and ignore NULL. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed in v2: - let UNMAP_DOMAIN_PAGE itself check whether the input is NULL to avoid adding the check in unmap_domain_page. - reword the commit message

[Xen-devel] [PATCH v2] x86/domain_page: implement pure per-vCPU mapping infrastructure

2020-02-06 Thread Hongyan Xia
ots. Signed-off-by: Hongyan Xia --- Changed in v2: - reword the commit message. - code clean-up and style fixes - avoid initialising the mapcache in NDEBUG build - move freeing of the maphash into pv_vcpu_destroy because for now only pv has a mapcache. - use is_idle and is_hvm in map_domain_p

[Xen-devel] [PATCH] x86/domain_page: implement pure per-vCPU mapping infrastructure

2020-02-03 Thread Hongyan Xia
available, which is not enough for nested page table walks. We need to increase the number of slots in config.h. Signed-off-by: Hongyan Xia --- xen/arch/x86/domain.c| 5 +- xen/arch/x86/domain_page.c | 229 +++ xen/include/asm-x86/config.h | 2 +- xen

[Xen-devel] [PATCH v6] x86: introduce a new set of APIs to manage Xen page tables

2020-01-28 Thread Hongyan Xia
Signed-off-by: Hongyan Xia Reviewed-by: Julien Grall --- Changed since v5: - sounds like we are happy to use map_domain_page for Xen PTEs. Remove map/unmap_xen_pagetable, just use map/unmap_domain_page instead. - remove redundant logic in free_xen_pagetable. Changed since v4: - properly handle

[Xen-devel] [PATCH] x86/mm: switch to new APIs in arch_init_memory

2020-02-21 Thread Hongyan Xia
after unmapping, and ignore NULL in unmap_domain_page. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- xen/arch/x86/domain_page.c| 2 +- xen/arch/x86/mm.c | 14 -- xen/include/xen/domain_page.h | 5 + 3 files changed, 14 insertions(+), 7 deletions(-) diff

[Xen-devel] [PATCH v5 7/7] x86/mm: change pl*e to l*t in virt_to_xen_l*e

2020-01-07 Thread Hongyan Xia
From: Wei Liu We will need to have a variable named pl*e when we rewrite virt_to_xen_l*e. Change pl*e to l*t to reflect better its purpose. This will make reviewing later patch easier. No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- xen

[Xen-devel] [PATCH v5 2/7] x86: introduce a new set of APIs to manage Xen page tables

2020-01-07 Thread Hongyan Xia
to use domheap and dynamic mappings when usage of old APIs is eliminated. No functional change intended in this patch. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Julien Grall --- Changed since v4: - properly handle INVALID_MFN. - remove the _new suffix for map

[Xen-devel] [PATCH v5 1/7] x86: move some xen mm function declarations

2020-01-07 Thread Hongyan Xia
From: Wei Liu They were put into page.h but mm.h is more appropriate. The real reason is that I will be adding some new functions which takes mfn_t. It turns out it is a bit difficult to do in page.h. No functional change. Signed-off-by: Wei Liu Acked-by: Jan Beulich --- Changed since v3:

  1   2   3   >