[PATCH 1/2] PCI/ACPI: Convert ACPI PCI Hot Plug IBM Extension dbg/err() to pr_debug/pr_err()

2013-09-09 Thread tianyu . lan
From: Lan Tianyu This patch is to convert internal debug macros to dynamic debug function and remove module's debug param. Signed-off-by: Lan Tianyu --- drivers/pci/hotplug/acpiphp_ibm.c | 56 --- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git

[PATCH 2/2] PCI/ACPI: Convert ACPI PCI Hot Plug core debug fuction to dynamic debug function

2013-09-09 Thread tianyu . lan
From: Lan Tianyu This patch is to use pr_debug/info/warn/err to replace acpiphp debug functions and remove module's debug param. Signed-off-by: Lan Tianyu --- drivers/pci/hotplug/acpiphp.h | 10 -- drivers/pci/hotplug/acpiphp_core.c | 35 +-- driver

[Update PATCH 1/1] Cpufreq: Remove fossil comment of cpufreq_set_policy

2013-09-10 Thread tianyu . lan
From: Lan Tianyu The cpufreq_set_policy() has been removed by commit 632786c. So remove related comment. Signed-off-by: Lan Tianyu --- Update: miss signed-off due to using my new script. Sorry for nosiy. drivers/cpufreq/cpufreq.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers

[PATCH 1/1] Cpufreq: Remove fossil comment of cpufreq_set_policy

2013-09-10 Thread tianyu . lan
From: Lan Tianyu The cpufreq_set_policy() has been removed by commit 632786c. So remove related comment. --- drivers/cpufreq/cpufreq.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 5c75e31..a504313 100644 --- a/drivers/cpufreq/

[PATCH] Cpufreq: Acquire read lock in the cpufreq_policy_restore() rather than write lock

2013-09-11 Thread tianyu . lan
From: Lan Tianyu In the cpufreq_policy_restore(), policy before system suspend is read from from percpu's cpufreq_cpu_data_fallback. It's read operation rather than write operation. So convert write lock to read lock Signed-off-by: Lan Tianyu --- drivers/cpufreq/cpufreq.c | 4 ++-- 1 file chan

[PATCH] Cpufreq/governor: Remove fossil comment

2013-09-11 Thread tianyu . lan
From: Lan Tianyu cpufreq_set_policy() has been changed to origin __cpufreq_set_policy() and policy->lock has been converted to rewrite lock by commit 5a01f2. So remove the comment. Acked-by: Viresh Kumar Signed-off-by: Lan Tianyu --- This patch is based on patch "cpufreq: rename __cpufreq_set_

[PATCH 0/3] ACPI: EC/Button drivers clean up and correct gpe's sysfs attribute

2013-09-12 Thread tianyu . lan
The patch 1-2 are to clean up EC/Button drivers' code. The patch 3 is to correct the process of abnormal param for gpe sysfs attribute. drivers/acpi/button.c | 9 +++-- drivers/acpi/ec.c | 49 - drivers/acpi/sysfs.c | 9 +++-- 3 files

[PATCH 1/3] ACPI/Button: Using input_set_capability() to mark device's event capability

2013-09-12 Thread tianyu . lan
From: Lan Tianyu Input layer provides input_set_capability() to set input device's event related bits. This patch is to use it to replace origin code. Signed-off-by: Lan Tianyu --- drivers/acpi/button.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/b

[PATCH 2/3] ACPI/EC: Convert all printk to dynamic debug function

2013-09-12 Thread tianyu . lan
From: Lan Tianyu This patch is to convert all printks in the ec driver to pr_debug/info/err and define pr_fmt macro to replace PREFIX. Signed-off-by: Lan Tianyu --- drivers/acpi/ec.c | 49 - 1 file changed, 24 insertions(+), 25 deletions(-) diff

[PATCH 3/3] ACPI/Sys: make gpe's sysfs attribute only accept correct value

2013-09-12 Thread tianyu . lan
From: Lan Tianyu According to design, gpe's sysfs attribute should accept "disable", "enable", "clear" and integer number as params. Current code checks "disable", "enable" and "clear" first. If the param didn't belong to previous kinds, pass the param to strtoul as a string of integer number and

[PATCH v2 0/5] ACPI: Remove unused files and directories under /proc/acpi

2013-10-10 Thread tianyu . lan
This patchset is to remove AC/Battery directories and alarm file under /proc/acpi drivers/acpi/Kconfig | 17 -- drivers/acpi/Makefile| 1 - drivers/acpi/ac.c| 128 + drivers/acpi/battery.c

[PATCH 2/5] ACPI/Battery: Remove battery's proc directory

2013-10-10 Thread tianyu . lan
From: Lan Tianyu The battery's proc directory isn't useded and remove it. Signed-off-by: Lan Tianyu --- drivers/acpi/battery.c | 328 + 1 file changed, 1 insertion(+), 327 deletions(-) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c

[PATCH 1/5] ACPI/AC: Remove AC's proc directory.

2013-10-10 Thread tianyu . lan
From: Lan Tianyu AC's proc directory is not used and so remove it. Prepare for removing /proc/acpi directory. Signed-off-by: Lan Tianyu --- drivers/acpi/ac.c | 128 +- 1 file changed, 2 insertions(+), 126 deletions(-) diff --git a/drivers/ac

[PATCH 3/5] ACPI/SBS: Remove SBS's proc directory

2013-10-10 Thread tianyu . lan
From: Lan Tianyu SBS's proc directory isn't useded and so remove it. Prepare for removing /proc/acpi directory. Signed-off-by: Lan Tianyu --- drivers/acpi/sbs.c | 325 + 1 file changed, 4 insertions(+), 321 deletions(-) diff --git a/drivers/

[PATCH 5/5] ACPI/Proc: Remove alarm proc file

2013-10-10 Thread tianyu . lan
From: Lan Tianyu Alarm proc file provides the info and control of RTC-CMOS alarm and RTC CMOS driver provides wakealarm sysfs attribute for the same purpose. The alarm file isn't compiled into kernel when RTC CMOS driver is selected. The driver is default to be selected for x86 platform. So alarm

[PATCH 4/5] ACPI: Remove CONFIG_ACPI_PROCFS_POWER and cm_sbsc.c

2013-10-10 Thread tianyu . lan
From: Lan Tianyu There is no user of cm_sbs.c and CONFIG_ACPI_PROCFS_POWER. So remove them. Prepare for removing /proc/acpi Signed-off-by: Lan Tianyu --- drivers/acpi/Kconfig | 17 drivers/acpi/Makefile | 1 - drivers/acpi/cm_sbs.c | 105 ---

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

2018-08-05 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: > >58e

[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 +- arch/x8

[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 a

[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 t

[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 w

[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 kvm_arch_flush_remote_

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 >> overh

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

[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. ar

[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 index

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

[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 --- a/arch

[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 changed,

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] 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
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/

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

2018-01-28 Thread Tianyu Lan
deassign 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 re

[Patch] KVM/x86: Fix wrong macro references of X86_CR0_PG_BIT and X86_CR4_PAE_BIT in kvm_valid_sregs()

2018-01-16 Thread Tianyu Lan
-off-by: Tianyu Lan --- 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/x86.c @@ -7496,13 +7496,13 @@ EXPORT_SYMBOL_GPL(kvm_task_switch

[Resend Patch] KVM/x86: Fix wrong macro references of X86_CR0_PG_BIT and X86_CR4_PAE_BIT in kvm_valid_sregs()

2018-01-16 Thread Tianyu Lan
-off-by: Tianyu Lan --- Sorry for noise. Missed kvm maillist. 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/x86.c @@ -7496,13 +7496,13

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

2018-04-12 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 MS

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: 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 --- a/arch/x86/kvm/x

[PATCH V3 5/13] KVM/MMU: Flush tlb directly in the kvm_zap_gfn_range()

2018-09-26 Thread Tianyu Lan
Originally, flush tlb is done by slot_handle_level_range(). This patch is to flush tlb directly in the kvm_zap_gfn_range() when range flush is available. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/x8

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

2018-09-26 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 wi

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

2018-09-26 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 --- Change since v1: Change "end_gfn" to "pages" to aviod

[PATCH V3 6/13] KVM/MMU: Flush tlb directly in kvm_mmu_zap_collapsible_spte()

2018-09-26 Thread Tianyu Lan
kvm_mmu_zap_collapsible_spte() returns flush request to the slot_handle_leaf() and the latter does flush on demand. When range flush is available, make kvm_mmu_zap_collapsible_spte() to flush tlb with range directly to avoid returning range back to slot_handle_leaf(). Signed-off-by: Lan Tianyu --

[PATCH V3 10/13] x86/hyper-v: Add HvFlushGuestAddressList hypercall support

2018-09-26 Thread Tianyu Lan
Hyper-V provides HvFlushGuestAddressList() hypercall to flush EPT tlb with specified ranges. This patch is to add the hypercall support. Signed-off-by: Lan Tianyu --- Change since v2: Fix some coding style issues - Move HV_MAX_FLUSH_PAGES and HV_MAX_FLUSH_REP_COUNT to hyperv

[PATCH V3 3/13] KVM: Replace old tlb flush function with new one to flush a specified range.

2018-09-26 Thread Tianyu Lan
This patch is to replace kvm_flush_remote_tlbs() with kvm_flush_ remote_tlbs_with_address() in some functions without logic change. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 33 ++--- arch/x86/kvm/paging_tmpl.h | 3 ++- 2 files changed, 24 insertions

[PATCH V3 12/13] KVM/VMX: Change hv flush logic when ept tables are mismatched.

2018-09-26 Thread Tianyu Lan
If ept table pointers are mismatched, flushing tlb for each vcpus via hv flush interface still helps to reduce vmexits which are triggered by IPI and INEPT emulation. Signed-off-by: Lan Tianyu --- arch/x86/kvm/vmx.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --gi

[PATCH V3 11/13] x86/Hyper-v: Add trace in the hyperv_nested_flush_guest_mapping_range()

2018-09-26 Thread Tianyu Lan
This patch is to trace log in the hyperv_nested_flush_ guest_mapping_range(). Signed-off-by: Lan Tianyu --- arch/x86/hyperv/nested.c| 1 + arch/x86/include/asm/trace/hyperv.h | 14 ++ 2 files changed, 15 insertions(+) diff --git a/arch/x86/hyperv/nested.c b/arch/x86/hyp

[PATCH V3 13/13] KVM/VMX: Add hv tlb range flush support

2018-09-26 Thread Tianyu Lan
This patch is to register tlb_remote_flush_with_range callback with hv tlb range flush interface. Signed-off-by: Lan Tianyu --- Change since v1: Pass flush range with new hyper-v tlb flush struct rather than KVM tlb flush struct. --- arch/x86/kvm/vmx.c | 58 +++

[PATCH V3 8/13] KVM: Add spte's point in the struct kvm_mmu_page

2018-09-26 Thread Tianyu Lan
It's necessary to check whether mmu page is last or large page when add mmu page into flush list. "spte" is needed for such check and so add spte point in the struct kvm_mmu_page. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/mmu.c | 5 + arch

[PATCH V3 9/13] KVM/MMU: Replace tlb flush function with range list flush function

2018-09-26 Thread Tianyu Lan
This patch is to use range list flush function in the mmu_sync_children(), kvm_mmu_commit_zap_page() and FNAME(sync_page)(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 26 +++--- arch/x86/kvm/paging_tmpl.h | 5 - 2 files changed, 27 insertions(+), 4 delet

[PATCH V3 7/13] KVM: Add flush_link and parent_pte in the struct kvm_mmu_page

2018-09-26 Thread Tianyu Lan
PV EPT tlb flush function will accept a list of flush ranges and use struct kvm_mmu_page as the list entry. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index a6

[PATCH V3 4/13] KVM/MMU: Flush tlb directly in the kvm_handle_hva_range()

2018-09-26 Thread Tianyu Lan
This patch is to flush tlb directly in the kvm_handle_hva_range() when range flush is available. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d10d8423e8d6..877edae0401f 100644 --- a/arch/

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

2018-09-26 Thread Tianyu Lan
This patch is to add wrapper functions for tlb_remote_flush_with_range callback. Signed-off-by: Lan Tianyu --- Change since V2: Fix comment in the kvm_flush_remote_tlbs_with_range() --- arch/x86/kvm/mmu.c | 48 1 file changed, 48 insertions

Re: [PATCH V3 10/13] x86/hyper-v: Add HvFlushGuestAddressList hypercall support

2018-09-26 Thread Tianyu Lan
On 9/27/2018 12:16 PM, Michael Kelley (EOSG) wrote: > From: Tianyu Lan Sent: Wednesday, September 26, 2018 8:50 PM >> >> Hyper-V provides HvFlushGuestAddressList() hypercall to flush EPT tlb >> with specified ranges. This patch is to add the hypercall support. >> &

[PATCH] KVM/VMX: Remve unused function is_external_interrupt().

2018-09-28 Thread Tianyu Lan
is_external_interrupt() is not used now and so remove it. Signed-off-by: Lan Tianyu --- arch/x86/kvm/vmx.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 70e1f916bfc9..619307b3e6bb 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@

[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 w

[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 +- arch/x8

[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 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 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 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 w

[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 +- arch/x8

[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 f

[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 identical_ept_pointe

[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 a

[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 t

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

2018-07-10 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 3/4] KVM/VMX: Add identical ept table pointer check

2018-07-03 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 >> of single

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

2018-07-03 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: [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
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: [Resend PATCH V5 7/10] KVM: Make kvm_set_spte_hva() return int

2018-12-12 Thread Tianyu Lan
OK. Thanks for suggestion and will update in the next version. > > > Signed-off-by: Lan Tianyu > > For the powerpc bits: > > Acked-by: Paul Mackerras -- Best regards Tianyu Lan

Re: [PATCH V2 1/2] KVM/VMX: Check ept_pointer before flushing ept tlb

2018-12-17 Thread Tianyu Lan
; @@ -11614,6 +11621,8 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm > > *kvm, unsigned int id) > > vmx->pi_desc.nv = POSTED_INTR_VECTOR; > > vmx->pi_desc.sn = 1; > > > > + vmx->ept_pointer = INVALID_PAGE; > > + > > return &vmx->vcpu; > > > > free_vmcs: > > > -- Best regards Tianyu Lan

Re: [PATCH 11/11] KVM/MMU: Flush tlb in the kvm_age_rmapp()

2019-01-06 Thread Tianyu Lan
platforms still need the flush in the kvm_mmu_notifier_clear_flush_young(). I think it's better to separate flush request and "young" from return value of kvm_age_hva(). New flush parameter I added in the patch 10 can be changed to a pointer and kvm_age_hva() can use it to return flush request. -- Best regards Tianyu Lan

Re: [PATCH 6/11] KVM/MMU: Flush tlb with range list in sync_page()

2019-01-06 Thread Tianyu Lan
kvm); > > + kvm_flush_remote_tlbs_with_list(vcpu->kvm, &flush_list); > > This is a bit confusing and potentially fragile. It's not obvious that > kvm_flush_remote_tlbs_with_list() is guaranteed to call > kvm_flush_remote_tlbs() when kvm_available_flush_tlb_with_range() is > false, and you're relying on the kvm_flush_remote_tlbs_with_list() call > chain to never optimize away the empty list case. Rechecking > kvm_available_flush_tlb_with_range() isn't expensive. That makes sense. Will update. Thanks. > > > > > return nr_present; > > } > > -- > > 2.14.4 > > -- Best regards Tianyu Lan

Re: [PATCH 11/11] KVM/MMU: Flush tlb in the kvm_age_rmapp()

2019-01-07 Thread Tianyu Lan
Hi Paolo: Thanks for your review. On Tue, Jan 8, 2019 at 12:31 AM Paolo Bonzini wrote: > > On 07/01/19 04:42, Tianyu Lan wrote: > >> I'm assuming you're > >> clearing young to avoid the flush in kvm_mmu_notifier_clear_flush_young(), > >&g

Re: [PATCH] KVM/VMX: Check ept_pointer before flushing ept tlb

2018-11-06 Thread Tianyu Lan
Hi Vitaly: Thanks for your review. On 11/6/2018 11:50 PM, Vitaly Kuznetsov wrote: ltyker...@gmail.com writes: From: Lan Tianyu This patch is to initialize ept_pointer to INVALID_PAGE and check it before flushing ept tlb. If ept_pointer is invalidated, bypass the flush request. Signe

Re: [PATCH] KVM/VMX: Check ept_pointer before flushing ept tlb

2018-11-07 Thread Tianyu Lan
On 11/7/2018 6:49 PM, Vitaly Kuznetsov wrote: Tianyu Lan writes: Hi Vitaly: Thanks for your review. On 11/6/2018 11:50 PM, Vitaly Kuznetsov wrote: ltyker...@gmail.com writes: From: Lan Tianyu This patch is to initialize ept_pointer to INVALID_PAGE and check it before flushing

Re: [PATCH] KVM: vmx: hyper-v: don't pass EPT configuration info to vmx_hv_remote_flush_tlb()

2018-10-11 Thread Tianyu Lan
SS_SPACE hypercall needs the address of > the > +* base of EPT PML4 table, strip off EPT configuration information. > +*/ > ret = hyperv_flush_guest_mapping( > - to_vmx(kvm_get_vcpu(kvm, 0))->ept_pointer); > + to_vmx(kvm_get_vcpu(kvm, 0))->ept_pointer & > PAGE_MASK); > > out: > spin_unlock(&to_kvm_vmx(kvm)->ept_pointer_lock); > -- > 2.17.1 > -- Best regards Tianyu Lan

Re: [PATCH] KVM: vmx: hyper-v: don't pass EPT configuration info to vmx_hv_remote_flush_tlb()

2018-10-11 Thread Tianyu Lan
On Thu, Oct 11, 2018 at 8:18 PM Vitaly Kuznetsov wrote: > > Tianyu Lan writes: > > > On Thu, Oct 11, 2018 at 6:32 PM Vitaly Kuznetsov > > wrote: > >> > >> I'm observing random crashes in multi-vCPU L2 guests running on KVM on > >> Hyper-V.

Re: [PATCH] KVM: vmx: hyper-v: don't pass EPT configuration info to vmx_hv_remote_flush_tlb()

2018-10-11 Thread Tianyu Lan
On Thu, Oct 11, 2018 at 9:00 PM Vitaly Kuznetsov wrote: > > Tianyu Lan writes: > > > On Thu, Oct 11, 2018 at 8:18 PM Vitaly Kuznetsov > > wrote: > >> > >> Tianyu Lan writes: > >> > >> > On Thu, Oct 11, 2018 at 6:32 PM Vitaly Ku

Re: [PATCH V4 7/15] KVM/MMU: Flush tlb directly in the kvm_zap_gfn_range()

2018-10-15 Thread Tianyu Lan
gt; } > > } > > > > + if (flush && kvm_available_flush_tlb_with_range()) > > + kvm_flush_remote_tlbs_with_address(kvm, gfn_start, > > + gfn_end - gfn_start + 1); > > + > > ... and this can be just if (flush), because if flush_tlb is true then > slot_handle_level_range always returns false. OK. Will update. -- Best regards Tianyu Lan

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

2018-10-08 Thread Tianyu Lan
Hi Paolo: Thanks for your review. Sorry for later response due to holiday. On Mon, Oct 1, 2018 at 11:26 PM Paolo Bonzini wrote: > > On 27/09/2018 05:48, Tianyu Lan wrote: > > + > > + if (range && kvm_x86_ops-&g

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

2018-09-17 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 --- Change since v1: Change "end_gfn" to "pages" to aviod

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

2018-09-17 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 c67f09086378..ac3b

[PATCH V2 5/13] KVM/MMU: Flush tlb directly in the kvm_zap_gfn_range()

2018-09-17 Thread Tianyu Lan
Originally, flush tlb is done by slot_handle_level_range(). This patch is to flush tlb directly in the kvm_zap_gfn_range() when range flush is available. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/x8

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

2018-09-17 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 V2 6/13] KVM/MMU: Flush tlb directly in kvm_mmu_zap_collapsible_spte()

2018-09-17 Thread Tianyu Lan
kvm_mmu_zap_collapsible_spte() returns flush request to the slot_handle_leaf() and the latter does flush on demand. When range flush is available, make kvm_mmu_zap_collapsible_spte() to flush tlb with range directly to avoid returning range back to slot_handle_leaf(). Signed-off-by: Lan Tianyu --

[PATCH V2 3/13] KVM: Replace old tlb flush function with new one to flush a specified range.

2018-09-17 Thread Tianyu Lan
This patch is to replace kvm_flush_remote_tlbs() with kvm_flush_ remote_tlbs_with_address() in some functions without logic change. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 33 ++--- arch/x86/kvm/paging_tmpl.h | 3 ++- 2 files changed, 24 insertions

[PATCH V2 4/13] KVM/MMU: Flush tlb directly in the kvm_handle_hva_range()

2018-09-17 Thread Tianyu Lan
This patch is to flush tlb directly in the kvm_handle_hva_range() when range flush is available. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 822e170881a4..dfd2a0710417 100644 --- a/arch/

[PATCH V2 10/13] x86/hyper-v: Add HvFlushGuestAddressList hypercall support

2018-09-17 Thread Tianyu Lan
Hyper-V provides HvFlushGuestAddressList() hypercall to flush EPT tlb with specified ranges. This patch is to add the hypercall support. Signed-off-by: Lan Tianyu --- Change since v1: Add hyperv tlb flush struct to avoid use kvm tlb flush struct in the hyperv file. --- arch/x86/hyperv/nes

[PATCH V2 11/13] x86/Hyper-v: Add trace in the hyperv_nested_flush_guest_mapping_range()

2018-09-17 Thread Tianyu Lan
This patch is to trace log in the hyperv_nested_flush_ guest_mapping_range(). Signed-off-by: Lan Tianyu --- arch/x86/hyperv/nested.c| 1 + arch/x86/include/asm/trace/hyperv.h | 14 ++ 2 files changed, 15 insertions(+) diff --git a/arch/x86/hyperv/nested.c b/arch/x86/hyp

[PATCH V2 12/13] KVM/VMX: Change hv flush logic when ept tables are mismatched.

2018-09-17 Thread Tianyu Lan
If ept table pointers are mismatched, flushing tlb for each vcpus via hv flush interface still helps to reduce vmexits which are triggered by IPI and INEPT emulation. Signed-off-by: Lan Tianyu --- arch/x86/kvm/vmx.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --gi

[PATCH V2 8/13] KVM: Add spte's point in the struct kvm_mmu_page

2018-09-17 Thread Tianyu Lan
It's necessary to check whether mmu page is last or large page when add mmu page into flush list. "spte" is needed for such check and so add spte point in the struct kvm_mmu_page. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/mmu.c | 5 + arch

[PATCH V2 13/13] KVM/VMX: Add hv tlb range flush support

2018-09-17 Thread Tianyu Lan
This patch is to register tlb_remote_flush_with_range callback with hv tlb range flush interface. Signed-off-by: Lan Tianyu --- Change since v1: Pass flush range with new hyper-v tlb flush struct rather than KVM tlb flush struct. --- arch/x86/kvm/vmx.c | 58 +++

[PATCH V2 9/13] KVM/MMU: Replace tlb flush function with range list flush function

2018-09-17 Thread Tianyu Lan
This patch is to use range list flush function in the mmu_sync_children(), kvm_mmu_commit_zap_page() and FNAME(sync_page)(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 26 +++--- arch/x86/kvm/paging_tmpl.h | 5 - 2 files changed, 27 insertions(+), 4 delet

[PATCH V2 7/13] KVM: Add flush_link and parent_pte in the struct kvm_mmu_page

2018-09-17 Thread Tianyu Lan
PV EPT tlb flush function will accept a list of flush ranges and use struct kvm_mmu_page as the list entry. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index a6

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

2018-07-17 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 a/arch

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 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; >> +

[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 w

  1   2   3   >