[tip:x86/urgent] x86/hyper-v: Fix definition of HV_MAX_FLUSH_REP_COUNT

2019-02-28 Thread tip-bot for Lan Tianyu
Commit-ID: 9cd05ad2910b55238e3c720c99ad896dc538301b Gitweb: https://git.kernel.org/tip/9cd05ad2910b55238e3c720c99ad896dc538301b Author: Lan Tianyu AuthorDate: Mon, 25 Feb 2019 22:31:14 +0800 Committer: Thomas Gleixner CommitDate: Thu, 28 Feb 2019 11:58:29 +0100 x86/hyper-v: Fix

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

2018-01-18 Thread Lan Tianyu
Hi Eric: Great thanks for your review. On Thu, Jan 18, 2018 at 10:39:04AM -0800, Eric Biggers wrote: > On Tue, Jan 16, 2018 at 05:34:07PM +0800, Tianyu Lan wrote: > > kvm_valid_sregs() should use X86_CR0_PG and X86_CR4_PAE to check bit > > status rather than X86_CR0_PG_BIT and X86_CR4_PAE_B

[PATCH V2] KVM/Eventfd: Avoid crash when assign and deassign specific eventfd in parallel.

2017-12-22 Thread Lan Tianyu
Syzroot reports crash in kvm_irqfd_assign() is caused by use-after-free. Because kvm_irqfd_assign() and kvm_irqfd_deassign() can't run in parallel for one specific eventfd. When assign path hasn't been finished after irqfd has been added to kvm->irqfds.items list, another thead may deassign the eve

Re: [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs()

2017-12-20 Thread Lan Tianyu
On 2017年12月21日 08:30, Paolo Bonzini wrote: > On 21/12/2017 01:24, Eric Biggers wrote: >> From: Eric Biggers >> >> Due to a bad merge resolution between commit f29810335965 ("KVM/x86: >> Check input paging mode when cs.l is set") and commit b4ef9d4e8cb8 >> ("KVM: Move vcpu_load to arch-specific kvm

Re: [PATCH] KVM/Eventfd: Avoid crash when assign and deassign same eventfd in parallel.

2017-12-20 Thread Lan Tianyu
On 2017年12月19日 18:41, Paolo Bonzini wrote: > On 19/12/2017 07:35, Lan Tianyu wrote: >> On 2017年12月18日 16:50, Paolo Bonzini wrote: >>> On 18/12/2017 09:30, David Hildenbrand wrote: >>>> The ugly thing in kvm_irqfd_assign() is that we access irqfd without >>&g

Re: [PATCH] KVM/Eventfd: Avoid crash when assign and deassign same eventfd in parallel.

2017-12-18 Thread Lan Tianyu
On 2017年12月18日 16:50, Paolo Bonzini wrote: > On 18/12/2017 09:30, David Hildenbrand wrote: >> The ugly thing in kvm_irqfd_assign() is that we access irqfd without >> holding a lock. I think that should rather be fixed than working around >> that issue. (e.g. lock() -> lookup again -> verify still i

Re: [PATCH] KVM/Eventfd: Avoid crash when assign and deassign same eventfd in parallel.

2017-12-18 Thread Lan Tianyu
Hi David: Thanks for your review. On 2017年12月18日 16:30, David Hildenbrand wrote: > On 18.12.2017 00:40, Lan Tianyu wrote: >> Syzroot reports crash in kvm_irqfd_assign() is caused by use-after-free. >> Because kvm_irqfd_assign() and kvm_irqfd_deassign() can't run in

[PATCH] KVM/Eventfd: Avoid crash when assign and deassign same eventfd in parallel.

2017-12-17 Thread Lan Tianyu
Syzroot reports crash in kvm_irqfd_assign() is caused by use-after-free. Because kvm_irqfd_assign() and kvm_irqfd_deassign() can't run in parallel for same eventfd. When assign path hasn't been finished after irqfd has been added to kvm->irqfds.items list, another thead may deassign the eventfd and

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

2017-12-16 Thread Lan, Tianyu
The root cause is that kvm_irqfd_assign() and kvm_irqfd_deassign() can't be run in parallel. Some data structure(e.g, irqfd->consumer) will be crashed because irqfd may be freed in deassign path before they are used in assign path. The other data maybe used in deassign path before initialization.

Re: [PATCH V2] KVM/x86: Check input paging mode when cs.l is set

2017-12-14 Thread Lan, Tianyu
On 12/14/2017 7:41 PM, Paolo Bonzini wrote: On 14/12/2017 04:55, Lan Tianyu wrote: +* When EFER.LME and CR0.PG are set, CR4.PAE and EFER.LMA +* must be set. +*/ + if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG_BIT)) { +

[PATCH V3] KVM/x86: Check input paging mode when cs.l is set

2017-12-14 Thread Lan Tianyu
Reported by syzkaller: WARNING: CPU: 0 PID: 27962 at arch/x86/kvm/emulate.c:5631 x86_emulate_insn+0x557/0x15f0 [kvm] Modules linked in: kvm_intel kvm [last unloaded: kvm] CPU: 0 PID: 27962 Comm: syz-executor Tainted: GB W 4.15.0-rc2-next-20171208+ #32 Hardware name: I

[PATCH V2] KVM/x86: Check input paging mode when cs.l is set

2017-12-14 Thread Lan Tianyu
Reported by syzkaller: WARNING: CPU: 0 PID: 27962 at arch/x86/kvm/emulate.c:5631 x86_emulate_insn+0x557/0x15f0 [kvm] Modules linked in: kvm_intel kvm [last unloaded: kvm] CPU: 0 PID: 27962 Comm: syz-executor Tainted: GB W 4.15.0-rc2-next-20171208+ #32 Hardware name: I

Re: [PATCH 1/1] KVM/x86: Check input paging mode when cs.l is set

2017-12-13 Thread Lan Tianyu
On 2017年12月13日 20:20, Paolo Bonzini wrote: > On 13/12/2017 05:17, Lan Tianyu wrote: >> Reported by syzkaller: >> WARNING: CPU: 0 PID: 27962 at arch/x86/kvm/emulate.c:5631 >> x86_emulate_insn+0x557/0x15f0 [kvm] >> Modules linked in: kvm_intel kvm [last unloa

[PATCH 1/1] KVM/x86: Check input paging mode when cs.l is set

2017-12-13 Thread Lan Tianyu
x27;t have such check when userspace inputs sreg values. This will lead unexpected behavior. This patch is to add such check. Suggested-by: Paolo Bonzini Reported-by: Dmitry Vyukov Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Dmitry Vyukov Cc: Jim Mattson Signed-off-by: Tianyu Lan Signed-off-by

Re: Re: WARNING in x86_emulate_insn

2017-12-12 Thread Lan Tianyu
On 2017年12月12日 06:45, Paolo Bonzini wrote: > On 08/12/2017 09:28, Tianyu Lan wrote: >> I find this is pop instruction emulation issue. According "SDM VOL2, >> chapter INSTRUCTION >> SET REFERENCE. POP—Pop a Value from the Stack" >> >> Protected Mode Exceptions >> #GP(0) If attempt is made to load S

Re: Re: [PATCH] KVM/Emulate: Mask linear address with actual address width in order to avoid conflict with UNMAPPED_GVA

2017-12-11 Thread Lan Tianyu
On 2017年12月12日 14:42, Wanpeng Li wrote: > 2017-12-12 7:23 GMT+08:00 Lan Tianyu : >> >> Reported by syzkaller: >> WARNING: CPU: 0 PID: 27962 at arch/x86/kvm/emulate.c:5631 >> x86_emulate_insn+0x557/0x15f0 [kvm] >> Modules linked in: kvm_intel kvm [last

[PATCH] KVM/Emulate: Mask linear address with actual address width in order to avoid conflict with UNMAPPED_GVA

2017-12-11 Thread Lan Tianyu
ov Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Dmitry Vyukov Cc: Jim Mattson Cc: Wanpeng Li Signed-off-by: Lan Tianyu --- arch/x86/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index abe74f7..9b21412 100644 --- a

Re: Re: WARNING in x86_emulate_insn

2017-12-08 Thread Lan, Tianyu
On 12/8/2017 5:27 PM, Wanpeng Li wrote: 2017-12-08 16:28 GMT+08:00 Tianyu Lan : Hi Jim&Wanpeng: Thanks for your help. 2017-12-08 5:25 GMT+08:00 Jim Mattson : Try disabling the module parameter, "unrestricted_guest." Make sure that the module parameter, "emulate_invalid_guest_state"

Re: [PATCH] KVM/VMX: Avoid CR3 VMEXIT during guest real mode when "unrestricted guest" is supported.

2017-08-16 Thread Lan Tianyu
On 2017年08月16日 17:25, Paolo Bonzini wrote: > On 16/08/2017 03:58, Lan Tianyu wrote: >> These CR3 VMEXITs was introduced for platform without "unrestricted guest" >> support. This is to set ept identity table to guest CR3 in guest real >> mode because these platforms

Re: [PATCH] KVM/VMX: Avoid CR3 VMEXIT during guest real mode when "unrestricted guest" is supported.

2017-08-16 Thread Lan Tianyu
On 2017年08月16日 21:26, Radim Krčmář wrote: > 2017-08-15 21:58-0400, Lan Tianyu: >> These CR3 VMEXITs was introduced for platform without "unrestricted guest" >> support. This is to set ept identity table to guest CR3 in guest real >> mode because these platforms don

[PATCH] KVM/VMX: Avoid CR3 VMEXIT during guest real mode when "unrestricted guest" is supported.

2017-08-16 Thread Lan Tianyu
platforms with "unrestricted guest" support. Signed-off-by: Lan Tianyu --- arch/x86/kvm/vmx.c | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9b21b12..46dcf50 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/

[PATCH V2] KVM/x86: Increase max vcpu number to 8192

2017-08-15 Thread Lan Tianyu
For HPC usage case, it will create a huge VM with vcpus number as same as host cpus and this requires more vcpus support in a single VM. This patch is to increase max vcpu number from 288 to 8192 which is current default maximum cpu number for Linux kernel. Signed-off-by: Lan Tianyu --- arch

Re: [PATCH] KVM/x86: Increase max vcpu number to 352

2017-08-15 Thread Lan Tianyu
On 2017年08月15日 22:10, Konrad Rzeszutek Wilk wrote: > On Tue, Aug 15, 2017 at 11:00:04AM +0800, Lan Tianyu wrote: >> On 2017年08月12日 03:35, Konrad Rzeszutek Wilk wrote: >>> On Fri, Aug 11, 2017 at 03:00:20PM +0200, Radim Krčmář wrote: >>>> 2017-08-11 10:11+020

Re: [PATCH] KVM/x86: Increase max vcpu number to 352

2017-08-14 Thread Lan Tianyu
On 2017年08月12日 03:35, Konrad Rzeszutek Wilk wrote: > On Fri, Aug 11, 2017 at 03:00:20PM +0200, Radim Krčmář wrote: >> 2017-08-11 10:11+0200, David Hildenbrand: >>> On 11.08.2017 09:49, Lan Tianyu wrote: >>>> Hi Konrad: >>>>Thanks for your revi

Re: [PATCH] KVM/x86: Increase max vcpu number to 352

2017-08-11 Thread Lan Tianyu
Hi Konrad: Thanks for your review. On 2017年08月11日 01:50, Konrad Rzeszutek Wilk wrote: > On Thu, Aug 10, 2017 at 06:00:59PM +0800, Lan Tianyu wrote: >> Intel Xeon phi chip will support 352 logical threads. For HPC usage >> case, it will create a huge VM with vcpu number

[PATCH] KVM/x86: Increase max vcpu number to 352

2017-08-10 Thread Lan Tianyu
Intel Xeon phi chip will support 352 logical threads. For HPC usage case, it will create a huge VM with vcpu number as same as host cpus. This patch is to increase max vcpu number to 352. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 5/7] KVM: Replace smp_mb() with smp_load_acquire() in the kvm_flush_remote_tlbs()

2016-03-12 Thread Lan Tianyu
smp_load_acquire() is enough here and it's cheaper than smp_mb(). Adding a comment about reusing memory barrier of kvm_make_all_cpus_request() here to keep order between modifications to the page tables and reading mode. Signed-off-by: Lan Tianyu --- virt/kvm/kvm_main.c

[PATCH 6/7] KVM/x86: update the comment of memory barrier in the vcpu_enter_guest()

2016-03-12 Thread Lan Tianyu
The barrier also orders the write to mode from any reads to the page tables done and so update the comment. Signed-off-by: Lan Tianyu --- arch/x86/kvm/x86.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bcbce0f..4bdb4e6

[PATCH 4/7] KVM/x86: Call smp_wmb() before increasing tlbs_dirty

2016-03-12 Thread Lan Tianyu
Update spte before increasing tlbs_dirty to make sure no tlb flush in lost after spte is zapped. This pairs with the barrier in the kvm_flush_remote_tlbs(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/paging_tmpl.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kvm

[PATCH 7/7] KVM/PPC: update the comment of memory barrier in the kvmppc_prepare_to_enter()

2016-03-12 Thread Lan Tianyu
The barrier also orders the write to mode from any reads to the page tables done and so update the comment. Signed-off-by: Lan Tianyu --- arch/powerpc/kvm/powerpc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 19aa59b

[PATCH 1/7] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()

2016-03-12 Thread Lan Tianyu
There is already a barrier inside of kvm_flush_remote_tlbs() which can help to make sure everyone sees our modifications to the page tables and see changes to vcpu->mode here. So remove the smp_mb in the kvm_mmu_commit_zap_page() and update the comment. Signed-off-by: Lan Tianyu --- arch/

[PATCH 2/7] KVM/x86: Replace smp_mb() with smp_store_mb/release() in the walk_shadow_page_lockless_begin/end()

2016-03-12 Thread Lan Tianyu
Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 5e795af..d1ee68c 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -632,12 +632,12 @@ static void

[PATCH 3/7] KVM: Replace smp_mb() with smp_mb_after_atomic() in the kvm_make_all_cpus_request()

2016-03-12 Thread Lan Tianyu
Signed-off-by: Lan Tianyu --- virt/kvm/kvm_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 1eae052..ec5aa8d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -170,8 +170,8 @@ bool kvm_make_all_cpus_request

[PATCH 0/7] KVM/X86/PPC: Clear up kvm mmu memory barriers and update related comments

2016-03-12 Thread Lan Tianyu
This series is to clear up kvm mmu memory barriers. 1) Remove redundant barrier (PATCH 1) 2) Replace origin barrier functions with preferrable ones (PATCH 2, 3, 5) 3) Fix unpaired barriers (PATCH 4) 4) Update or add barrier related comments (PATCH 6, 7) Lan Tianyu (7): KVM: Remove redundant

Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()

2016-03-10 Thread Lan Tianyu
On 2016年03月10日 23:26, Paolo Bonzini wrote: > > > On 10/03/2016 15:40, Xiao Guangrong wrote: >> long dirty_count = kvm->tlbs_dirty; >> >> +/* >> + * read tlbs_dirty before doing tlb flush to make sure not tlb >> request is >> + * lost. >> + */ >> smp_mb();

Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()

2016-03-08 Thread Lan Tianyu
On 2016年03月08日 23:27, Paolo Bonzini wrote: > Unfortunately that patch added a bad memory barrier: 1) it lacks a > comment; 2) it lacks obvious pairing; 3) it is an smp_mb() after a read, > so it's not even obvious that this memory barrier has to do with the > immediately preceding read of kvm->tlbs

Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()

2016-03-08 Thread Lan Tianyu
On 2016年03月04日 16:49, Paolo Bonzini wrote: > On 04/03/2016 08:12, Lan Tianyu wrote: >>>>/* >>>> - * wmb: make sure everyone sees our modifications to the page tables >>>> - * rmb: make sure we see changes to vcpu->mode >>> >>>

Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()

2016-03-03 Thread Lan Tianyu
On 2016年03月04日 15:21, Thomas Gleixner wrote: > On Fri, 4 Mar 2016, Lan Tianyu wrote: > >> The following kvm_flush_remote_tlbs() will call smp_mb() inside and so >> remove smp_mb() here. >> >> Signed-off-by: Lan Tianyu >> --- >> arch/x86/kvm/mmu.c

[PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()

2016-03-03 Thread Lan Tianyu
The following kvm_flush_remote_tlbs() will call smp_mb() inside and so remove smp_mb() here. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index a54ecd9..6315416 100644 --- a/arch/x86/kvm/mmu.c

Re: [PATCH] KVM: Replace the number of page entries per page with PT64_ENT_PER_PAGE macro

2016-03-01 Thread Lan, Tianyu
Sorry. Miss some other modifications and please ignore this version. On 3/1/2016 10:49 PM, Lan Tianyu wrote: This patch is to make code more readable. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/mmu.c | 2 +- 2 files changed, 2

[PATCH] KVM: Replace the number of page entries per page with PT64_ENT_PER_PAGE macro

2016-03-01 Thread Lan Tianyu
This patch is to make code more readable. Signed-off-by: Lan Tianyu --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/mmu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 44adbb8

Re: [RFC PATCH V2 0/3] IXGBE/VFIO: Add live migration support for SRIOV NIC

2015-12-09 Thread Lan, Tianyu
On 12/9/2015 7:28 PM, Michael S. Tsirkin wrote: I remember reading that it's possible to implement a bus driver on windows if required. But basically I don't see how windows can be relevant to discussing guest driver patches. That discussion probably belongs on the qemu maling list, not on lkml.

Re: [RFC PATCH V2 0/3] IXGBE/VFIO: Add live migration support for SRIOV NIC

2015-12-09 Thread Lan, Tianyu
On 12/9/2015 6:37 PM, Michael S. Tsirkin wrote: On Sat, Dec 05, 2015 at 12:32:00AM +0800, Lan, Tianyu wrote: Hi Michael & Alexander: Thanks a lot for your comments and suggestions. It's nice that it's appreciated, but you then go on and ignore all that I have written here: ht

Re: [RFC PATCH V2 0/3] IXGBE/VFIO: Add live migration support for SRIOV NIC

2015-12-09 Thread Lan, Tianyu
On 12/8/2015 1:12 AM, Alexander Duyck wrote: On Mon, Dec 7, 2015 at 7:40 AM, Lan, Tianyu wrote: On 12/5/2015 1:07 AM, Alexander Duyck wrote: We still need to support Windows guest for migration and this is why our patches keep all changes in the driver since it's impossible to c

Re: [RFC PATCH V2 0/3] IXGBE/VFIO: Add live migration support for SRIOV NIC

2015-12-07 Thread Lan, Tianyu
On 12/5/2015 1:07 AM, Alexander Duyck wrote: We still need to support Windows guest for migration and this is why our patches keep all changes in the driver since it's impossible to change Windows kernel. That is a poor argument. I highly doubt Microsoft is interested in having to modify all

Re: [RFC PATCH V2 0/3] IXGBE/VFIO: Add live migration support for SRIOV NIC

2015-12-04 Thread Lan, Tianyu
Hi Michael & Alexander: Thanks a lot for your comments and suggestions. We still need to support Windows guest for migration and this is why our patches keep all changes in the driver since it's impossible to change Windows kernel. Following is my idea to do DMA tracking. Inject event to VF

Re: [RFC PATCH V2 0/3] IXGBE/VFIO: Add live migration support for SRIOV NIC

2015-12-01 Thread Lan, Tianyu
On 12/1/2015 12:07 AM, Alexander Duyck wrote: They can only be corrected if the underlying assumptions are correct and they aren't. Your solution would have never worked correctly. The problem is you assume you can keep the device running when you are migrating and you simply cannot. At some

Re: [RFC PATCH V2 0/3] IXGBE/VFIO: Add live migration support for SRIOV NIC

2015-11-29 Thread Lan, Tianyu
On 11/26/2015 11:56 AM, Alexander Duyck wrote: > I am not saying you cannot modify the drivers, however what you are doing is far too invasive. Do you seriously plan on modifying all of the PCI device drivers out there in order to allow any device that might be direct assigned to a port to suppo

Re: [RFC PATCH V2 3/3] Ixgbevf: Add migration support for ixgbevf driver

2015-11-25 Thread Lan, Tianyu
On 11/25/2015 8:28 PM, Michael S. Tsirkin wrote: Frankly, I don't really see what this short term hack buys us, and if it goes in, we'll have to maintain it forever. The framework of how to notify VF about migration status won't be changed regardless of stopping VF or not before doing migratio

Re: [RFC PATCH V2 0/3] IXGBE/VFIO: Add live migration support for SRIOV NIC

2015-11-25 Thread Lan Tianyu
On 2015年11月25日 13:30, Alexander Duyck wrote: > No, what I am getting at is that you can't go around and modify the > configuration space for every possible device out there. This > solution won't scale. PCI config space regs are emulation by Qemu and so We can find the free PCI config space regs

Re: [RFC PATCH V2 3/3] Ixgbevf: Add migration support for ixgbevf driver

2015-11-24 Thread Lan Tianyu
On 2015年11月25日 05:20, Michael S. Tsirkin wrote: > I have to say, I was much more interested in the idea > of tracking dirty memory. I have some thoughts about > that one - did you give up on it then? No, our finial target is to keep VF active before doing migration and tracking dirty memory is ess

Re: [RFC PATCH V2 0/3] IXGBE/VFIO: Add live migration support for SRIOV NIC

2015-11-24 Thread Lan Tianyu
On 2015年11月24日 22:20, Alexander Duyck wrote: > I'm still not a fan of this approach. I really feel like this is > something that should be resolved by extending the existing PCI hot-plug > rather than trying to instrument this per driver. Then you will get the > goodness for multiple drivers and

[RFC PATCH V2 3/3] Ixgbevf: Add migration support for ixgbevf driver

2015-11-24 Thread Lan Tianyu
), mailbox irq won't be triggered and VF driver will disable it via PCI_VF_MIGRATION_CAP reg. These case will be resolved later. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 5 ++ drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 102

[RFC PATCH V2 2/3] PCI: Add macros for faked PCI migration capability

2015-11-24 Thread Lan Tianyu
migration status in the reg *PCI_VF_MIGRATION_VF_STATUS VF driver tells Qemu ready for migration *PCI_VF_MIGRATION_IRQ VF driver stores mailbox interrupt vector in the reg for Qemu to trigger during migration. Signed-off-by: Lan Tianyu --- include/uapi/linux/pci_regs.h | 18 +- 1 file

[RFC PATCH V2 1/3] VFIO: Add new ioctl cmd VFIO_GET_PCI_CAP_INFO

2015-11-24 Thread Lan Tianyu
This patch is to add new ioctl cmd VFIO_GET_PCI_CAP_INFO to get PCI cap table size and get free PCI config space regs according pos and size. Qemu will add faked PCI capability for migration and need such info. Signed-off-by: Lan Tianyu --- drivers/vfio/pci/vfio_pci.c | 21

[RFC PATCH V2 0/3] IXGBE/VFIO: Add live migration support for SRIOV NIC

2015-11-24 Thread Lan Tianyu
n nic before migration and put up again on the target machine. Lan Tianyu (3): VFIO: Add new ioctl cmd VFIO_GET_PCI_CAP_INFO PCI: Add macros for faked PCI migration capability Ixgbevf: Add migration support for ixgbevf driver drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 5 ++ driver

Re: [RFC Patch 00/12] IXGBE: Add live migration support for SRIOV NIC

2015-10-29 Thread Lan Tianyu
On 2015年10月30日 00:17, Alexander Duyck wrote: > On 10/29/2015 01:33 AM, Lan Tianyu wrote: >> On 2015年10月29日 14:58, Alexander Duyck wrote: >>> Your code was having to do a bunch of shuffling in order to get things >>> set up so that you could bring the interface back up.

Re: [RFC Patch 00/12] IXGBE: Add live migration support for SRIOV NIC

2015-10-29 Thread Lan Tianyu
On 2015年10月29日 14:58, Alexander Duyck wrote: > > Your code was having to do a bunch of shuffling in order to get things > set up so that you could bring the interface back up. I would argue > that it may actually be faster at least on the bring-up to just drop the > old rings and start over since

Re: [RFC Patch 00/12] IXGBE: Add live migration support for SRIOV NIC

2015-10-28 Thread Lan Tianyu
On 2015年10月26日 23:03, Alexander Duyck wrote: > No. I think you are missing the fact that there are 256 descriptors per > page. As such if you dirty just 1 you will be pulling in 255 more, of > which you may or may not have pulled in the receive buffer for. > > So for example if you have the desc

Re: [RFC Patch 00/12] IXGBE: Add live migration support for SRIOV NIC

2015-10-25 Thread Lan Tianyu
On 2015年10月24日 02:36, Alexander Duyck wrote: > I was thinking about it and I am pretty sure the dummy write approach is > problematic at best. Specifically the issue is that while you are > performing a dummy write you risk pulling in descriptors for data that > hasn't been dummy written to yet.

Re: [RFC Patch 03/12] IXGBE: Add sysfs interface for Qemu to migrate VF status in the PF driver

2015-10-25 Thread Lan, Tianyu
On 10/22/2015 4:45 AM, Alexander Duyck wrote: +/* Record states hold by PF */ +memcpy(&state->vf_data, &adapter->vfinfo[vfn], sizeof(struct vf_data_storage)); + +vf_shift = vfn % 32; +reg_offset = vfn / 32; + +reg = IXGBE_READ_REG(hw, IXGBE_VFTE(reg_offset)); +reg &= ~(1

Re: [RFC Patch 05/12] IXGBE: Add new sysfs interface of "notify_vf"

2015-10-24 Thread Lan, Tianyu
On 10/25/2015 2:03 PM, Alexander Duyck wrote: On 10/24/2015 08:43 AM, Lan, Tianyu wrote: On 10/22/2015 4:52 AM, Alexander Duyck wrote: Also have you even considered the MSI-X configuration on the VF? I haven't seen anything anywhere that would have migrated the VF's MSI-X con

Re: [RFC Patch 08/12] IXGBEVF: Rework code of finding the end transmit desc of package

2015-10-24 Thread Lan, Tianyu
On 10/22/2015 5:14 AM, Alexander Duyck wrote: Where is i being initialized? It was here but you removed it. Are you using i without initializing it? Sorry, the initialization was put into patch 10 by mistake. "i" is assigned with "tx_ring->next_to_clean". -- To unsubscribe from this list: se

Re: [RFC Patch 08/12] IXGBEVF: Rework code of finding the end transmit desc of package

2015-10-24 Thread Lan, Tianyu
On 10/22/2015 8:58 PM, Michael S. Tsirkin wrote: Do you really need to play the shifting games? Can't you just reset everything and re-initialize the rings? It's slower but way less intrusive. Also removes the need to track writes into rings. Shift ring is to avoid losing those packets in the

Re: [RFC Patch 05/12] IXGBE: Add new sysfs interface of "notify_vf"

2015-10-24 Thread Lan, Tianyu
On 10/22/2015 4:52 AM, Alexander Duyck wrote: Also have you even considered the MSI-X configuration on the VF? I haven't seen anything anywhere that would have migrated the VF's MSI-X configuration from BAR 3 on one system to the new system. MSI-X migration is done by Hypervisor(Qemu). Follow

Re: [RFC Patch 01/12] PCI: Add virtfn_index for struct pci_device

2015-10-24 Thread Lan, Tianyu
On 10/22/2015 2:07 AM, Alexander Duyck wrote: On 10/21/2015 09:37 AM, Lan Tianyu wrote: Add "virtfn_index" member in the struct pci_device to record VF sequence of PF. This will be used in the VF sysfs node handle. Signed-off-by: Lan Tianyu --- drivers/pci/iov.c | 1 + inc

[RFC Patch 03/12] IXGBE: Add sysfs interface for Qemu to migrate VF status in the PF driver

2015-10-21 Thread Lan Tianyu
This patch is to add sysfs interface state_in_pf under sysfs directory of VF PCI device for Qemu to get and put VF status in the PF driver during migration. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 156 - 1 file changed, 155

[RFC Patch 09/12] IXGBEVF: Add live migration support for VF driver

2015-10-21 Thread Lan Tianyu
irst entry of the ring and then enable tx/rx rings. VF restarts to receive and transmit from original head desc. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbevf/defines.h | 6 ++ drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 7 +- driver

[RFC Patch 08/12] IXGBEVF: Rework code of finding the end transmit desc of package

2015-10-21 Thread Lan Tianyu
is to replace recording pointer with recording the desc number of the package and find the end decs via the first desc and desc number. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 1 + drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 19 -

[RFC Patch 00/12] IXGBE: Add live migration support for SRIOV NIC

2015-10-21 Thread Lan Tianyu
= So far, the patchset isn't perfect. VF net interface can't be open, closed, down and up during migration. Will prevent such operation during migration in the future job. Very appreciate for your comments. Lan Tianyu (12): PCI: Add virtfn_index for struct pci_device

[RFC Patch 10/12] IXGBEVF: Add lock to protect tx/rx ring operation

2015-10-21 Thread Lan Tianyu
Ring shifting during restoring VF function maybe race with original ring operation(transmit/receive package). This patch is to add tx/rx lock to protect ring related data. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 2 ++ drivers/net/ethernet/intel/ixgbevf

[RFC Patch 12/12] IXGBEVF: Track dma dirty pages

2015-10-21 Thread Lan Tianyu
e and write it back) during receive and transmit data. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/

[RFC Patch 06/12] IXGBEVF: Add self emulation layer

2015-10-21 Thread Lan Tianyu
In order to restore VF function after migration, add self emulation layer to record regs' values during accessing regs. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbevf/Makefile| 3 ++- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 2 +- .../net/ethernet/

[RFC Patch 05/12] IXGBE: Add new sysfs interface of "notify_vf"

2015-10-21 Thread Lan Tianyu
This patch is to add new sysfs interface of "notify_vf" under sysfs directory of VF PCI device for Qemu to notify VF when migration status is changed. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 30 ++ drivers/net/ethernet/i

[RFC Patch 11/12] IXGBEVF: Migrate VF statistic data

2015-10-21 Thread Lan Tianyu
t interface is up or open. Call existed function to update base and saved_reset data to keep statistic data continual during migration. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/int

[RFC Patch 07/12] IXGBEVF: Add new mail box event for migration

2015-10-21 Thread Lan Tianyu
VF status in the PF driver needs to be restored after migration and reset VF hardware. This patch is to add a new event for VF driver to notify PF driver to restore status. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbevf/mbx.h | 3 +++ drivers/net/ethernet/intel/ixgbevf/vf.c

[RFC Patch 01/12] PCI: Add virtfn_index for struct pci_device

2015-10-21 Thread Lan Tianyu
Add "virtfn_index" member in the struct pci_device to record VF sequence of PF. This will be used in the VF sysfs node handle. Signed-off-by: Lan Tianyu --- drivers/pci/iov.c | 1 + include/linux/pci.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/pci/iov.c b/drivers

[RFC Patch 02/12] IXGBE: Add new mail box event to restore VF status in the PF driver

2015-10-21 Thread Lan Tianyu
This patch is to restore VF status in the PF driver when get event from VF. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 40

[RFC Patch 04/12] IXGBE: Add ixgbe_ping_vf() to notify a specified VF via mailbox msg.

2015-10-21 Thread Lan Tianyu
This patch is to add ixgbe_ping_vf() to notify a specified VF. When migration status is changed, it's necessary to notify VF the change. VF driver will check the migrate status when it gets mailbox msg. Signed-off-by: Lan Tianyu --- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

[PATCH] KVM: Avoid warning "user requested TSC rate below hardware speed" when create VM.

2015-06-16 Thread Lan Tianyu
[ 95.090538] [] SyS_ioctl+0x81/0xa0 [ 95.096218] [] system_call_fastpath+0x12/0x76 [ 95.102974] ---[ end trace 08ade884081d9dd7 ]--- Link: https://bugzilla.kernel.org/show_bug.cgi?id=99861 Signed-off-by: Lan Tianyu --- arch/x86/kvm/x86.c | 16 1 file changed, 16 insertions(+) diff

Re: [PATCH] ACPI / osl: add acpi_os_down_wait to avoid a schedule BUG

2015-06-02 Thread Lan Tianyu
On 2015年05月28日 14:33, Pan, XinhuiX wrote: > acpi_os_wait_semaphore can be called in local/hard irq disabled path. like in > cpu up/down callback. > So when dirver try to acquire the semaphore, current code may call down_wait > which might sleep. > Then hit panic as we can't schedule here. So intr

[PATCH] ACPI/EC: Call acpi_walk_dep_device_list() after installing EC opregion handler

2015-03-31 Thread Lan Tianyu
to be attached with its driver. This patch is to fix the issue. Link: https://bugzilla.kernel.org/show_bug.cgi?id=90161 Tested-and-reported-by: Lompik Tested-by: Valentin Lab Signed-off-by: Lan Tianyu --- drivers/acpi/ec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/ec.c b/dr

[PATCH V3] ACPI: Add _DEP(Operation Region Dependencies) support to fix battery issue on the Asus T100TA

2014-11-23 Thread Lan Tianyu
a Westerberg Signed-off-by: Lan Tianyu --- Change since V2: Coding style change Change since V1: Remove redundant blank line and some coding style fixs. drivers/acpi/battery.c | 4 +++ drivers/acpi/scan.c | 85 + drivers/

[PATCH V2] ACPI: Add _DEP(Operation Region Dependencies) support to fix battery issue on the Asus T100TA

2014-11-20 Thread Lan Tianyu
are met and then do acpi_bus_attach() for the device in order to resolve battery _STA issue on the Asus T100TA. Reference: https://bugzilla.kernel.org/show_bug.cgi?id=69011 Tested-by: Jan-Michael Brummer Tested-by: Adam Williamson Tested-by: Michael Shigorin Acked-by: Wolfram Sang Signe

Re: [PATCH] ACPI: Add _DEP(Operation Region Dependencies) support to fix battery issue on the Asus T100TA

2014-11-19 Thread Lan Tianyu
Hi Mika: Thank you for review. Will resolve your comments in the next version. -- Best regards Tianyu Lan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.

Re: [PATCH] ACPI: Add _DEP(Operation Region Dependencies) support to fix battery issue on the Asus T100TA

2014-11-19 Thread Lan Tianyu
On 2014年11月20日 00:05, Wolfram Sang wrote: > As long as the I2C related changes are that minimal: > > Acked-by: Wolfram Sang for the I2C part > Thank you! -- Best regards Tianyu Lan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...

[PATCH] ACPI: Add _DEP(Operation Region Dependencies) support to fix battery issue on the Asus T100TA

2014-11-19 Thread Lan Tianyu
are met and then do acpi_bus_attach() for the device in order to resolve battery _STA issue on the Asus T100TA. Reference: https://bugzilla.kernel.org/show_bug.cgi?id=69011 Tested-by: Jan-Michael Brummer Tested-by: Adam Williamson Tested-by: Michael Shigorin Signed-off-by: Lan Tianyu --- drivers/

[RFC PATCH V2] ACPI: Add _DEP(Operation Region Dependencies) support to fix battery issue on the Asus T100TA

2014-10-27 Thread Lan Tianyu
are met and then do acpi_bus_attach() for the device in order to resolve battery _STA issue on the Asus T100TA. Signed-off-by: Lan Tianyu --- Change since V1: Rework struct acpi_dep_data, record master and slave's ACPI handle. Rename dep_present with dep_unmet and make it as a count.

Re: [RFC PATCH V3 0/3] PM/CPU: Parallel enalbing nonboot cpus with resume devices

2014-10-21 Thread Lan Tianyu
On 2014年10月09日 09:18, Lan Tianyu wrote: > On 2014年10月09日 04:54, Peter Zijlstra wrote: >> On Thu, Sep 25, 2014 at 04:32:02PM +0800, Lan Tianyu wrote: >>> This patchset is to parallel enabling nonboot cpus with resuming devices >>> during system resume in order to acceler

Re: [RFC PATCH V3 0/3] PM/CPU: Parallel enalbing nonboot cpus with resume devices

2014-10-08 Thread Lan Tianyu
On 2014年10月09日 04:54, Peter Zijlstra wrote: > On Thu, Sep 25, 2014 at 04:32:02PM +0800, Lan Tianyu wrote: >> This patchset is to parallel enabling nonboot cpus with resuming devices >> during system resume in order to accelerate S2RAM. From test result on >> a 8 logical

Re: [PATCH 1/1] Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver.

2014-10-07 Thread Lan Tianyu
Sorry later response and just back from vacation. On 2014年09月29日 16:20, Viresh Kumar wrote: > But this change is buggy.. Because you are updating 'cpufreq_suspended' > before actually stopping the governor, any calls to __cpufreq_governor() > will be converted to NO-operations because of this in _

Re: [RFC PATCH] ACPI: Add _DEP(Operation Region Dependencies) support to fix battery issue on the Asus T100TA

2014-09-25 Thread Lan Tianyu
On 2014年09月26日 03:27, Rafael J. Wysocki wrote: > I'm not sure what you mean. "Dependent" means "depending on something", so > the > question reads "This requires the devices with _DEP to have a list of devices > that depend on them" which is probably not what you meant. > Sorry, I didn't say cl

Re: [RFC PATCH] ACPI: Add _DEP(Operation Region Dependencies) support to fix battery issue on the Asus T100TA

2014-09-25 Thread Lan Tianyu
On 2014年09月25日 06:27, Rafael J. Wysocki wrote: > On Tuesday, September 23, 2014 03:06:43 PM Lan Tianyu wrote: >> ACPI 5.0 introduces _DEP to designate device objects that OSPM should >> assign a higher priority in start ordering due to future operation region >> accesses.

[RFC PATCH V2 2/3] X86/CPU: Initialize MTRR/PAT when each cpu is online during system resume.

2014-09-25 Thread Lan Tianyu
gup. MTRR/PAT should be initialized before running tasks. So this patch is to remove set_mtrr_aps_delayed_init() for system resume and do the MTRR/PAT init when the AP comes online just like dynamic single cpu online. Signed-off-by: Lan Tianyu --- kernel/cpu.c | 3 --- 1 file changed, 3 deletions(-)

[RFC PATCH V3 3/3] Cpufreq: Hold cpu_add_remove_lock before change cpufreq_suspended flag

2014-09-25 Thread Lan Tianyu
/tear down is dedicated for cpu hotplug during system pm. To keep this rule, hold cpu_add_remove_lock during changing cpufreq_suspended flag. Signed-off-by: Lan Tianyu --- drivers/cpufreq/cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq

[RFC PATCH V3 0/3] PM/CPU: Parallel enalbing nonboot cpus with resume devices

2014-09-25 Thread Lan Tianyu
init MTRR/PAT just after one nonboot cpus comes online just like dynamic single cpu online. Patch 3 is to guarantee that all cpus are online before changing cpufreq_suspended flag in the cpufreq_resume() to avoid breaking cpufreq subsystem. Lan Tianyu (3): PM/CPU: Parallel enalbing nonboot

[RFC PATCH V3 1/3] PM/CPU: Parallel enalbing nonboot cpus with resume devices

2014-09-25 Thread Lan Tianyu
parallel with resuming devices. Signed-off-by: Lan Tianyu --- kernel/cpu.c | 67 ++-- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index 356450f..24c4889 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c

Re: [PATCH v2] i2c: move acpi code back into the core

2014-09-25 Thread Lan Tianyu
Signed-off-by: Wolfram Sang > Cc: Mika Westerberg > Cc: Lan Tianyu > Cc: Jean Delvare > --- > > v2: - make all acpi functions static > - annotate #endif > - remove declarations in i2c.h > - add dummy functions to i2c-core.c > - make two seperate #

[tip:x86/cpu] x86/smpboot: Speed up suspend/ resume by avoiding 100ms sleep for CPU offline during S3

2014-09-24 Thread tip-bot for Lan Tianyu
Commit-ID: 2ed53c0d6cc99fc712f7c037e41d9ec4eb8d6b08 Gitweb: http://git.kernel.org/tip/2ed53c0d6cc99fc712f7c037e41d9ec4eb8d6b08 Author: Lan Tianyu AuthorDate: Tue, 26 Aug 2014 15:43:45 +0800 Committer: Ingo Molnar CommitDate: Wed, 24 Sep 2014 15:02:06 +0200 x86/smpboot: Speed up

Re: [PATCH] i2c: move acpi code back into the core

2014-09-23 Thread Lan Tianyu
On 2014年09月23日 15:09, Lan Tianyu wrote: > On 2014年09月23日 13:39, Wolfram Sang wrote: >> >>> Sorry for later response due to sickness. I can't write this patch in >>> time. Sorry again. I will test it soon. >> >> Oh, get well soon! Please say so next time,

  1   2   3   4   >