Re: [PATCH v1 0/7] KVM: Hyper-V SynIC timers

2015-12-01 Thread Wanpeng Li
2015-11-26 16:34 GMT+08:00 Andrey Smetanin <asmeta...@virtuozzo.com>: > > > On 11/26/2015 08:28 AM, Wanpeng Li wrote: >> >> 2015-11-25 23:20 GMT+08:00 Andrey Smetanin <asmeta...@virtuozzo.com>: >>> >>> Per Hyper-V specification (and as required

Re: [PATCH v1 0/7] KVM: Hyper-V SynIC timers

2015-11-26 Thread Wanpeng Li
2015-11-26 16:34 GMT+08:00 Andrey Smetanin <asmeta...@virtuozzo.com>: > > > On 11/26/2015 08:28 AM, Wanpeng Li wrote: >> >> 2015-11-25 23:20 GMT+08:00 Andrey Smetanin <asmeta...@virtuozzo.com>: >>> >>> Per Hyper-V specification (and as required

Re: [PATCH v1 0/7] KVM: Hyper-V SynIC timers

2015-11-25 Thread Wanpeng Li
format message > to the configured SynIC message slot and triggering the corresponding > synthetic interrupt. Could you post a link for this specification? Regards, Wanpeng Li -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.o

Re: [PATCH] KVM: x86: don't expose syscall/sysret to intel 32-bit guest

2015-11-25 Thread Wanpeng Li
w/ 32-bit guest, vmware also exposes LM bit to 32 bit guest(however it doesn't expose syscall/sysret), so maybe we can't depend on F(LM). Regards, Wanpeng Li -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org Mor

Re: [PATCH] KVM: x86: don't expose syscall/sysret to intel 32-bit guest

2015-11-19 Thread Wanpeng Li
2015-11-19 19:05 GMT+08:00 Paolo Bonzini <pbonz...@redhat.com>: > > > On 19/11/2015 11:45, Wanpeng li wrote: >> Intel cpu doesn't support syscall/sysret in non 64-bit mode which >> is different from AMD. Expose syscall/sysret to intel 32-bit guest >> just make

Re: [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions

2015-11-19 Thread Wanpeng Li
2015-11-20 10:52 GMT+08:00 Wanpeng Li <kernel...@gmail.com>: > Hi Paolo, > 2015-02-09 17:03 GMT+08:00 Paolo Bonzini <pbonz...@redhat.com>: >> NoWrite instructions (e.g. cmp or test) never set the "write access" >> bit in the error code, even if one of the

Re: [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions

2015-11-19 Thread Wanpeng Li
could you point out where in SDM describe above? Regards, Wanpeng Li -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH kvm-unit-tests] x86: tsc: add test for RDTSCP

2015-11-12 Thread Wanpeng Li
> + test_rdtscp(0); > + test_rdtscp(10); > + test_rdtscp(0x100); > + } else > + printf("rdtscp not supported\n"); > return 0; > } > diff --git a/x86/unittests.cfg b/x86/unittests.cfg > index

Re: [PATCH kvm-unit-tests] x86: tsc: add test for RDTSCP

2015-11-12 Thread Wanpeng Li
{ > + test_rdtscp(0); > + test_rdtscp(10); > + test_rdtscp(0x100); > + } else > + printf("rdtscp not supported\n"); > return 0; > } > diff --git a/x86/unittests.cfg b/x86/unittests.cfg > ind

Re: [PATCH] KVM: x86: fix eflags state following processor init/reset

2015-11-10 Thread Wanpeng Li
can you send v2 that > removes or modifies the existing call to vmcs_writel? If there is a > bug, can you write a unit test for it? It should be possible to test > for the problem using INIT+SIPI on an AP. You are right, I write a INIT+SIPI kvm-unit-test and didn't trigger any bug. Please ig

[PATCH v2] KVM: x86: Reset RFLAGS state following processor init/reset

2015-11-03 Thread Wanpeng Li
reset eflags register to 0002H following initialization of the processor. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- v1 -> v2: * use vmcs_writel arch/x86/kvm/vmx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index b680c2e

Re: Steal time accounting in KVM. Benchmark.

2015-10-29 Thread Wanpeng Li
(with 2:1 cpu overcommit). irq time accounting gets crazy. Even 'top' shows weird statistic: 50% hi, 50% st, ~0% user, spinning processes use ~0% cpu - that is not correct. If this is the desired behavior or something need to improve? Regards, Wanpeng Li -- To unsubscribe from this list: send

Re: [PATCH] KVM: x86: fix eflags state following processor init/reset

2015-10-27 Thread Wanpeng Li
Ping, :-) On 10/21/15 2:28 PM, Wanpeng Li wrote: Reference SDM 3.4.3: Following initialization of the processor (either by asserting the RESET pin or the INIT pin), the state of the EFLAGS register is 0002H. However, the eflags fixed bit is not set and other bits are also not cleared

Re: Difference between vcpu_load and kvm_sched_in ?

2015-10-22 Thread Wanpeng Li
On 10/21/15 2:46 PM, Paolo Bonzini wrote: On 21/10/2015 00:57, Wanpeng Li wrote: kvm_sched_out and kvm_sched_in are part of KVM's preemption hooks. The hooks are registered only between vcpu_load and vcpu_put, therefore they know that the mutex is taken. The sequence will go like

[PATCH] KVM: x86: fix eflags state following processor init/reset

2015-10-21 Thread Wanpeng Li
it by set eflags register to 0002H following initialization of the processor. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index b680c2e..326f6ea 100644 --- a/arch/x86/kvm

Re: Difference between vcpu_load and kvm_sched_in ?

2015-10-20 Thread Wanpeng Li
_sched_out ... vcpu_put Regards, Wanpeng Li -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Steal time accounting in KVM. Benchmark.

2015-10-20 Thread Wanpeng Li
rse. It prefers to stuck at quarters (100% 75% 50% 25%) Output is attached. If the output in attachment is for VM2 only? Regards, Wanpeng Li -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vg

Re: [PATCH v3 0/5] KVM: nVMX: nested VPID emulation

2015-10-16 Thread Wanpeng Li
Ping, :-) On 10/14/15 12:12 AM, Wanpeng Li wrote: v2 -> v3: * separate nested_vmx_vpid_caps and move checks to patch 3/5, only rejoin them when reading the MSR. v1 -> v2: * set bit 32 of the VMX_EPT_VPID_CAP MSR * check against the supported types in the implemen

[PATCH v3 5/5] KVM: nVMX: expose VPID capability to L1

2015-10-14 Thread Wanpeng Li
vCPUs not sched in/out on L1. Reviewed-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2a54cc7..0b

[PATCH v3 4/5] KVM: nVMX: nested VPID emulation

2015-10-14 Thread Wanpeng Li
nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Reviewed-by: Jan Kiszka <jan.kis...@siemens.com> Reviewed-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/

[PATCH v3 0/5] KVM: nVMX: nested VPID emulation

2015-10-14 Thread Wanpeng Li
nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Wanpeng Li (5): KVM: VMX: adjust interface to allocate/free_vpid KVM: VMX: introduce __vmx_flush_tlb to handle specific vpid KVM: nVMX: emulate the INVVPID instruction KVM: nVMX: nested VPID emu

[PATCH v3 3/5] KVM: nVMX: emulate the INVVPID instruction

2015-10-14 Thread Wanpeng Li
Add the INVVPID instruction emulation. Reviewed-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/include/asm/vmx.h | 1 + arch/x86/kvm/vmx.c | 61 +- 2 files changed, 61 inse

[PATCH v3 2/5] KVM: VMX: introduce __vmx_flush_tlb to handle specific vpid

2015-10-14 Thread Wanpeng Li
m> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1a0e336..d21b9a6 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1392

[PATCH v3 1/5] KVM: VMX: adjust interface to allocate/free_vpid

2015-10-14 Thread Wanpeng Li
Adjust allocate/free_vid so that they can be reused for the nested vpid. Reviewed-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff

Re: [PATCH v2 5/5] KVM: nVMX: expose VPID capability to L1

2015-10-13 Thread Wanpeng Li
On 10/13/15 10:44 PM, Paolo Bonzini wrote: On 08/10/2015 07:57, Wanpeng Li wrote: Expose VPID capability to L1. For nested guests, we don't do anything specific for single context invalidation. Hence, only advertise support for global context invalidation. The major benefit of nested VPID

Re: [PATCH v2] KVM: nVMX: expose VPID capability to L1

2015-10-08 Thread Wanpeng Li
On 9/29/15 6:39 PM, Paolo Bonzini wrote: On 29/09/2015 04:55, Wanpeng Li wrote: Expose VPID capability to L1. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- v1 -> v2: * set only VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT Thanks. I've checked more thoroughly your implementatio

[PATCH v2 1/5] KVM: VMX: adjust interface to allocate/free_vpid

2015-10-08 Thread Wanpeng Li
Adjust allocate/free_vid so that they can be reused for the nested vpid. Reviewed-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff

[PATCH v2 2/5] KVM: VMX: introduce __vmx_flush_tlb to handle specific vpid

2015-10-08 Thread Wanpeng Li
m> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 3c9e2a4a..215db2b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1337

[PATCH v2 0/5] KVM: nVMX: nested VPID emulation

2015-10-08 Thread Wanpeng Li
xsw ctxsw ctxsw ctxsw - - -- -- -- -- -- --- --- kernelLinux 3.5.0-1 1.2200 1.3700 1.4500 4.7800 2.3300 5.6 2.88000 nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Wanpeng Li (5): KVM:

[PATCH v2 5/5] KVM: nVMX: expose VPID capability to L1

2015-10-08 Thread Wanpeng Li
vCPUs not sched in/out on L1. Reviewed-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 36 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x

[PATCH v2 4/5] KVM: nVMX: nested VPID emulation

2015-10-08 Thread Wanpeng Li
nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Reviewed-by: Jan Kiszka <jan.kis...@siemens.com> Reviewed-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/

[PATCH v2 3/5] KVM: nVMX: emulate the INVVPID instruction

2015-10-08 Thread Wanpeng Li
Add the INVVPID instruction emulation. Reviewed-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/include/asm/vmx.h | 3 +++ arch/x86/kvm/vmx.c | 49 +- 2 files changed, 51 inse

[PATCH v2] KVM: nVMX: expose VPID capability to L1

2015-09-29 Thread Wanpeng Li
Expose VPID capability to L1. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- v1 -> v2: * set only VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT arch/x86/kvm/vmx.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/

Re: [PATCH v2] KVM: nVMX: expose VPID capability to L1

2015-09-29 Thread Wanpeng Li
On 9/29/15 6:39 PM, Paolo Bonzini wrote: On 29/09/2015 04:55, Wanpeng Li wrote: Expose VPID capability to L1. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- v1 -> v2: * set only VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT Thanks. I've checked more thoroughly your implementatio

Re: [PATCH] KVM: nVMX: expose VPID capability to L1

2015-09-28 Thread Wanpeng Li
On 9/28/15 8:05 PM, Paolo Bonzini wrote: On 24/09/2015 08:51, Wanpeng Li wrote: /* * For nested guests, we don't do anything specific * for single context invalidation. Hence, only advertise * support for global context

[PATCH] KVM: nVMX: expose VPID capability to L1

2015-09-24 Thread Wanpeng Li
Expose VPID capability to L1. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index f9219ad..866045c 100644 --- a/arch/x86/kvm

Re: [PATCH 1/2] KVM: introduce __vmx_flush_tlb to handle specific vpid

2015-09-24 Thread Wanpeng Li
On 9/25/15 12:12 AM, Bandan Das wrote: Wanpeng Li <wanpeng...@hotmail.com> writes: Introduce __vmx_flush_tlb() to handle specific vpid. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 21 + 1 file changed, 13 insertions(+),

Re: [PATCH] KVM: nVMX: emulate the INVVPID instruction

2015-09-23 Thread Wanpeng Li
On 9/23/15 4:39 PM, Paolo Bonzini wrote: On 23/09/2015 09:59, Wanpeng Li wrote: Add the INVVPID instruction emulation. Reviewed-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/include/asm/vmx.h | 1 + arch/x86/kvm/vmx.c

[PATCH 1/2] KVM: introduce __vmx_flush_tlb to handle specific vpid

2015-09-23 Thread Wanpeng Li
Introduce __vmx_flush_tlb() to handle specific vpid. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 794c529..7188c5e

[PATCH 2/2] KVM: nVMX: fix flush vpid01 during nested vmentry/vmexit

2015-09-23 Thread Wanpeng Li
vpid_sync_vcpu_single() still handles vpid01 during nested vmentry/vmexit since vmx->vpid is used for invvpid. This patch fix it by specific the vpid02 through __vmx_flush_tlb() to flush the right vpid. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 4 ++-

[PATCH] KVM: nVMX: emulate the INVVPID instruction

2015-09-23 Thread Wanpeng Li
Add the INVVPID instruction emulation. Reviewed-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/include/asm/vmx.h | 1 + arch/x86/kvm/vmx.c | 23 ++- 2 files changed, 23 insertions(+), 1 deletion(-)

Re: [edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-09-20 Thread Wanpeng Li
On 9/21/15 10:51 AM, Xiao Guangrong wrote: Thanks for your report and analysis, Janusz! On 09/19/2015 01:48 AM, Janusz wrote: W dniu 18.09.2015 o 12:07, Laszlo Ersek pisze: On 09/18/15 11:37, Janusz wrote: Hello, I am writting about this patch that was posted by Xiao:

Re: [PATCH] KVM: nVMX: nested VPID emulation

2015-09-16 Thread Wanpeng Li
On 9/16/15 1:20 PM, Jan Kiszka wrote: On 2015-09-16 04:36, Wanpeng Li wrote: On 9/16/15 1:32 AM, Jan Kiszka wrote: On 2015-09-15 12:14, Wanpeng Li wrote: On 9/14/15 10:54 PM, Jan Kiszka wrote: Last but not least: the guest can now easily exhaust the host's pool of vpid by simply spawning

Re: [PATCH v4 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid

2015-09-16 Thread Wanpeng Li
On 9/16/15 5:11 PM, Jan Kiszka wrote: On 2015-09-16 09:19, Wanpeng Li wrote: Enhance allocate/free_vid to handle shadow vpid. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff

[PATCH v5 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid

2015-09-16 Thread Wanpeng Li
Enhance allocate/free_vid to handle shadow vpid. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9ff6a3f..f8d704d

[PATCH v4 2/2] KVM: nVMX: nested VPID emulation

2015-09-16 Thread Wanpeng Li
2.88000 nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Reviewed-by: Jan Kiszka <jan.kis...@siemens.com> Suggested-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/

[PATCH v4 0/2] KVM: nested VPID emulation

2015-09-16 Thread Wanpeng Li
0 2.88000 nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Wanpeng Li (2): KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid KVM: nVMX: nested VPID emulation arch/x86/kvm/vmx.c | 60 ++---

[PATCH v4 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid

2015-09-16 Thread Wanpeng Li
Enhance allocate/free_vid to handle shadow vpid. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9ff6a3f..c5222b8

Re: [PATCH v3 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid

2015-09-16 Thread Wanpeng Li
On 9/16/15 2:42 PM, Jan Kiszka wrote: On 2015-09-16 05:51, Wanpeng Li wrote: Enhance allocate/free_vid to handle shadow vpid. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-)

[PATCH v5 0/2] KVM: nested VPID emulation

2015-09-16 Thread Wanpeng Li
.2200 1.3700 1.4500 4.7800 2.3300 5.6 2.88000 nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Wanpeng Li (2): KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid KVM: nVMX: nested VPID emulation arch/x86/kv

[PATCH v5 2/2] KVM: nVMX: nested VPID emulation

2015-09-16 Thread Wanpeng Li
2.88000 nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Reviewed-by: Jan Kiszka <jan.kis...@siemens.com> Suggested-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/

Re: [PATCH v5 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid

2015-09-16 Thread Wanpeng Li
On 9/16/15 6:04 PM, Paolo Bonzini wrote: On 16/09/2015 11:30, Wanpeng Li wrote: Enhance allocate/free_vid to handle shadow vpid. Adjusting the commit message: KVM: nVMX: adjust interface to allocate/free_vpid Adjust allocate/free_vid so that they can be reused for the nested

[PATCH] KVM: vmx: fix VPID is 0000H in non-root operation

2015-09-16 Thread Wanpeng Li
0H for VMX root operation. This patch fix it by reintroducing reserve H for VMX root operation. Reported-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x8

Re: [PATCH] KVM: add halt_attempted_poll to VCPU stats

2015-09-16 Thread Wanpeng Li
y. If this can be reproduced on x86 platform? Regards, Wanpeng Li -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] KVM: vmx: fix VPID is 0000H in non-root operation

2015-09-16 Thread Wanpeng Li
while the value of Looks good to me. Regards, Wanpeng Li -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v2 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid

2015-09-15 Thread Wanpeng Li
On 9/15/15 8:54 PM, Paolo Bonzini wrote: On 15/09/2015 12:30, Wanpeng Li wrote: + if (!nested) { + vpid = find_first_zero_bit(vmx_vpid_bitmap, VMX_NR_VPIDS); + if (vpid < VMX_NR_VPIDS) { vmx->vpid = vpid; __set_bi

[PATCH v3 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid

2015-09-15 Thread Wanpeng Li
Enhance allocate/free_vid to handle shadow vpid. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9ff6a3f..4956081

[PATCH v3 0/2] KVM: nested VPID emulation

2015-09-15 Thread Wanpeng Li
12.9 3.49000 7.46000 vanilla Wanpeng Li (2): KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid KVM: nVMX: nested VPID emulation arch/x86/kvm/vmx.c | 61 +- 1 file changed, 42 insertions(+), 19 deletions(-) --

[PATCH v3 2/2] KVM: nVMX: nested VPID emulation

2015-09-15 Thread Wanpeng Li
2.88000 nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Suggested-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 37 +++-- 1 file

Re: [PATCH] KVM: nVMX: nested VPID emulation

2015-09-15 Thread Wanpeng Li
On 9/16/15 1:32 AM, Jan Kiszka wrote: On 2015-09-15 12:14, Wanpeng Li wrote: On 9/14/15 10:54 PM, Jan Kiszka wrote: Last but not least: the guest can now easily exhaust the host's pool of vpid by simply spawning plenty of VCPUs for L2, no? Is this acceptable or should there be some limit? I

Re: Questions about KVM TSC trapping

2015-09-15 Thread Wanpeng Li
On 9/16/15 6:00 AM, David Matlack wrote: On Tue, Sep 15, 2015 at 12:04 AM, Oliver Yang wrote: Hi Guys, I found below patch for KVM TSC trapping / migration support, https://lkml.org/lkml/2011/1/6/90 It seemed the patch were not merged in Linux mainline. So I have 3

Re: [PATCH] KVM: nVMX: nested VPID emulation

2015-09-15 Thread Wanpeng Li
On 9/14/15 10:54 PM, Jan Kiszka wrote: On 2015-09-14 14:52, Wanpeng Li wrote: VPID is used to tag address space and avoid a TLB flush. Currently L0 use the same VPID to run L1 and all its guests. KVM flushes VPID when switching between L1 and L2. This patch advertises VPID to the L1 hypervisor

Re: [PATCH] KVM: nVMX: nested VPID emulation

2015-09-15 Thread Wanpeng Li
On 9/15/15 12:08 AM, Bandan Das wrote: Wanpeng Li <wanpeng...@hotmail.com> writes: VPID is used to tag address space and avoid a TLB flush. Currently L0 use the same VPID to run L1 and all its guests. KVM flushes VPID when switching between L1 and L2. This patch advertises VPID to

[PATCH v2 0/2] KVM: nested VPID emulation

2015-09-15 Thread Wanpeng Li
xsw - - -- -- -- -- -- --- --- kernelLinux 3.5.0-1 1.2200 1.3700 1.4500 4.7800 2.3300 5.6 2.88000 nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Wanpeng Li (2): KVM: nVMX: enhance allocate/free_v

[PATCH v2 2/2] KVM: nVMX: nested VPID emulation

2015-09-15 Thread Wanpeng Li
2.88000 nested VPID kernelLinux 3.5.0-1 1.2600 1.4300 1.5600 12.7 12.9 3.49000 7.46000 vanilla Suggested-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 25 ++--- 1 file changed, 18 inse

[PATCH v2 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid

2015-09-15 Thread Wanpeng Li
Enhance allocate/free_vid to handle shadow vpid. Suggested-by: Wincy Van <fanwenyi0...@gmail.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 33 +++-- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/arch/x86

[PATCH] KVM: nVMX: nested VPID emulation

2015-09-14 Thread Wanpeng Li
flush when swithing between L1 and L2. This patch gets ~3x performance improvement for lmbench 8p/64k ctxsw. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- arch/x86/kvm/vmx.c | 39 --- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/ar

[PATCH] KVM: fix polling for guest halt continued even if disable it

2015-09-14 Thread Wanpeng Li
hen polling is disabled. Reported-by: Christian Borntraeger <borntrae...@de.ibm.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- virt/kvm/kvm_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 4662a88..

Re: [PATCH v7 0/3] KVM: Dynamic Halt-Polling

2015-09-14 Thread Wanpeng Li
On 9/10/15 3:13 PM, Christian Borntraeger wrote: Am 10.09.2015 um 03:55 schrieb Wanpeng Li: On 9/9/15 9:39 PM, Christian Borntraeger wrote: Am 03.09.2015 um 16:07 schrieb Wanpeng Li: v6 -> v7: * explicit signal (set a bool) * fix the tracepoint v5 -> v6: * fix wait_ns and p

Re: [PATCH v7 0/3] KVM: Dynamic Halt-Polling

2015-09-09 Thread Wanpeng Li
On 9/9/15 9:39 PM, Christian Borntraeger wrote: Am 03.09.2015 um 16:07 schrieb Wanpeng Li: v6 -> v7: * explicit signal (set a bool) * fix the tracepoint v5 -> v6: * fix wait_ns and poll_ns v4 -> v5: * set base case 10us and max poll time 500us * handle short/long halt,

Re: [PATCH v7 2/3] KVM: dynamic halt-polling

2015-09-06 Thread Wanpeng Li
On 9/6/15 10:32 PM, Paolo Bonzini wrote: On 05/09/2015 00:38, Wanpeng Li wrote: @@ -1940,11 +1975,16 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) * arrives. */ if (kvm_vcpu_check_block(vcpu) < 0) { +polled = t

Re: [PATCH v7 2/3] KVM: dynamic halt-polling

2015-09-04 Thread Wanpeng Li
Hi Paolo, On 9/3/15 10:07 PM, Wanpeng Li wrote: [...] static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu) { if (kvm_arch_vcpu_runnable(vcpu)) { @@ -1928,7 +1962,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) { ktime_t start, cur; DEFINE_WAIT(wait); - bool

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Wanpeng Li
save some indentation. Then we will miss the tracepoint. Regards, Wanpeng Li + if (block_ns <= vcpu->halt_poll_ns) + ; + /* we had a long block, shrink polling */ + else if (vcpu->halt_poll_ns && block_ns >

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Wanpeng Li
loop calling kvm_vcpu_block and starve the waiting task (at least until need_resched()), which would break the "only hog the cpu when idle" aspect of halt-polling. That's definitely a bug, yes. Ok, I will send out v7 to fix this in this sunday since there is vacation in my country currently

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Wanpeng Li
On 9/4/15 12:07 AM, David Matlack wrote: On Thu, Sep 3, 2015 at 2:23 AM, Wanpeng Li <wanpeng...@hotmail.com> wrote: How about something like: @@ -1941,10 +1976,14 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) */ if (kvm_vcpu_check_bloc

[PATCH v7 2/3] KVM: dynamic halt-polling

2015-09-03 Thread Wanpeng Li
Suggested-by: David Matlack <dmatl...@google.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- virt/kvm/kvm_main.c | 63 + 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c

[PATCH v7 0/3] KVM: Dynamic Halt-Polling

2015-09-03 Thread Wanpeng Li
sing the dynamic-poll. The savings should be even higher for higher frequency ticks. Wanpeng Li (3): KVM: make halt_poll_ns per-vCPU KVM: dynamic halt-polling KVM: trace kvm_halt_poll_ns grow/shrink include/linux/kvm_host.h | 1 + include/trace/eve

[PATCH v7 1/3] KVM: make halt_poll_ns per-vCPU

2015-09-03 Thread Wanpeng Li
Change halt_poll_ns into per-VCPU variable, seeded from module parameter, to allow greater flexibility. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff

[PATCH v7 3/3] KVM: trace kvm_halt_poll_ns grow/shrink

2015-09-03 Thread Wanpeng Li
Tracepoint for dynamic halt_pool_ns, fired on every potential change. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- include/trace/events/kvm.h | 30 ++ virt/kvm/kvm_main.c| 8 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Wanpeng Li
On 9/3/15 2:09 AM, David Matlack wrote: On Wed, Sep 2, 2015 at 12:29 AM, Wanpeng Li <wanpeng...@hotmail.com> wrote: There is a downside of always-poll since poll is still happened for idle vCPUs which can waste cpu usage. This patch adds the ability to adjust halt_poll_ns dynamically, t

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Wanpeng Li
On 9/4/15 9:16 AM, Wanpeng Li wrote: [...] + static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu) { if (kvm_arch_vcpu_runnable(vcpu)) { @@ -1929,6 +1963,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) ktime_t start, cur; DEFINE_WAIT(wait); bool waited

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-09-02 Thread Wanpeng Li
On 9/2/15 9:49 AM, David Matlack wrote: On Tue, Sep 1, 2015 at 5:29 PM, Wanpeng Li <wanpeng...@hotmail.com> wrote: On 9/2/15 7:24 AM, David Matlack wrote: On Tue, Sep 1, 2015 at 3:58 PM, Wanpeng Li <wanpeng...@hotmail.com> wrote: Why this can happen? Ah, probably because

[PATCH v5 0/3] KVM: Dynamic Halt-Polling

2015-09-02 Thread Wanpeng Li
The savings should be even higher for higher frequency ticks. Wanpeng Li (3): KVM: make halt_poll_ns per-VCPU KVM: dynamic halt_poll_ns adjustment KVM: trace kvm_halt_poll_ns grow/shrink include/linux/kvm_host.h | 1 + include/trac

[PATCH v5 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread Wanpeng Li
frequency ticks. Suggested-by: David Matlack <dmatl...@google.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- virt/kvm/kvm_main.c | 60 ++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/virt/kvm

[PATCH v5 3/3] KVM: trace kvm_halt_poll_ns grow/shrink

2015-09-02 Thread Wanpeng Li
Tracepoint for dynamic halt_pool_ns, fired on every potential change. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- include/trace/events/kvm.h | 30 ++ virt/kvm/kvm_main.c| 8 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff

[PATCH v6 3/3] KVM: trace kvm_halt_poll_ns grow/shrink

2015-09-02 Thread Wanpeng Li
Tracepoint for dynamic halt_pool_ns, fired on every potential change. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- include/trace/events/kvm.h | 30 ++ virt/kvm/kvm_main.c| 8 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff

[PATCH v6 1/3] KVM: make halt_poll_ns per-vCPU

2015-09-02 Thread Wanpeng Li
Change halt_poll_ns into per-vCPU variable, seeded from module parameter, to allow greater flexibility. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff

[PATCH v6 0/3] KVM: Dynamic Halt-Polling

2015-09-02 Thread Wanpeng Li
less. (250HZ) means the guest was ticking at 250HZ. The big win is with ticking operating systems. Running the linux guest with nohz=off (and HZ=250), we save 3.4%~12.8% CPUs/second and get close to no-polling overhead levels by using the dynamic-poll. The savings should be even higher for higher fre

[PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread Wanpeng Li
Suggested-by: David Matlack <dmatl...@google.com> Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- virt/kvm/kvm_main.c | 61 ++--- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kv

[PATCH v5 1/3] KVM: make halt_poll_ns per-VCPU

2015-09-02 Thread Wanpeng Li
Change halt_poll_ns into per-vCPU variable, seeded from module parameter, to allow greater flexibility. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff

Re: [PATCH v6 3/3] KVM: trace kvm_halt_poll_ns grow/shrink

2015-09-02 Thread Wanpeng Li
On 9/3/15 2:09 AM, David Matlack wrote: On Wed, Sep 2, 2015 at 12:42 AM, Wanpeng Li <wanpeng...@hotmail.com> wrote: Tracepoint for dynamic halt_pool_ns, fired on every potential change. Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> --- include/trace/event

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-09-01 Thread Wanpeng Li
On 9/2/15 7:24 AM, David Matlack wrote: On Tue, Sep 1, 2015 at 3:58 PM, Wanpeng Li <wanpeng...@hotmail.com> wrote: On 9/2/15 6:34 AM, David Matlack wrote: On Tue, Sep 1, 2015 at 3:30 PM, Wanpeng Li <wanpeng...@hotmail.com> wrote: On 9/2/15 5:45 AM, David Matlack wrote: On Thu,

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-09-01 Thread Wanpeng Li
On 9/2/15 6:34 AM, David Matlack wrote: On Tue, Sep 1, 2015 at 3:30 PM, Wanpeng Li <wanpeng...@hotmail.com> wrote: On 9/2/15 5:45 AM, David Matlack wrote: On Thu, Aug 27, 2015 at 2:47 AM, Wanpeng Li <wanpeng...@hotmail.com> wrote: v3 -> v4: * bring back grow vcpu->

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-09-01 Thread Wanpeng Li
On 9/2/15 5:45 AM, David Matlack wrote: On Thu, Aug 27, 2015 at 2:47 AM, Wanpeng Li <wanpeng...@hotmail.com> wrote: v3 -> v4: * bring back grow vcpu->halt_poll_ns when interrupt arrives and shrinks when idle VCPU is detected v2 -> v3: * grow/shrink vcp

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-08-31 Thread Wanpeng Li
On 8/31/15 3:44 PM, Wanpeng Li wrote: On 8/30/15 6:26 AM, Peter Kieser wrote: Thanks, Wanpeng. Applied this to Linux 3.18 and seeing much higher CPU usage (200%) for qemu 2.4.0 process on a Windows 10 x64 guest. qemu parameters: Interesting. I test this against latest kvm tree and stable qemu

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-08-31 Thread Wanpeng Li
% | +-++---+ Regards, Wanpeng Li qemu-system-x86_64 -enable-kvm -name arwan-20150704 -S -machine pc-q35-2.2,accel=kvm,usb=off -cpu Haswell,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1000 -m 8192 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid 7c2fc02d-2798-4fc9-ad04-db5f1af92723

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-08-29 Thread Wanpeng Li
Hi Peter, On 8/30/15 5:18 AM, Peter Kieser wrote: Hi Wanpeng, Do I need to set any module parameters to use your patch, or should halt_poll_ns automatically tune with just your patch series applied? You don't need any module parameters. Regards, Wanpeng Li Thanks. On 2015-08-27 2:47 AM

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-08-29 Thread Wanpeng Li
3.18? Btw, do you test the linux guest? Regards, Wanpeng Li qemu-system-x86_64 -enable-kvm -name arwan-20150704 -S -machine pc-q35-2.2,accel=kvm,usb=off -cpu Haswell,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1000 -m 8192 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid 7c2fc02d

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-08-29 Thread Wanpeng Li
On 8/30/15 8:13 AM, Peter Kieser wrote: On 2015-08-29 4:55 PM, Wanpeng Li wrote: On 8/30/15 6:26 AM, Peter Kieser wrote: Thanks, Wanpeng. Applied this to Linux 3.18 and seeing much higher CPU usage (200%) for qemu 2.4.0 process on a Windows 10 x64 guest. qemu parameters: Thanks

Re: [PATCH v2 2/3] KVM: dynamic halt_poll_ns adjustment

2015-08-27 Thread Wanpeng Li
On 8/28/15 12:25 AM, David Matlack wrote: On Thu, Aug 27, 2015 at 2:59 AM, Wanpeng Li wanpeng...@hotmail.com wrote: Hi David, On 8/26/15 1:19 AM, David Matlack wrote: Thanks for writing v2, Wanpeng. On Mon, Aug 24, 2015 at 11:35 PM, Wanpeng Li wanpeng...@hotmail.com wrote

  1   2   3   4   >