[PATCH 1/13] KVM: Add tlb_remote_flush_with_range callback in kvm_x86_ops

2018-09-10 Thread Tianyu Lan
Add flush range call back in the kvm_x86_ops and platform can use it to register its associated function. The parameter "kvm_tlb_range" accepts a single range and flush list which contains a list of ranges. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 8 1 file

[PATCH 00/13] x86/KVM/Hyper-v: Add HV ept tlb range flush hypercall support in KVM

2018-09-10 Thread Tianyu Lan
For nested memory virtualization, Hyper-v doesn't set write-protect L1 hypervisor EPT page directory and page table node to track changes while it relies on guest to tell it changes via HvFlushGuestAddressLlist hypercall. HvFlushGuestAddressLlist hypercall provides a way to flush EPT page table

[PATCH 1/13] KVM: Add tlb_remote_flush_with_range callback in kvm_x86_ops

2018-09-10 Thread Tianyu Lan
Add flush range call back in the kvm_x86_ops and platform can use it to register its associated function. The parameter "kvm_tlb_range" accepts a single range and flush list which contains a list of ranges. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 8 1 file

[PATCH 2/13] KVM/MMU: Add tlb flush with range helper function

2018-09-10 Thread Tianyu Lan
This patch is to add wrapper functions for tlb_remote_flush_with_range callback. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 48 1 file changed, 48 insertions(+) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index

[Resend PATCH] KVM/MMU: Fix comment in walk_shadow_page_lockless_end()

2018-09-07 Thread Tianyu Lan
kvm_commit_zap_page() has been renamed to kvm_mmu_commit_zap_page() This patch is to fix the commit. Signed-off-by: Lan Tianyu --- Sorry for the broken title and resend. arch/x86/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu.c

[Resend PATCH] KVM/MMU: Fix comment in walk_shadow_page_lockless_end()

2018-09-07 Thread Tianyu Lan
kvm_commit_zap_page() has been renamed to kvm_mmu_commit_zap_page() This patch is to fix the commit. Signed-off-by: Lan Tianyu --- Sorry for the broken title and resend. arch/x86/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu.c

[ 1/1] KVM/MMU: Fix comment in walk_shadow_page_lockless_end()

2018-09-06 Thread Tianyu Lan
kvm_commit_zap_page() has been renamed to kvm_mmu_commit_zap_page() This patch is to fix the commit. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 7ccd29b95746..648b839a349d

[ 1/1] KVM/MMU: Fix comment in walk_shadow_page_lockless_end()

2018-09-06 Thread Tianyu Lan
kvm_commit_zap_page() has been renamed to kvm_mmu_commit_zap_page() This patch is to fix the commit. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 7ccd29b95746..648b839a349d

Re: linux-next: manual merge of the kvm tree with the tip tree

2018-08-06 Thread Tianyu Lan
Hi Stephen: Thanks for fix. I will discuss with maintainer about how to deal with the issue. On 8/6/2018 1:12 PM, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the kvm tree got a conflict in: > >arch/x86/include/asm/trace/hyperv.h > > between commit: > >

Re: linux-next: manual merge of the kvm tree with the tip tree

2018-08-06 Thread Tianyu Lan
Hi Stephen: Thanks for fix. I will discuss with maintainer about how to deal with the issue. On 8/6/2018 1:12 PM, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the kvm tree got a conflict in: > >arch/x86/include/asm/trace/hyperv.h > > between commit: > >

Re: [PATCH] KVM/MMU: Combine flushing remote tlb in mmu_set_spte()

2018-07-24 Thread Tianyu Lan
Hi Junaid: Thanks for your review. On 7/25/2018 10:26 AM, Junaid Shahid wrote: > On 07/24/2018 07:35 AM, Paolo Bonzini wrote: >> On 24/07/2018 10:17, Tianyu Lan wrote: >>> mmu_set_spte() flushes remote tlbs for drop_parent_pte/drop_spte() >>> and set_spte() sep

Re: [PATCH] KVM/MMU: Combine flushing remote tlb in mmu_set_spte()

2018-07-24 Thread Tianyu Lan
Hi Junaid: Thanks for your review. On 7/25/2018 10:26 AM, Junaid Shahid wrote: > On 07/24/2018 07:35 AM, Paolo Bonzini wrote: >> On 24/07/2018 10:17, Tianyu Lan wrote: >>> mmu_set_spte() flushes remote tlbs for drop_parent_pte/drop_spte() >>> and set_spte() sep

[PATCH] KVM/MMU: Combine flushing remote tlb in mmu_set_spte()

2018-07-24 Thread Tianyu Lan
mmu_set_spte() flushes remote tlbs for drop_parent_pte/drop_spte() and set_spte() separately. This may introduce redundant flush. This patch is to combine these flushes and check flush request after calling set_spte(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 7 --- 1 file

[PATCH] KVM/MMU: Combine flushing remote tlb in mmu_set_spte()

2018-07-24 Thread Tianyu Lan
mmu_set_spte() flushes remote tlbs for drop_parent_pte/drop_spte() and set_spte() separately. This may introduce redundant flush. This patch is to combine these flushes and check flush request after calling set_spte(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 7 --- 1 file

[Resend PATCH] KVM/x86: Move X86_CR4_OSXSAVE check into kvm_valid_sregs()

2018-07-23 Thread Tianyu Lan
X86_CR4_OSXSAVE check belongs to sregs check and so move into kvm_valid_sregs(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/x86.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 153564db7980..5c9acdbb2020 100644 ---

[Resend PATCH] KVM/x86: Move X86_CR4_OSXSAVE check into kvm_valid_sregs()

2018-07-23 Thread Tianyu Lan
X86_CR4_OSXSAVE check belongs to sregs check and so move into kvm_valid_sregs(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/x86.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 153564db7980..5c9acdbb2020 100644 ---

Re: [PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-23 Thread Tianyu Lan
On 7/23/2018 3:39 PM, Wanpeng Li wrote: > On Fri, 20 Jul 2018 at 16:32, Paolo Bonzini wrote: >> >> On 20/07/2018 05:58, KY Srinivasan wrote: >>> >>> >>>> -----Original Message- >>>> From: Tianyu Lan >>>> Sent: Thursday, Jul

Re: [PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-23 Thread Tianyu Lan
On 7/23/2018 3:39 PM, Wanpeng Li wrote: > On Fri, 20 Jul 2018 at 16:32, Paolo Bonzini wrote: >> >> On 20/07/2018 05:58, KY Srinivasan wrote: >>> >>> >>>> -----Original Message- >>>> From: Tianyu Lan >>>> Sent: Thursday, Jul

[PATCH] KVM: Compile hv_remote_flush_tlb() and check_ept_pointer() when CONFIG_HYPERV is enabled.

2018-07-23 Thread Tianyu Lan
This patch is to avoid compilation warning when CONFIG_HYPERV isn't enabled. Signed-off-by: Lan Tianyu --- arch/x86/kvm/vmx.c | 84 +++--- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c

[PATCH] KVM: Compile hv_remote_flush_tlb() and check_ept_pointer() when CONFIG_HYPERV is enabled.

2018-07-23 Thread Tianyu Lan
This patch is to avoid compilation warning when CONFIG_HYPERV isn't enabled. Signed-off-by: Lan Tianyu --- arch/x86/kvm/vmx.c | 84 +++--- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c

[Update PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Tianyu Lan
Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. This patch is to implement it. Signed-off-by: Lan Tianyu --- Change since v3 Remove GPL boilerplate.

[Update PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Tianyu Lan
Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. This patch is to implement it. Signed-off-by: Lan Tianyu --- Change since v3 Remove GPL boilerplate.

Re: [PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Tianyu Lan
On 7/19/2018 8:05 PM, Thomas Gleixner wrote: > On Thu, 19 Jul 2018, Tianyu Lan wrote: >> @@ -0,0 +1,64 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> + >> +/* >> + * Hyper-V nested virtualization code. >> + * >> + * Copyright (C) 2018, Micr

Re: [PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Tianyu Lan
On 7/19/2018 8:05 PM, Thomas Gleixner wrote: > On Thu, 19 Jul 2018, Tianyu Lan wrote: >> @@ -0,0 +1,64 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> + >> +/* >> + * Hyper-V nested virtualization code. >> + * >> + * Copyright (C) 2018, Micr

Re: [PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-19 Thread Tianyu Lan
On 7/19/2018 4:57 PM, Paolo Bonzini wrote: > On 19/07/2018 10:39, Tianyu Lan wrote: >> Hyper-V provides a para-virtualization hypercall >> HvFlushGuestPhysicalAddressSpace >> to flush nested VM address space mapping in l1 hypervisor and it's to reduce >> overhead &

Re: [PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-19 Thread Tianyu Lan
On 7/19/2018 4:57 PM, Paolo Bonzini wrote: > On 19/07/2018 10:39, Tianyu Lan wrote: >> Hyper-V provides a para-virtualization hypercall >> HvFlushGuestPhysicalAddressSpace >> to flush nested VM address space mapping in l1 hypervisor and it's to reduce >> overhead &

[PATCH V3 3/4] KVM: Add tlb remote flush callback in kvm_x86_ops.

2018-07-19 Thread Tianyu Lan
This patch is to provide a way for platforms to register hv tlb remote flush callback and this helps to optimize operation of tlb flush among vcpus for nested virtualization case. Signed-off-by: Lan Tianyu --- Change since v2: Rename kvm_arch_hv_flush_remote_tlb with

[PATCH V3 3/4] KVM: Add tlb remote flush callback in kvm_x86_ops.

2018-07-19 Thread Tianyu Lan
This patch is to provide a way for platforms to register hv tlb remote flush callback and this helps to optimize operation of tlb flush among vcpus for nested virtualization case. Signed-off-by: Lan Tianyu --- Change since v2: Rename kvm_arch_hv_flush_remote_tlb with

[PATCH V3 4/4] KVM/x86: Add tlb_remote_flush callback support for vmx

2018-07-19 Thread Tianyu Lan
Register tlb_remote_flush callback for vmx when hyperv capability of nested guest mapping flush is detected. The interface can help to reduce overhead when flush ept table among vcpus for nested VM. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It will

[PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-19 Thread Tianyu Lan
Hyper-V provides a para-virtualization hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It

[PATCH V3 4/4] KVM/x86: Add tlb_remote_flush callback support for vmx

2018-07-19 Thread Tianyu Lan
Register tlb_remote_flush callback for vmx when hyperv capability of nested guest mapping flush is detected. The interface can help to reduce overhead when flush ept table among vcpus for nested VM. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It will

[PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-19 Thread Tianyu Lan
Hyper-V provides a para-virtualization hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It

[PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Tianyu Lan
Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. This patch is to implement it. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/Makefile | 2 +-

[PATCH V3 2/4] X86/Hyper-V: Add hyperv_nested_flush_guest_mapping ftrace support

2018-07-19 Thread Tianyu Lan
This patch is to add hyperv_nested_flush_guest_mapping support to trace hvFlushGuestPhysicalAddressSpace hypercall. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/nested.c| 3 +++ arch/x86/include/asm/trace/hyperv.h | 14 ++ 2 files changed, 17 insertions(+) diff --git

[PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Tianyu Lan
Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. This patch is to implement it. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/Makefile | 2 +-

[PATCH V3 2/4] X86/Hyper-V: Add hyperv_nested_flush_guest_mapping ftrace support

2018-07-19 Thread Tianyu Lan
This patch is to add hyperv_nested_flush_guest_mapping support to trace hvFlushGuestPhysicalAddressSpace hypercall. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/nested.c| 3 +++ arch/x86/include/asm/trace/hyperv.h | 14 ++ 2 files changed, 17 insertions(+) diff --git

Re: [PATCH V2 3/5] KVM/VMX: Add identical ept table pointer check

2018-07-18 Thread Tianyu Lan
On 7/18/2018 7:59 PM, Paolo Bonzini wrote: > On 09/07/2018 11:02, Tianyu Lan wrote: >> +static void check_ept_pointer(struct kvm_vcpu *vcpu, u64 eptp) >> +{ >> +struct kvm *kvm = vcpu->kvm; >> +u64 tmp_eptp = INVALID_PAGE; >> +int i; >> +

Re: [PATCH V2 3/5] KVM/VMX: Add identical ept table pointer check

2018-07-18 Thread Tianyu Lan
On 7/18/2018 7:59 PM, Paolo Bonzini wrote: > On 09/07/2018 11:02, Tianyu Lan wrote: >> +static void check_ept_pointer(struct kvm_vcpu *vcpu, u64 eptp) >> +{ >> +struct kvm *kvm = vcpu->kvm; >> +u64 tmp_eptp = INVALID_PAGE; >> +int i; >> +

Re: [PATCH V2 2/5] KVM: Add tlb remote flush callback in kvm_x86_ops.

2018-07-18 Thread Tianyu Lan
Hi Paolo: Thanks for review. On 7/18/2018 8:01 PM, Paolo Bonzini wrote: > On 09/07/2018 11:02, Tianyu Lan wrote: >> +/* >> + * Call kvm_arch_hv_tlb_remote first and go back old way when >> + * return failure. >> + */ >> +if (

Re: [PATCH V2 2/5] KVM: Add tlb remote flush callback in kvm_x86_ops.

2018-07-18 Thread Tianyu Lan
Hi Paolo: Thanks for review. On 7/18/2018 8:01 PM, Paolo Bonzini wrote: > On 09/07/2018 11:02, Tianyu Lan wrote: >> +/* >> + * Call kvm_arch_hv_tlb_remote first and go back old way when >> + * return failure. >> + */ >> +if (

[PATCH] KVM/MMU: Simplify __kvm_sync_page() function

2018-07-18 Thread Tianyu Lan
Merge check of "sp->role.cr4_pae != !!is_pae(vcpu))" and "vcpu-> arch.mmu.sync_page(vcpu, sp) == 0". kvm_mmu_prepare_zap_page() is called under both these conditions. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git

[PATCH] KVM/MMU: Simplify __kvm_sync_page() function

2018-07-18 Thread Tianyu Lan
Merge check of "sp->role.cr4_pae != !!is_pae(vcpu))" and "vcpu-> arch.mmu.sync_page(vcpu, sp) == 0". kvm_mmu_prepare_zap_page() is called under both these conditions. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git

Re: [PATCH V2 1/5] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-11 Thread Tianyu Lan
Hi Michael: Thanks for your review. On 7/11/2018 5:29 AM, Michael Kelley (EOSG) wrote: > From: Tianyu Lan Monday, July 9, 2018 2:03 AM >> Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to >> flush nested VM address space mapping in l1 hypervisor and it

Re: [PATCH V2 1/5] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-11 Thread Tianyu Lan
Hi Michael: Thanks for your review. On 7/11/2018 5:29 AM, Michael Kelley (EOSG) wrote: > From: Tianyu Lan Monday, July 9, 2018 2:03 AM >> Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to >> flush nested VM address space mapping in l1 hypervisor and it

[PATCH V2 3/5] KVM/VMX: Add identical ept table pointer check

2018-07-09 Thread Tianyu Lan
This patch is to check ept table pointer of each cpus when set ept tables and store identical ept table pointer if all ept table pointers of single VM are same. This is for support of para-virt ept flush hypercall. Signed-off-by: Lan Tianyu --- Change since v1: Replace

[PATCH V2 5/5] X86/Hyper-V: Add hyperv_nested_flush_guest_mapping ftrace support

2018-07-09 Thread Tianyu Lan
This patch is to add hyperv_nested_flush_guest_mapping support to trace hvFlushGuestPhysicalAddressSpace hypercall. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/nested.c| 3 +++ arch/x86/include/asm/trace/hyperv.h | 14 ++ 2 files changed, 17 insertions(+) diff --git

[PATCH V2 4/5] KVM/x86: Add tlb_remote_flush callback support for vmx

2018-07-09 Thread Tianyu Lan
Register tlb_remote_flush callback for vmx when hyperv capability of nested guest mapping flush is detected. The interface can help to reduce overhead when flush ept table among vcpus for nested VM. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It will

[PATCH V2 3/5] KVM/VMX: Add identical ept table pointer check

2018-07-09 Thread Tianyu Lan
This patch is to check ept table pointer of each cpus when set ept tables and store identical ept table pointer if all ept table pointers of single VM are same. This is for support of para-virt ept flush hypercall. Signed-off-by: Lan Tianyu --- Change since v1: Replace

[PATCH V2 5/5] X86/Hyper-V: Add hyperv_nested_flush_guest_mapping ftrace support

2018-07-09 Thread Tianyu Lan
This patch is to add hyperv_nested_flush_guest_mapping support to trace hvFlushGuestPhysicalAddressSpace hypercall. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/nested.c| 3 +++ arch/x86/include/asm/trace/hyperv.h | 14 ++ 2 files changed, 17 insertions(+) diff --git

[PATCH V2 4/5] KVM/x86: Add tlb_remote_flush callback support for vmx

2018-07-09 Thread Tianyu Lan
Register tlb_remote_flush callback for vmx when hyperv capability of nested guest mapping flush is detected. The interface can help to reduce overhead when flush ept table among vcpus for nested VM. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It will

[PATCH V2 2/5] KVM: Add tlb remote flush callback in kvm_x86_ops.

2018-07-09 Thread Tianyu Lan
This patch is to provide a way for platforms to register hv tlb remote flush callback and this helps to optimize operation of tlb flush among vcpus for nested virtualization case. Signed-off-by: Lan Tianyu --- Change since v1: Add kvm_arch_hv_flush_remote_tlb() to avoid compilation issue

[PATCH V2 2/5] KVM: Add tlb remote flush callback in kvm_x86_ops.

2018-07-09 Thread Tianyu Lan
This patch is to provide a way for platforms to register hv tlb remote flush callback and this helps to optimize operation of tlb flush among vcpus for nested virtualization case. Signed-off-by: Lan Tianyu --- Change since v1: Add kvm_arch_hv_flush_remote_tlb() to avoid compilation issue

[PATCH V2 0/5] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-09 Thread Tianyu Lan
Hyper-V provides a para-virtualization hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It

[PATCH V2 1/5] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-09 Thread Tianyu Lan
Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. This patch is to implement it. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/Makefile | 2 +-

[PATCH V2 0/5] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-09 Thread Tianyu Lan
Hyper-V provides a para-virtualization hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It

[PATCH V2 1/5] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-09 Thread Tianyu Lan
Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. This patch is to implement it. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/Makefile | 2 +-

Re: [PATCH 3/4] KVM/VMX: Add identical ept table pointer check

2018-07-04 Thread Tianyu Lan
Hi Sean: Thank for your review. On 7/3/2018 1:29 AM, Sean Christopherson wrote: > On Mon, Jul 02, 2018 at 02:17:29PM +0000, Tianyu Lan wrote: >> This patch is to check ept table pointer of each cpus when set ept >> tables and store identical ept table pointer if all ept

Re: [PATCH 3/4] KVM/VMX: Add identical ept table pointer check

2018-07-04 Thread Tianyu Lan
Hi Sean: Thank for your review. On 7/3/2018 1:29 AM, Sean Christopherson wrote: > On Mon, Jul 02, 2018 at 02:17:29PM +0000, Tianyu Lan wrote: >> This patch is to check ept table pointer of each cpus when set ept >> tables and store identical ept table pointer if all ept

Re: [PATCH 3/4] KVM/VMX: Add identical ept table pointer check

2018-07-04 Thread Tianyu Lan
Hi Vitaly: Thanks for your review. On 7/2/2018 11:09 PM, Vitaly Kuznetsov wrote: > Tianyu Lan writes: > >> This patch is to check ept table pointer of each cpus when set ept >> tables and store identical ept table pointer if all ept table pointers >&g

Re: [PATCH 3/4] KVM/VMX: Add identical ept table pointer check

2018-07-04 Thread Tianyu Lan
Hi Vitaly: Thanks for your review. On 7/2/2018 11:09 PM, Vitaly Kuznetsov wrote: > Tianyu Lan writes: > >> This patch is to check ept table pointer of each cpus when set ept >> tables and store identical ept table pointer if all ept table pointers >&g

[PATCH 3/4] KVM/VMX: Add identical ept table pointer check

2018-07-02 Thread Tianyu Lan
This patch is to check ept table pointer of each cpus when set ept tables and store identical ept table pointer if all ept table pointers of single VM are same. This is for support of para-virt ept flush hypercall. Signed-off-by: Lan Tianyu --- arch/x86/kvm/vmx.c | 31

[PATCH 3/4] KVM/VMX: Add identical ept table pointer check

2018-07-02 Thread Tianyu Lan
This patch is to check ept table pointer of each cpus when set ept tables and store identical ept table pointer if all ept table pointers of single VM are same. This is for support of para-virt ept flush hypercall. Signed-off-by: Lan Tianyu --- arch/x86/kvm/vmx.c | 31

[PATCH 2/4] KVM: Add tlb remote flush callback in kvm_x86_ops.

2018-07-02 Thread Tianyu Lan
This patch is to provide a way for platforms to register tlb remote flush callback and this helps to optimize operation of tlb flush among vcpus for nested virtualization case. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 1 + virt/kvm/kvm_main.c | 12

[PATCH 2/4] KVM: Add tlb remote flush callback in kvm_x86_ops.

2018-07-02 Thread Tianyu Lan
This patch is to provide a way for platforms to register tlb remote flush callback and this helps to optimize operation of tlb flush among vcpus for nested virtualization case. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 1 + virt/kvm/kvm_main.c | 12

[PATCH 4/4] KVM/x86: Add tlb_remote_flush callback support for vmcs

2018-07-02 Thread Tianyu Lan
Register tlb_remote_flush callback for vmcs when hyperv capability of nested guest mapping flush is detected. The interface can help to reduce overhead when flush ept table among vcpus for nested VM. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It will

[PATCH 4/4] KVM/x86: Add tlb_remote_flush callback support for vmcs

2018-07-02 Thread Tianyu Lan
Register tlb_remote_flush callback for vmcs when hyperv capability of nested guest mapping flush is detected. The interface can help to reduce overhead when flush ept table among vcpus for nested VM. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It will

[PATCH 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-02 Thread Tianyu Lan
Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. This patch is to implement it. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/Makefile | 2 +-

[PATCH 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-02 Thread Tianyu Lan
Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. This patch is to implement it. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/Makefile | 2 +-

[PATCH 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-02 Thread Tianyu Lan
Hyper-V provides a para-virtualization hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It

[PATCH 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-02 Thread Tianyu Lan
Hyper-V provides a para-virtualization hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It

Re: [RFC Patch 3/3] KVM/x86: Add tlb_remote_flush callback support for vmcs

2018-06-14 Thread Tianyu Lan
On 6/14/2018 6:33 PM, Vitaly Kuznetsov wrote: > Tianyu Lan writes: > >> On 6/12/2018 11:12 PM, Vitaly Kuznetsov wrote: >>> Tianyu Lan writes: >>> >>>> >>>> +static int vmx_remote_flush_tlb(struct kvm *kvm) >&

Re: [RFC Patch 3/3] KVM/x86: Add tlb_remote_flush callback support for vmcs

2018-06-14 Thread Tianyu Lan
On 6/14/2018 6:33 PM, Vitaly Kuznetsov wrote: > Tianyu Lan writes: > >> On 6/12/2018 11:12 PM, Vitaly Kuznetsov wrote: >>> Tianyu Lan writes: >>> >>>> >>>> +static int vmx_remote_flush_tlb(struct kvm *kvm) >&

Re: [RFC Patch 3/3] KVM/x86: Add tlb_remote_flush callback support for vmcs

2018-06-14 Thread Tianyu Lan
Hi Vitaly: Thanks for your review. On 6/12/2018 11:12 PM, Vitaly Kuznetsov wrote: > Tianyu Lan writes: > >> Register tlb_remote_flush callback for vmcs when hyperv capability of >> nested guest mapping flush is detected. The interface can help to reduce >> overh

Re: [RFC Patch 3/3] KVM/x86: Add tlb_remote_flush callback support for vmcs

2018-06-14 Thread Tianyu Lan
Hi Vitaly: Thanks for your review. On 6/12/2018 11:12 PM, Vitaly Kuznetsov wrote: > Tianyu Lan writes: > >> Register tlb_remote_flush callback for vmcs when hyperv capability of >> nested guest mapping flush is detected. The interface can help to reduce >> overh

Re: [RFC Patch 1/3] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-06-05 Thread Tianyu Lan
Hi Michael: Thanks for your review. On 6/6/2018 12:59 AM, Michael Kelley (EOSG) wrote: >> -Original Message- >> From: linux-kernel-ow...@vger.kernel.org >> On Behalf >> Of Tianyu Lan >> Sent: Monday, June 4, 2018 2:08 AM >> Cc: Tianyu Lan ;

Re: [RFC Patch 1/3] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-06-05 Thread Tianyu Lan
Hi Michael: Thanks for your review. On 6/6/2018 12:59 AM, Michael Kelley (EOSG) wrote: >> -Original Message- >> From: linux-kernel-ow...@vger.kernel.org >> On Behalf >> Of Tianyu Lan >> Sent: Monday, June 4, 2018 2:08 AM >> Cc: Tianyu Lan ;

[RFC Patch 1/3] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-06-04 Thread Tianyu Lan
Hyper-V provides a pv hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. This patch is to implement it. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/Makefile | 2 +-

[RFC Patch 1/3] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-06-04 Thread Tianyu Lan
Hyper-V provides a pv hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. This patch is to implement it. Signed-off-by: Lan Tianyu --- arch/x86/hyperv/Makefile | 2 +-

[RFC Patch 2/3] KVM: Add tlb remote flush callback in kvm_x86_ops.

2018-06-04 Thread Tianyu Lan
This patch is to provide a way for platforms to register tlb remote flush callback and this helps to optimize operation of tlb flush among vcpus for nested virtualization case. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 1 + virt/kvm/kvm_main.c | 12

[RFC Patch 2/3] KVM: Add tlb remote flush callback in kvm_x86_ops.

2018-06-04 Thread Tianyu Lan
This patch is to provide a way for platforms to register tlb remote flush callback and this helps to optimize operation of tlb flush among vcpus for nested virtualization case. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 1 + virt/kvm/kvm_main.c | 12

[RFC Patch 3/3] KVM/x86: Add tlb_remote_flush callback support for vmcs

2018-06-04 Thread Tianyu Lan
Register tlb_remote_flush callback for vmcs when hyperv capability of nested guest mapping flush is detected. The interface can help to reduce overhead when flush ept table among vcpus for nested VM. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It will

[RFC Patch 3/3] KVM/x86: Add tlb_remote_flush callback support for vmcs

2018-06-04 Thread Tianyu Lan
Register tlb_remote_flush callback for vmcs when hyperv capability of nested guest mapping flush is detected. The interface can help to reduce overhead when flush ept table among vcpus for nested VM. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It will

[RFC Patch 0/3] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-06-04 Thread Tianyu Lan
Hyper-V provides a para-virtualization hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It

[RFC Patch 0/3] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-06-04 Thread Tianyu Lan
Hyper-V provides a para-virtualization hypercall HvFlushGuestPhysicalAddressSpace to flush nested VM address space mapping in l1 hypervisor and it's to reduce overhead of flushing ept tlb among vcpus. The tradition way is to send IPIs to all affected vcpus and executes INVEPT on each vcpus. It

[PATCH] HV: Fix definition of struct hv_vp_assist_page.

2018-05-21 Thread Tianyu Lan
The struct hv_vp_assist_page was defined incorrectly. The "vtl_control" should be u64[3], "nested_enlightenments_control" should be a u64 and there is 7 reserved bytes following "enlighten_vmentry". This patch is to fix it. Signed-off-by: Lan Tianyu ---

[PATCH] HV: Fix definition of struct hv_vp_assist_page.

2018-05-21 Thread Tianyu Lan
The struct hv_vp_assist_page was defined incorrectly. The "vtl_control" should be u64[3], "nested_enlightenments_control" should be a u64 and there is 7 reserved bytes following "enlighten_vmentry". This patch is to fix it. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/hyperv-tlfs.h | 9

Re: [PATCH] KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support

2018-04-13 Thread Tianyu Lan
On 4/12/2018 11:25 PM, Vitaly Kuznetsov wrote: > Enlightened MSR-Bitmap is a natural extension of Enlightened VMCS: > Hyper-V Top Level Functional Specification states: > > "The L1 hypervisor may collaborate with the L0 hypervisor to make MSR > accesses more efficient. It can enable enlightened

Re: [PATCH] KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support

2018-04-13 Thread Tianyu Lan
On 4/12/2018 11:25 PM, Vitaly Kuznetsov wrote: > Enlightened MSR-Bitmap is a natural extension of Enlightened VMCS: > Hyper-V Top Level Functional Specification states: > > "The L1 hypervisor may collaborate with the L0 hypervisor to make MSR > accesses more efficient. It can enable enlightened

[PATCH] KVM/x86: Move X86_CR4_OSXSAVE check into kvm_valid_sregs()

2018-03-09 Thread Tianyu Lan
X86_CR4_OSXSAVE check belongs to sregs check and so move into kvm_valid_sregs(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/x86.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 6c81df9..82845cb

[PATCH] KVM/x86: Move X86_CR4_OSXSAVE check into kvm_valid_sregs()

2018-03-09 Thread Tianyu Lan
X86_CR4_OSXSAVE check belongs to sregs check and so move into kvm_valid_sregs(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/x86.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 6c81df9..82845cb 100644 ---

Re: [PATCH] KVM/X86: Check input sreg values before loading vcpu

2018-03-08 Thread Tianyu Lan
Hi Radim: Thanks for your review. On 3/9/2018 12:15 AM, rkrc...@redhat.com wrote: > 2018-02-27 06:57+0000, Tianyu Lan: >> From: Lan Tianyu <tianyu@microsoft.com> >> >> This patch is to check sreg value first and then load vcpu in order >> to avo

Re: [PATCH] KVM/X86: Check input sreg values before loading vcpu

2018-03-08 Thread Tianyu Lan
Hi Radim: Thanks for your review. On 3/9/2018 12:15 AM, rkrc...@redhat.com wrote: > 2018-02-27 06:57+0000, Tianyu Lan: >> From: Lan Tianyu >> >> This patch is to check sreg value first and then load vcpu in order >> to avoid redundant loading/putting vcpu. >

[PATCH] KVM/X86: Check input sreg values before loading vcpu

2018-02-26 Thread Tianyu Lan
From: Lan Tianyu This patch is to check sreg value first and then load vcpu in order to avoid redundant loading/putting vcpu. Signed-off-by: Lan Tianyu --- arch/x86/kvm/x86.c | 14 +++--- 1 file changed, 7 insertions(+), 7

[PATCH] KVM/X86: Check input sreg values before loading vcpu

2018-02-26 Thread Tianyu Lan
From: Lan Tianyu This patch is to check sreg value first and then load vcpu in order to avoid redundant loading/putting vcpu. Signed-off-by: Lan Tianyu --- arch/x86/kvm/x86.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/x86.c

Re: KASAN: use-after-free Write in irq_bypass_register_consumer

2018-01-28 Thread Tianyu Lan
ign path before they are used in assign path. The other data maybe used in deassign path before initialization. Syzbot test hit such case. Add mutx between kvm_irqfd_assign() and kvm_irqfd_deassign() can fix such issue. Will send patch to fix it. On 12/16/2017 12:53 PM, Tianyu Lan wrote: I reprodu

Re: KASAN: use-after-free Write in irq_bypass_register_consumer

2018-01-28 Thread Tianyu Lan
ign path before they are used in assign path. The other data maybe used in deassign path before initialization. Syzbot test hit such case. Add mutx between kvm_irqfd_assign() and kvm_irqfd_deassign() can fix such issue. Will send patch to fix it. On 12/16/2017 12:53 PM, Tianyu Lan wrote: I reprodu

Re: [Patch] vmbus: Simply hv_get_next_write_location() function

2018-01-25 Thread Tianyu Lan
On Thu, Jan 25, 2018 at 12:37 AM, Stephen Hemminger <step...@networkplumber.org> wrote: > On Wed, 24 Jan 2018 14:21:30 +0800 > lantianyu1...@gmail.com wrote: > >> From: Tianyu Lan <tianyu@microsoft.com> >> >> The "next" variable is redunda

Re: [Patch] vmbus: Simply hv_get_next_write_location() function

2018-01-25 Thread Tianyu Lan
On Thu, Jan 25, 2018 at 12:37 AM, Stephen Hemminger wrote: > On Wed, 24 Jan 2018 14:21:30 +0800 > lantianyu1...@gmail.com wrote: > >> From: Tianyu Lan >> >> The "next" variable is redundant in hv_get_next_write_location(). >> This patch is t

[Patch V2] KVM/x86: Fix references to CR0.PG and CR4.PAE in kvm_valid_sregs()

2018-01-18 Thread Tianyu Lan
; Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Radim Krčmář <rkrc...@redhat.com> Signed-off-by: Tianyu Lan <tianyu@microsoft.com> --- Change since v1: Rename title and fix change log. --- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --gi

[Patch V2] KVM/x86: Fix references to CR0.PG and CR4.PAE in kvm_valid_sregs()

2018-01-18 Thread Tianyu Lan
rčmář Signed-off-by: Tianyu Lan --- Change since v1: Rename title and fix change log. --- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 1cec2c6..c53298d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/

<    1   2   3   4   >