Re: [PATCH RFC 1/2] docs/design: Add a design document for Live Update

2021-05-07 Thread Hongyan Xia
On Thu, 2021-05-06 at 11:42 +0100, Julien Grall wrote: > From: Julien Grall > > Administrators often require updating the Xen hypervisor to address > security vulnerabilities, introduce new features, or fix software > defects. > Currently, we offer the following methods to perform the update: >

Re: [PATCH RFC 2/2] xen/kexec: Reserve KEXEC_TYPE_LIVEUPDATE and KEXEC_RANGE_MA_LIVEUPDATE

2021-05-07 Thread Hongyan Xia
r a different purpose. > > This patch reserves two IDs: > * KEXEC_TYPE_LIVEUPDATE: New operation to request Live Update > * KEXEC_MA_RANGE_LIVEUPDATE: New range to query the Live Update > area below Xen > > Signed-off-by: Julien Grall Reviewed-by: Hongyan Xia

Re: [PATCH 13/16] xen/page_alloc: add a path for xenheap when there is no direct map

2021-04-28 Thread Hongyan Xia
On Wed, 2021-04-28 at 13:51 +0200, Jan Beulich wrote: > On 28.04.2021 13:04, Hongyan Xia wrote: > > On Thu, 2021-04-22 at 14:31 +0200, Jan Beulich wrote: > > > As I don't think we have many cases where code actually depends > > > on > > > being able to apply _

Re: [PATCH 13/16] xen/page_alloc: add a path for xenheap when there is no direct map

2021-04-28 Thread Hongyan Xia
On Thu, 2021-04-22 at 14:31 +0200, Jan Beulich wrote: > On 30.04.2020 22:44, Hongyan Xia wrote: > > From: Hongyan Xia > > > > When there is not an always-mapped direct map, xenheap allocations > > need > > to be mapped and unmapped on-demand. > > > >

Re: [PATCH 00/16] Remove the direct map

2021-04-28 Thread Hongyan Xia
On Tue, 2020-06-02 at 09:08 +, Wei Liu wrote: > On Fri, May 01, 2020 at 02:53:08PM +0100, Hongyan Xia wrote: [...] > Not sure about hiding EPT. I will leave this question to Jan and > Andrew... Quick update on performance numbers. I have seen noticeable performance drop if we ne

[PATCH] x86/mm: fix wrong unmap call

2021-04-22 Thread Hongyan Xia
From: Hongyan Xia Commit 'x86/mm: switch to new APIs in modify_xen_mappings' applied the hunk of the unmap call to map_pages_to_xen() which was wrong and clearly should have been at the end of modify_xen_mappings(). Fix. Fixes: dd68f2e49bea ("x86/mm: switch to new APIs in modify_xen_map

Re: [PATCH v10 00/13] switch to domheap for Xen page tables

2021-04-22 Thread Hongyan Xia
); +unmap_domain_page(pl2e); return rc; } Hongyan On Thu, 2021-04-22 at 17:21 +0100, Andrew Cooper wrote: > On 21/04/2021 15:15, Hongyan Xia wrote: > > From: Hongyan Xia > > > > This series rewrites all the remaining functions and finally makes > > the > &g

Re: [PATCH v10 03/13] x86/mm: switch to new APIs in modify_xen_mappings

2021-04-22 Thread Hongyan Xia
On Wed, 2021-04-21 at 15:15 +0100, Hongyan Xia wrote: > From: Wei Liu > > Page tables allocated in that function should be mapped and unmapped > now. > > Note that pl2e now maybe mapped and unmapped in different iterations, > so > we need to add clean-ups for that. >

[PATCH v10 11/13] x86/mm: drop old page table APIs

2021-04-21 Thread Hongyan Xia
From: Hongyan Xia Two sets of old APIs, alloc/free_xen_pagetable() and lXe_to_lYe(), are now dropped to avoid the dependency on direct map. There are two special cases which still have not been re-written into the new APIs, thus need special treatment: rpt in smpboot.c cannot use ephemeral

[PATCH v10 13/13] x86/mm: drop _new suffix for page table APIs

2021-04-21 Thread Hongyan Xia
From: Wei Liu No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Acked-by: Jan Beulich --- xen/arch/x86/mm.c| 44 xen/arch/x86/smpboot.c | 6 +++--- xen/arch/x86/x86_64/mm.c | 2 +- xen/include/asm-x86/mm.h | 4

[PATCH v10 10/13] x86/smpboot: switch clone_mapping() to new APIs

2021-04-21 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v10: - switch to unmap_domain_page() for pl3e in the middle because it is guaranteed to be overwritten later. Changed in v7: - change patch title - remove initialiser of pl3e. - combine

[PATCH v10 12/13] x86: switch to use domheap page for page tables

2021-04-21 Thread Hongyan Xia
From: Hongyan Xia Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v8: - const qualify pg in alloc_xen_pagetable_new(). --- xen/arch/x86/mm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86

[PATCH v10 09/13] x86/smpboot: add exit path for clone_mapping()

2021-04-21 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 Signed-off-by: Hongyan Xia Acked-by: Jan Beulich --- Changed in v7: - edit commit message. - begin with rc = 0 and set it to -ENOMEM ahead of if(). --- xen/arch

[PATCH v10 07/13] efi: use new page table APIs in copy_mapping

2021-04-21 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v8: - remove redundant commit message. - unmap l3src based on va instead of mfn. - re-structure if condition around l3dst. Changed in v7: - hoist l3 variables out of the loop to avoid

[PATCH v10 08/13] efi: switch to new APIs in EFI code

2021-04-21 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v7: - add blank line after declaration. - rename efi_l4_pgtable into efi_l4t. - pass the mapped efi_l4t to copy_mapping() instead of map it again. - use the alloc_map_clear_xen_pt() API

[PATCH v10 05/13] x86_64/mm: switch to new APIs in paging_init

2021-04-21 Thread Hongyan Xia
From: Wei Liu Map and unmap pages instead of relying on the direct map. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v9: - remove an unnecessary l3mfn variable. Changed in v8: - replace l3/2_ro_mpt_mfn with just mfn since their lifetimes do

[PATCH v10 06/13] x86_64/mm: switch to new APIs in setup_m2p_table

2021-04-21 Thread Hongyan Xia
From: Wei Liu While doing so, avoid repetitive mapping of l2_ro_mpt by keeping it across loops, and only unmap and map it when crossing 1G boundaries. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v8: - re-structure if condition around l2_ro_mpt

[PATCH v10 04/13] x86_64/mm: introduce pl2e in paging_init

2021-04-21 Thread Hongyan Xia
From: Wei Liu We will soon map and unmap pages in paging_init(). 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 Acked-by: Jan Beulich --- Changed in v7: - reword commit message. --- xen/arch/x86/x86_64/mm.c | 16

[PATCH v10 03/13] x86/mm: switch to new APIs in modify_xen_mappings

2021-04-21 Thread Hongyan Xia
From: Wei Liu Page tables allocated in that function should be mapped and unmapped now. Note that pl2e now maybe mapped and unmapped in different iterations, so we need to add clean-ups for that. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v7

[PATCH v10 02/13] x86/mm: switch to new APIs in map_pages_to_xen

2021-04-21 Thread Hongyan Xia
From: Wei Liu Page tables allocated in that function should be mapped and unmapped now. Take the opportunity to avoid a potential double map in map_pages_to_xen() by initialising pl1e to NULL and only map it if it was not mapped earlier. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia

[PATCH v10 01/13] x86/mm: rewrite virt_to_xen_l*e

2021-04-21 Thread Hongyan Xia
-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed in v10: - remove stale include. - s/alloc_map_clear_xen_pt/alloc_mapped_pagetable/g. - fix mis-hunks. Changed in v9: - use domain_page_map_to_mfn() around the L3 table locking logic. - remove vmap_to_mfn() changes since we now use xen_map_to_mfn

[PATCH v10 00/13] switch to domheap for Xen page tables

2021-04-21 Thread Hongyan Xia
From: Hongyan Xia This series rewrites all the remaining functions and finally makes the switch from xenheap to domheap for Xen page tables, so that they no longer need to rely on the direct map, which is a big step towards removing the direct map. --- Changed in v10: - rebase. - address

Re: [PATCH v9 10/13] x86/smpboot: switch clone_mapping() to new APIs

2021-04-21 Thread Hongyan Xia
On Tue, 2021-04-20 at 14:32 +0200, Jan Beulich wrote: > On 06.04.2021 13:05, Hongyan Xia wrote: > > @@ -742,51 +742,58 @@ static int clone_mapping(const void *ptr, > > root_pgentry_t *rpt) > > } > > } > > > > +UNMAP_DOMAIN_PAGE

Re: [PATCH v9 01/13] x86/mm: rewrite virt_to_xen_l*e

2021-04-21 Thread Hongyan Xia
On Tue, 2021-04-20 at 14:17 +0200, Jan Beulich wrote: > On 06.04.2021 13:05, Hongyan Xia wrote: > > From: Wei Liu > > > > Rewrite those functions to use the new APIs. Modify its callers to > > unmap > > the pointer returned. Since alloc_xen_pagetable_new() is a

[PATCH v9 10/13] x86/smpboot: switch clone_mapping() to new APIs

2021-04-06 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v7: - change patch title - remove initialiser of pl3e. - combine the initialisation of pl3e into a single assignment. - use the new alloc_map_clear() helper. - use the normal

[PATCH v9 12/13] x86: switch to use domheap page for page tables

2021-04-06 Thread Hongyan Xia
From: Hongyan Xia Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v8: - const qualify pg in alloc_xen_pagetable_new(). --- xen/arch/x86/mm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86

[PATCH v9 11/13] x86/mm: drop old page table APIs

2021-04-06 Thread Hongyan Xia
From: Hongyan Xia Two sets of old APIs, alloc/free_xen_pagetable() and lXe_to_lYe(), are now dropped to avoid the dependency on direct map. There are two special cases which still have not been re-written into the new APIs, thus need special treatment: rpt in smpboot.c cannot use ephemeral

[PATCH v9 13/13] x86/mm: drop _new suffix for page table APIs

2021-04-06 Thread Hongyan Xia
From: Wei Liu No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Acked-by: Jan Beulich --- xen/arch/x86/mm.c| 44 xen/arch/x86/smpboot.c | 6 +++--- xen/arch/x86/x86_64/mm.c | 2 +- xen/include/asm-x86/mm.h | 4

[PATCH v9 09/13] x86/smpboot: add exit path for clone_mapping()

2021-04-06 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 Signed-off-by: Hongyan Xia --- Changed in v7: - edit commit message. - begin with rc = 0 and set it to -ENOMEM ahead of if(). --- xen/arch/x86/smpboot.c | 16

[PATCH v9 07/13] efi: use new page table APIs in copy_mapping

2021-04-06 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v8: - remove redundant commit message. - unmap l3src based on va instead of mfn. - re-structure if condition around l3dst. Changed in v7: - hoist l3 variables out of the loop to avoid

[PATCH v9 08/13] efi: switch to new APIs in EFI code

2021-04-06 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v7: - add blank line after declaration. - rename efi_l4_pgtable into efi_l4t. - pass the mapped efi_l4t to copy_mapping() instead of map it again. - use the alloc_map_clear_xen_pt() API

[PATCH v9 06/13] x86_64/mm: switch to new APIs in setup_m2p_table

2021-04-06 Thread Hongyan Xia
From: Wei Liu While doing so, avoid repetitive mapping of l2_ro_mpt by keeping it across loops, and only unmap and map it when crossing 1G boundaries. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v8: - re-structure if condition around l2_ro_mpt

[PATCH v9 05/13] x86_64/mm: switch to new APIs in paging_init

2021-04-06 Thread Hongyan Xia
From: Wei Liu Map and unmap pages instead of relying on the direct map. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v9: - remove an unnecessary l3mfn variable. Changed in v8: - replace l3/2_ro_mpt_mfn with just mfn since their lifetimes do

[PATCH v9 03/13] x86/mm: switch to new APIs in modify_xen_mappings

2021-04-06 Thread Hongyan Xia
From: Wei Liu Page tables allocated in that function should be mapped and unmapped now. Note that pl2e now maybe mapped and unmapped in different iterations, so we need to add clean-ups for that. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v7

[PATCH v9 04/13] x86_64/mm: introduce pl2e in paging_init

2021-04-06 Thread Hongyan Xia
From: Wei Liu We will soon map and unmap pages in paging_init(). 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 Acked-by: Jan Beulich --- Changed in v7: - reword commit message. --- xen/arch/x86/x86_64/mm.c | 16

[PATCH v9 02/13] x86/mm: switch to new APIs in map_pages_to_xen

2021-04-06 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 Reviewed-by: Jan Beulich --- xen/arch/x86/mm.c | 60 --- 1 file changed, 36 insertions(+), 24 deletions

[PATCH v9 01/13] x86/mm: rewrite virt_to_xen_l*e

2021-04-06 Thread Hongyan Xia
-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed in v9: - use domain_page_map_to_mfn() around the L3 table locking logic. - remove vmap_to_mfn() changes since we now use xen_map_to_mfn(). Changed in v8: - s/virtual address/linear address/. - BUG_ON() on NULL return in vmap_to_mfn(). Changed in v7

[PATCH v9 00/13] switch to domheap for Xen page tables

2021-04-06 Thread Hongyan Xia
From: Hongyan Xia This series rewrites all the remaining functions and finally makes the switch from xenheap to domheap for Xen page tables, so that they no longer need to rely on the direct map, which is a big step towards removing the direct map. --- Changed in v9: - drop first 2 patches

Re: [PATCH RESEND] Performance regression due to XSA-336

2021-03-31 Thread Hongyan Xia
Thank you for the patch. We observed similar issues. However, would you mind sharing more details on the test setup? We tested the hypervisor after injecting XSA-336. There were regressions in some benchmarks but far from being enough to raise a serious alarm. In particular, we benchmarked CPU,

Re: [PATCH RESEND] Performance regression due to XSA-336

2021-03-31 Thread Hongyan Xia
Thank you for the patch. We observed similar issues. However, would you mind sharing more details on the test setup? We tested the hypervisor after injecting XSA-336. There were regressions in some benchmarks but far from being enough to raise a serious alarm. In particular, we benchmarked CPU,

Re: [PATCH] x86/HVM: refine when to send mapcache invalidation request to qemu

2020-12-10 Thread Hongyan Xia
On Thu, 2020-12-10 at 14:37 +0100, Jan Beulich wrote: > On 10.12.2020 14:09, Hongyan Xia wrote: > > On Mon, 2020-09-28 at 12:44 +0200, Jan Beulich wrote: > > > Plus finally there's no point sending the request for the local > > > domain > > > when the

Re: [PATCH] x86/HVM: refine when to send mapcache invalidation request to qemu

2020-12-10 Thread Hongyan Xia
I came across the same issue when QEMU was holding an extra reference to a page removed from p2m, via XENMEM_add_to_physmap. Please tell me if I am talking nonsense since my knowledge around QEMU invalidation is limited. On Mon, 2020-09-28 at 12:44 +0200, Jan Beulich wrote: > For one it was wrong

Re: [PATCH v8 03/15] x86/mm: rewrite virt_to_xen_l*e

2020-12-07 Thread Hongyan Xia
On Mon, 2020-07-27 at 15:21 +0100, Hongyan Xia wrote: > From: Wei Liu > > Rewrite those functions to use the new APIs. Modify its callers to > unmap > the pointer returned. Since alloc_xen_pagetable_new() is almost never > useful unless accompanied by page clearing and a

[PATCH v3] x86/vmap: handle superpages in vmap_to_mfn()

2020-12-07 Thread Hongyan Xia
From: Hongyan Xia There is simply no guarantee that vmap won't return superpages to the caller. It can happen if the list of MFNs are contiguous, or we simply have a large granularity. Although rare, if such things do happen, we will simply hit BUG_ON() and crash. Introduce xen_map_to_mfn

Re: [PATCH v2] x86/vmap: handle superpages in vmap_to_mfn()

2020-12-07 Thread Hongyan Xia
On Mon, 2020-12-07 at 11:11 +0100, Jan Beulich wrote: > On 03.12.2020 12:21, Hongyan Xia wrote: > > --- a/xen/arch/x86/mm.c > > +++ b/xen/arch/x86/mm.c > > @@ -5194,6 +5194,60 @@ l1_pgentry_t *virt_to_xen_l1

Re: [PATCH] x86/vmap: handle superpages in vmap_to_mfn()

2020-12-03 Thread Hongyan Xia
Apologies. Missing v2 in the title.

[PATCH] x86/vmap: handle superpages in vmap_to_mfn()

2020-12-03 Thread Hongyan Xia
From: Hongyan Xia There is simply no guarantee that vmap won't return superpages to the caller. It can happen if the list of MFNs are contiguous, or we simply have a large granularity. Although rare, if such things do happen, we will simply hit BUG_ON() and crash. Introduce xen_map_to_mfn

Re: [PATCH] x86/vmap: handle superpages in vmap_to_mfn()

2020-12-02 Thread Hongyan Xia
On Wed, 2020-12-02 at 11:04 +0100, Jan Beulich wrote: > On 30.11.2020 17:50, Hongyan Xia wrote: > > From: Hongyan Xia > > > > There is simply no guarantee that vmap won't return superpages to > > the > > caller. It can happen if the list of MFNs are contiguous,

Re: [PATCH 04/16] x86/srat: vmap the pages for acpi_slit

2020-11-30 Thread Hongyan Xia
On Mon, 2020-11-30 at 11:16 +0100, Jan Beulich wrote: > On 30.04.2020 22:44, Hongyan Xia wrote: > > --- a/xen/arch/x86/srat.c > > +++ b/xen/arch/x86/srat.c > > @@ -196,7 +196,8 @@ void __init acpi_numa_slit_init(struct > > acpi_table_slit *slit) > >

[PATCH] x86/vmap: handle superpages in vmap_to_mfn()

2020-11-30 Thread Hongyan Xia
From: Hongyan Xia There is simply no guarantee that vmap won't return superpages to the caller. It can happen if the list of MFNs are contiguous, or we simply have a large granularity. Although rare, if such things do happen, we will simply hit BUG_ON() and crash. Properly handle such cases

Re: [PATCH v8 03/15] x86/mm: rewrite virt_to_xen_l*e

2020-11-30 Thread Hongyan Xia
On Mon, 2020-11-30 at 13:50 +0100, Jan Beulich wrote: > On 30.11.2020 13:13, Hongyan Xia wrote: > > On Tue, 2020-08-18 at 18:16 +0200, Jan Beulich wrote: > > [...] > > > > Actually I did not propose the BUG_ON() fix. I was just in favor of > > it > >

Re: [PATCH v8 03/15] x86/mm: rewrite virt_to_xen_l*e

2020-11-30 Thread Hongyan Xia
en Grall wrote: > > > > Hi Jan, > > > > > > > > On 18/08/2020 09:49, Jan Beulich wrote: > > > > > On 13.08.2020 19:22, Julien Grall wrote: > > > > > > Hi, > > > > > > > > > > > > On 13/08/2020 17:08, Hongya

Re: XSM and the idle domain

2020-10-22 Thread Hongyan Xia
On Thu, 2020-10-22 at 13:51 +0100, Andrew Cooper wrote: > On 21/10/2020 15:34, Hongyan Xia wrote: > > The first question came up during ongoing work in LiveUpdate. After > > an > > LU, the next Xen needs to restore all domains. To do that, some > > hypercalls need to be

Re: XSM and the idle domain

2020-10-22 Thread Hongyan Xia
(also replying to others in this thread.) On Wed, 2020-10-21 at 12:21 -0400, Jason Andryuk wrote: > On Wed, Oct 21, 2020 at 10:35 AM Hongyan Xia wrote: > > > > Hi, > > ... > > > > The first question came up during ongoing work in LiveUpdate. After > > a

XSM and the idle domain

2020-10-21 Thread Hongyan Xia
Hi, A while ago there was a quick chat on IRC about how XSM interacts with the idle domain. The conversation did not reach any clear conclusions so it might be a good idea to summarise the questions in an email. Basically there were two questions in that conversation: 1. In its current state,

Re: [PATCH v8 03/15] x86/mm: rewrite virt_to_xen_l*e

2020-08-13 Thread Hongyan Xia
On Fri, 2020-08-07 at 16:05 +0200, Jan Beulich wrote: > On 27.07.2020 16:21, Hongyan Xia wrote: > > From: Wei Liu > > > > Rewrite those functions to use the new APIs. Modify its callers to > > unmap > > the pointer returned. Since alloc_xen_pagetable_new() is a

[PATCH v8 13/15] x86/mm: drop old page table APIs

2020-07-27 Thread Hongyan Xia
From: Hongyan Xia Two sets of old APIs, alloc/free_xen_pagetable() and lXe_to_lYe(), are now dropped to avoid the dependency on direct map. There are two special cases which still have not been re-written into the new APIs, thus need special treatment: rpt in smpboot.c cannot use ephemeral

[PATCH v8 10/15] efi: switch to new APIs in EFI code

2020-07-27 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v7: - add blank line after declaration. - rename efi_l4_pgtable into efi_l4t. - pass the mapped efi_l4t to copy_mapping() instead of map it again. - use the alloc_map_clear_xen_pt() API

[PATCH v8 12/15] x86/smpboot: switch clone_mapping() to new APIs

2020-07-27 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v7: - change patch title - remove initialiser of pl3e. - combine the initialisation of pl3e into a single assignment. - use the new alloc_map_clear() helper. - use the normal

[PATCH v8 11/15] x86/smpboot: add exit path for clone_mapping()

2020-07-27 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 Signed-off-by: Hongyan Xia --- Changed in v7: - edit commit message. - begin with rc = 0 and set it to -ENOMEM ahead of if(). --- xen/arch/x86/smpboot.c | 16

[PATCH v8 15/15] x86/mm: drop _new suffix for page table APIs

2020-07-27 Thread Hongyan Xia
From: Wei Liu No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Acked-by: Jan Beulich --- xen/arch/x86/mm.c| 44 ++-- xen/arch/x86/smpboot.c | 6 +++--- xen/arch/x86/x86_64/mm.c | 2 +- xen/include/asm-x86/mm.h | 4

[PATCH v8 14/15] x86: switch to use domheap page for page tables

2020-07-27 Thread Hongyan Xia
From: Hongyan Xia Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v8: - const qualify pg in alloc_xen_pagetable_new(). --- xen/arch/x86/mm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86

[PATCH v8 06/15] x86_64/mm: introduce pl2e in paging_init

2020-07-27 Thread Hongyan Xia
From: Wei Liu We will soon map and unmap pages in paging_init(). 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 Acked-by: Jan Beulich --- Changed in v7: - reword commit message. --- xen/arch/x86/x86_64/mm.c | 16

[PATCH v8 09/15] efi: use new page table APIs in copy_mapping

2020-07-27 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed in v8: - remove redundant commit message. - unmap l3src based on va instead of mfn. - re-structure if condition around l3dst. Changed in v7: - hoist l3 variables out of the loop to avoid repetitive mappings. --- xen

[PATCH v8 03/15] x86/mm: rewrite virt_to_xen_l*e

2020-07-27 Thread Hongyan Xia
that the change of virt_to_xen_l1e() also requires vmap_to_mfn() to unmap the page, which requires domain_page.h header in vmap. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v8: - s/virtual address/linear address/. - BUG_ON() on NULL return in vmap_to_mfn

[PATCH v8 04/15] x86/mm: switch to new APIs in map_pages_to_xen

2020-07-27 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 Reviewed-by: Jan Beulich --- xen/arch/x86/mm.c | 60 +-- 1 file changed, 36 insertions(+), 24

[PATCH v8 01/15] x86/mm: map_pages_to_xen would better have one exit path

2020-07-27 Thread Hongyan Xia
-by: Hongyan Xia --- Changed since v4: - drop the end_of_loop goto label. Changed since v3: - remove asserts on rc since rc never gets changed to anything else. - reword commit message. --- xen/arch/x86/mm.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git

[PATCH v8 05/15] x86/mm: switch to new APIs in modify_xen_mappings

2020-07-27 Thread Hongyan Xia
From: Wei Liu Page tables allocated in that function should be mapped and unmapped now. Note that pl2e now maybe mapped and unmapped in different iterations, so we need to add clean-ups for that. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v7

[PATCH v8 07/15] x86_64/mm: switch to new APIs in paging_init

2020-07-27 Thread Hongyan Xia
From: Wei Liu Map and unmap pages instead of relying on the direct map. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v8: - replace l3/2_ro_mpt_mfn with just mfn since their lifetimes do not overlap Changed in v7: - use the new

[PATCH v8 08/15] x86_64/mm: switch to new APIs in setup_m2p_table

2020-07-27 Thread Hongyan Xia
From: Wei Liu While doing so, avoid repetitive mapping of l2_ro_mpt by keeping it across loops, and only unmap and map it when crossing 1G boundaries. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v8: - re-structure if condition around l2_ro_mpt

[PATCH v8 02/15] x86/mm: make sure there is one exit path for modify_xen_mappings

2020-07-27 Thread Hongyan Xia
From: Wei Liu We will soon need to handle dynamically mapping / unmapping page tables in the said function. Since dynamic mappings may map and unmap pl3e in different iterations, lift pl3e out of the loop. No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed

[PATCH v8 00/15] switch to domheap for Xen page tables

2020-07-27 Thread Hongyan Xia
From: Hongyan Xia This series rewrites all the remaining functions and finally makes the switch from xenheap to domheap for Xen page tables, so that they no longer need to rely on the direct map, which is a big step towards removing the direct map. This series depends on the following mini

Re: [PATCH v7 09/15] efi: use new page table APIs in copy_mapping

2020-07-27 Thread Hongyan Xia
On Mon, 2020-07-27 at 13:45 +0100, Hongyan Xia wrote: > On Tue, 2020-07-14 at 14:42 +0200, Jan Beulich wrote: > > On 29.05.2020 13:11, Hongyan Xia wrote: > > > From: Wei Liu > > > > > > After inspection ARM doesn't have alloc_xen_pagetable so this > >

Re: [PATCH v7 09/15] efi: use new page table APIs in copy_mapping

2020-07-27 Thread Hongyan Xia
On Tue, 2020-07-14 at 14:42 +0200, Jan Beulich wrote: > On 29.05.2020 13:11, Hongyan Xia wrote: > > 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. >

Re: [PATCH v7 03/15] x86/mm: rewrite virt_to_xen_l*e

2020-07-27 Thread Hongyan Xia
On Tue, 2020-07-14 at 12:47 +0200, Jan Beulich wrote: > On 29.05.2020 13:11, Hongyan Xia wrote: > > From: Wei Liu > > > > Rewrite those functions to use the new APIs. Modify its callers to > > unmap > > the pointer returned. Since alloc_xen_pagetable_new() is a

[PATCH v7 11/15] x86/smpboot: add exit path for clone_mapping()

2020-05-29 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 Signed-off-by: Hongyan Xia --- Changed in v7: - edit commit message. - begin with rc = 0 and set it to -ENOMEM ahead of if(). --- xen/arch/x86/smpboot.c | 16

[PATCH v7 15/15] x86/mm: drop _new suffix for page table APIs

2020-05-29 Thread Hongyan Xia
From: Wei Liu No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Acked-by: Jan Beulich --- xen/arch/x86/mm.c| 44 xen/arch/x86/smpboot.c | 6 +++--- xen/arch/x86/x86_64/mm.c | 2 +- xen/include/asm-x86/mm.h | 4

[PATCH v7 14/15] x86: switch to use domheap page for page tables

2020-05-29 Thread Hongyan Xia
From: Hongyan Xia Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- xen/arch/x86/mm.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 38cfa3ce25..16f1aa3344 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c

[PATCH v7 13/15] x86/mm: drop old page table APIs

2020-05-29 Thread Hongyan Xia
From: Hongyan Xia Two sets of old APIs, alloc/free_xen_pagetable() and lXe_to_lYe(), are now dropped to avoid the dependency on direct map. There are two special cases which still have not been re-written into the new APIs, thus need special treatment: rpt in smpboot.c cannot use ephemeral

[PATCH v7 10/15] efi: switch to new APIs in EFI code

2020-05-29 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed in v7: - add blank line after declaration. - rename efi_l4_pgtable into efi_l4t. - pass the mapped efi_l4t to copy_mapping() instead of map it again. - use the alloc_map_clear_xen_pt() API. - unmap pl3e, pl2e, l1t

[PATCH v7 12/15] x86/smpboot: switch clone_mapping() to new APIs

2020-05-29 Thread Hongyan Xia
From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed in v7: - change patch title - remove initialiser of pl3e. - combine the initialisation of pl3e into a single assignment. - use the new alloc_map_clear() helper. - use the normal map_domain_page() in the error path

[PATCH v7 05/15] x86/mm: switch to new APIs in modify_xen_mappings

2020-05-29 Thread Hongyan Xia
From: Wei Liu Page tables allocated in that function should be mapped and unmapped now. Note that pl2e now maybe mapped and unmapped in different iterations, so we need to add clean-ups for that. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed in v7: - use normal unmap

[PATCH v7 03/15] x86/mm: rewrite virt_to_xen_l*e

2020-05-29 Thread Hongyan Xia
that the change of virt_to_xen_l1e() also requires vmap_to_mfn() to unmap the page, which requires domain_page.h header in vmap. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed in v7: - remove a comment. - use l1e_get_mfn() instead of converting things back and forth. - add

[PATCH v7 01/15] x86/mm: map_pages_to_xen would better have one exit path

2020-05-29 Thread Hongyan Xia
-by: Hongyan Xia --- Changed since v4: - drop the end_of_loop goto label. Changed since v3: - remove asserts on rc since rc never gets changed to anything else. - reword commit message. --- xen/arch/x86/mm.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git

[PATCH v7 00/15] switch to domheap for Xen page tables

2020-05-29 Thread Hongyan Xia
From: Hongyan Xia This series rewrites all the remaining functions and finally makes the switch from xenheap to domheap for Xen page tables, so that they no longer need to rely on the direct map, which is a big step towards removing the direct map. This series depends on the following mini

[PATCH v7 07/15] x86_64/mm: switch to new APIs in paging_init

2020-05-29 Thread Hongyan Xia
From: Wei Liu Map and unmap pages instead of relying on the direct map. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed in v7: - use the new alloc_map_clear_xen_pt() helper. - move the unmap of pl3t up a bit. - remove the unmaps in the nomem path. --- xen/arch/x86/x86_64/mm.c

[PATCH v7 08/15] x86_64/mm: switch to new APIs in setup_m2p_table

2020-05-29 Thread Hongyan Xia
From: Wei Liu Avoid repetitive mapping of l2_ro_mpt by keeping it across loops, and only unmap and map it when crossing 1G boundaries. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed in v7: - avoid repetitive mapping of l2_ro_mpt. - edit commit message. - switch

[PATCH v7 06/15] x86_64/mm: introduce pl2e in paging_init

2020-05-29 Thread Hongyan Xia
From: Wei Liu We will soon map and unmap pages in paging_init(). 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 --- Changed in v7: - reword commit message. --- xen/arch/x86/x86_64/mm.c | 16 +--- 1 file

[PATCH v7 04/15] x86/mm: switch to new APIs in map_pages_to_xen

2020-05-29 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 --- xen/arch/x86/mm.c | 60 --- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86

[PATCH v7 09/15] efi: use new page table APIs in copy_mapping

2020-05-29 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 Signed-off-by: Hongyan Xia --- Changed in v7: - hoist l3 variables out of the loop to avoid repetitive mappings. --- xen/common

[PATCH v7 02/15] x86/mm: make sure there is one exit path for modify_xen_mappings

2020-05-29 Thread Hongyan Xia
From: Wei Liu We will soon need to handle dynamically mapping / unmapping page tables in the said function. Since dynamic mappings may map and unmap pl3e in different iterations, lift pl3e out of the loop. No functional change. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- Changed

Re: [RFC PATCH 1/1] xen: Use a global mapping for runstate

2020-05-29 Thread Hongyan Xia
On Fri, 2020-05-29 at 08:13 +, Bertrand Marquis wrote: > Hi Julien, > > > On 28 May 2020, at 19:54, Julien Grall wrote: > > > > Hi Bertrand, > > > > Thank you for the patch. > > > > On 28/05/2020 16:25, Bertrand Marquis wrote: > > > At the moment on Arm, a Linux guest running with KTPI

Re: [PATCH v6 13/15] x86/mm: drop old page table APIs

2020-05-27 Thread Hongyan Xia
On Wed, 2020-05-20 at 12:09 +0200, Jan Beulich wrote: > On 24.04.2020 16:09, Hongyan Xia wrote: > > --- a/xen/arch/x86/smpboot.c > > +++ b/xen/arch/x86/smpboot.c > > @@ -815,7 +815,7 @@ static int setup_cpu_root_pgt(unsigned int cpu) > > if ( !opt_x

Re: [PATCH v6 07/15] x86_64/mm: switch to new APIs in paging_init

2020-05-27 Thread Hongyan Xia
On Wed, 2020-05-20 at 11:46 +0200, Jan Beulich wrote: > On 24.04.2020 16:08, Hongyan Xia wrote: > > @@ -493,22 +494,28 @@ void __init paging_init(void) > > if ( !(l4e_get_flags(idle_pg_table[l4_table_offset(va)]) & > >

Re: RoCE adapters and Xen.

2020-05-17 Thread Hongyan Xia
On Sun, 2020-05-17 at 13:15 +, Jason Long wrote: > Hello, > The Xen hypervisor doesn't support the RoCE adapters? The Oracle > migrates to the KVM because of it. > Why not add this feature? I am curious. Aren't RoCE adapters just PCIe devices? If things are set up correctly and drivers are

Re: Error during update_runstate_area with KPTI activated

2020-05-15 Thread Hongyan Xia
On Fri, 2020-05-15 at 11:08 +0100, Julien Grall wrote: > Hi, > > On 15/05/2020 10:57, Roger Pau Monné wrote: > > On Fri, May 15, 2020 at 10:23:16AM +0100, Julien Grall wrote: > > > [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open > > > attachments unless you have verified the sender

[PATCH] domain_page: handle NULL within unmap_domain_page() itself

2020-05-13 Thread Hongyan Xia
From: Hongyan Xia The macro version UNMAP_DOMAIN_PAGE() does both NULL checking and variable clearing. Move NULL checking into the function itself so that the semantics is consistent with other similar constructs like XFREE(). This also eases the use unmap_domain_page() in error handling paths

Re: [PATCH v6 12/15] x86/smpboot: switch pl*e to use new APIs in clone_mapping

2020-05-11 Thread Hongyan Xia
On Thu, 2020-04-30 at 17:15 +0200, Jan Beulich wrote: > On 24.04.2020 16:09, Hongyan Xia wrote: > > From: Wei Liu > > Nit: Why the emphasis on pl*e in the title? Is there anything left > unconverted in the function? IOW how about "switch clone_mapping() > to new pa

[PATCH v2] x86/traps: fix an off-by-one error

2020-05-05 Thread Hongyan Xia
From: Hongyan Xia stack++ can go into the next page and unmap_domain_page() will unmap the wrong one, causing mapcache and memory corruption. Fix. Signed-off-by: Hongyan Xia --- Changed in v2: - tweak how the unmap is handled. - fix the bug in compat as well. - remove part of the commit

Re: [PATCH] x86/traps: fix an off-by-one error

2020-05-05 Thread Hongyan Xia
On Tue, 2020-05-05 at 15:38 +0200, Jan Beulich wrote: > On 05.05.2020 13:06, Hongyan Xia wrote: > > --- a/xen/arch/x86/traps.c > > +++ b/xen/arch/x86/traps.c > > @@ -300,6 +300,7 @@ static void show_guest_stack(struct vcpu *v, > > const struct cpu_user_regs *regs) > &

  1   2   3   >