Re: [PATCH] KVM: X86: init irq->level in kvm_pv_kick_cpu_op

2017-08-02 Thread Radim Krčmář
2017-08-02 11:20+0800, Longpeng(Mike): > 'lapic_irq' is a local variable and its 'level' field isn't > initialized, so 'level' is random, it doesn't matter but > makes UBSAN unhappy: > > UBSAN: Undefined behaviour in .../lapic.c:... > load of value 10 is not a valid value for type '_Bool' > ... >

Re: [PATCH v3] KVM: nVMX: Fix attempting to emulate "Acknowledge interrupt on exit" when there is no interrupt which L1 requires to inject to L2

2017-08-02 Thread Radim Krčmář
interrupt) is always set to 1 on > EXIT_REASON_EXTERNAL_INTERRUPT. We don't want to break hypervisors > expecting an interrupt in that case, so we should do a userspace VM exit > when the window is open and then inject the userspace interrupt with a > VM exit. > > Cc: Paolo B

Re: [PATCH v3] KVM: nVMX: Fix attempting to emulate "Acknowledge interrupt on exit" when there is no interrupt which L1 requires to inject to L2

2017-08-02 Thread Radim Krčmář
et to 1 on > EXIT_REASON_EXTERNAL_INTERRUPT. We don't want to break hypervisors > expecting an interrupt in that case, so we should do a userspace VM exit > when the window is open and then inject the userspace interrupt with a > VM exit. > > Cc: Paolo Bonzini > Cc: Radim Kr

Re: [PATCH] KVM: avoid using rcu_dereference_protected

2017-08-02 Thread Radim Krčmář
2017-08-02 17:55+0200, Paolo Bonzini: > During teardown, accesses to memslots and buses are using > rcu_dereference_protected with an always-true condition because > these accesses are done outside the usual mutexes. This > is because the last reference is gone and there cannot be any >

Re: [PATCH] KVM: avoid using rcu_dereference_protected

2017-08-02 Thread Radim Krčmář
2017-08-02 17:55+0200, Paolo Bonzini: > During teardown, accesses to memslots and buses are using > rcu_dereference_protected with an always-true condition because > these accesses are done outside the usual mutexes. This > is because the last reference is gone and there cannot be any >

Re: [PATCH] KVM: svm: support single stepping over emulated instructions

2017-08-02 Thread Radim Krčmář
2017-08-02 18:03+0200, Paolo Bonzini: > Use kvm_skip_emulated_instruction so that debug exceptions are > properly injected. This fixes debug.flat on AMD machines. > > Signed-off-by: Paolo Bonzini > --- We already have b742c1e6e79d ("KVM: SVM: handle singlestep exception

Re: [PATCH] KVM: svm: support single stepping over emulated instructions

2017-08-02 Thread Radim Krčmář
2017-08-02 18:03+0200, Paolo Bonzini: > Use kvm_skip_emulated_instruction so that debug exceptions are > properly injected. This fixes debug.flat on AMD machines. > > Signed-off-by: Paolo Bonzini > --- We already have b742c1e6e79d ("KVM: SVM: handle singlestep exception when skipping emulated

Re: [PATCH v4] KVM: async_pf: make rcu irq exit if not triggered from idle task

2017-08-01 Thread Radim Krčmář
2017-08-01 14:22+0200, Paolo Bonzini: > On 01/08/2017 14:20, Wanpeng Li wrote: > > From: Wanpeng Li > > > > WARNING: CPU: 5 PID: 1242 at kernel/rcu/tree_plugin.h:323 > > rcu_note_context_switch+0x207/0x6b0 > > CPU: 5 PID: 1242 Comm: unity-settings- Not tainted

Re: [PATCH v4] KVM: async_pf: make rcu irq exit if not triggered from idle task

2017-08-01 Thread Radim Krčmář
2017-08-01 14:22+0200, Paolo Bonzini: > On 01/08/2017 14:20, Wanpeng Li wrote: > > From: Wanpeng Li > > > > WARNING: CPU: 5 PID: 1242 at kernel/rcu/tree_plugin.h:323 > > rcu_note_context_switch+0x207/0x6b0 > > CPU: 5 PID: 1242 Comm: unity-settings- Not tainted 4.13.0-rc2+ #1 > > RIP:

Re: [PATCH v2] KVM: nVMX: Fix attempting to emulate "Acknowledge interrupt on exit" when there is no interrupt which L1 requires to inject to L2

2017-08-01 Thread Radim Krčmář
rrupt > which > L1 requires to inject to L2, we should not attempt to emualte "Acknowledge > interrupt on exit" for the irq window requirement in this scenario. > > This patch fixes it by not attempt to emulate "Acknowledge interrupt on exit" > > if

Re: [PATCH v2] KVM: nVMX: Fix attempting to emulate "Acknowledge interrupt on exit" when there is no interrupt which L1 requires to inject to L2

2017-08-01 Thread Radim Krčmář
requires to inject to L2, we should not attempt to emualte "Acknowledge > interrupt on exit" for the irq window requirement in this scenario. > > This patch fixes it by not attempt to emulate "Acknowledge interrupt on exit" > > if there is no L1 requirement to

Re: [PATCH] x86/cpufeature, kvm/svm: Shorten virtualized VMLOAD/VMSAVE flag

2017-08-01 Thread Radim Krčmář
but having it the same as in the > processor manual is advantageous. > > Signed-off-by: Borislav Petkov <b...@suse.de> > Cc: Janakarajan Natarajan <janakarajan.natara...@amd.com> > Cc: Paolo Bonzini <pbonz...@redhat.com> > Cc: Radim Krčmář <rkrc...@redhat.com> Acked-by: Radim Krčmář <rkrc...@redhat.com>

Re: [PATCH] x86/cpufeature, kvm/svm: Shorten virtualized VMLOAD/VMSAVE flag

2017-08-01 Thread Radim Krčmář
in the > processor manual is advantageous. > > Signed-off-by: Borislav Petkov > Cc: Janakarajan Natarajan > Cc: Paolo Bonzini > Cc: Radim Krčmář Acked-by: Radim Krčmář

Re: [PATCH] KVM: nVMX: INVPCID support

2017-08-01 Thread Radim Krčmář
2017-08-01 13:35+0200, Paolo Bonzini: > On 01/08/2017 13:18, David Hildenbrand wrote: > > > >>> Can't we rewrite that a little bit, avoiding that "best" handling > >>> (introducing guest_cpuid_disable_invpcid() and guest_cpuid_has_invpcid()) > >>> > >>> bool invpcid_enabled =

Re: [PATCH] KVM: nVMX: INVPCID support

2017-08-01 Thread Radim Krčmář
2017-08-01 13:35+0200, Paolo Bonzini: > On 01/08/2017 13:18, David Hildenbrand wrote: > > > >>> Can't we rewrite that a little bit, avoiding that "best" handling > >>> (introducing guest_cpuid_disable_invpcid() and guest_cpuid_has_invpcid()) > >>> > >>> bool invpcid_enabled =

Re: [PATCH v5 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-08-01 Thread Radim Krčmář
2017-07-28 15:52-0400, Bandan Das: > When L2 uses vmfunc, L0 utilizes the associated vmexit to > emulate a switching of the ept pointer by reloading the > guest MMU. > > Signed-off-by: Paolo Bonzini > Signed-off-by: Bandan Das > --- > diff --git

Re: [PATCH v5 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-08-01 Thread Radim Krčmář
2017-07-28 15:52-0400, Bandan Das: > When L2 uses vmfunc, L0 utilizes the associated vmexit to > emulate a switching of the ept pointer by reloading the > guest MMU. > > Signed-off-by: Paolo Bonzini > Signed-off-by: Bandan Das > --- > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > @@

Re: [PATCH v5 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-08-01 Thread Radim Krčmář
2017-08-01 13:40+0200, David Hildenbrand: > On 31.07.2017 21:32, Bandan Das wrote: > > David Hildenbrand writes: > >>> + /* AD, if set, should be supported */ > >>> + if ((address & VMX_EPT_AD_ENABLE_BIT)) { > >>> + if (!enable_ept_ad_bits) > >>> + return

Re: [PATCH v5 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-08-01 Thread Radim Krčmář
2017-08-01 13:40+0200, David Hildenbrand: > On 31.07.2017 21:32, Bandan Das wrote: > > David Hildenbrand writes: > >>> + /* AD, if set, should be supported */ > >>> + if ((address & VMX_EPT_AD_ENABLE_BIT)) { > >>> + if (!enable_ept_ad_bits) > >>> + return false; > >>> +

Re: [PATCH] KVM: x86: do mask out upper bits of PAE CR3

2017-07-24 Thread Radim Krčmář
4cc3612a6e873ef7cecdb66ebee5 > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- Thanks for catching this, Reviewed-by: Radim Krčmář <rkrc...@redhat.com> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 82a63c59f77b..6c97c82814c4 100644 > --- a/arch/x86/k

Re: [PATCH] KVM: x86: do mask out upper bits of PAE CR3

2017-07-24 Thread Radim Krčmář
5 > Signed-off-by: Paolo Bonzini > --- Thanks for catching this, Reviewed-by: Radim Krčmář > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 82a63c59f77b..6c97c82814c4 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -597,8 +597,8 @@ bool pdptrs_chang

[GIT PULL] KVM fixes for v4.13-rc2

2017-07-21 Thread Radim Krčmář
Linus, The following changes since commit 5771a8c08880cdca3bfb4a3fc6d309d6bba20877: Linux v4.13-rc1 (2017-07-15 15:22:10 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/virt/kvm/kvm tags/for-linus for you to fetch changes up to

[GIT PULL] KVM fixes for v4.13-rc2

2017-07-21 Thread Radim Krčmář
Linus, The following changes since commit 5771a8c08880cdca3bfb4a3fc6d309d6bba20877: Linux v4.13-rc1 (2017-07-15 15:22:10 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/virt/kvm/kvm tags/for-linus for you to fetch changes up to

Re: [PATCH v2] KVM: VMX: Fix invalid guest state detection after task-switch emulation

2017-07-20 Thread Radim Krčmář
_flags and adding Paolo's > suggestion for the check. > > Suggested-by: Nadav Amit <nadav.a...@gmail.com> > Cc: Paolo Bonzini <pbonz...@redhat.com> > Cc: Radim Krčmář <rkrc...@redhat.com> > Cc: Nadav Amit <nadav.a...@gmail.com> > Signed-off-by: Wanpeng Li

Re: [PATCH v2] KVM: VMX: Fix invalid guest state detection after task-switch emulation

2017-07-20 Thread Radim Krčmář
; to be set, when in fact invalid guest state emulation is not needed. > > This patch fixes it by updating vmx->emulation_required after the > rflags (and vm86 flag) is updated in task-switch emulation. > > Thanks Radim for moving the update to vmx__set_flags and adding Paolo's >

Re: [PATCH v2] KVM: x86: Avoid guest page table walk when gpa_available is set

2017-07-20 Thread Radim Krčmář
2017-07-19 08:35-0500, Brijesh Singh: > On 07/19/2017 06:19 AM, Radim Krčmář wrote: > > 2017-07-17 16:32-0500, Brijesh Singh: > > > Hi Paolo and Radim > > > > > > Any comments on this patch, I could not find it in 4.13-2 branch. > > > > >

Re: [PATCH v2] KVM: x86: Avoid guest page table walk when gpa_available is set

2017-07-20 Thread Radim Krčmář
2017-07-19 08:35-0500, Brijesh Singh: > On 07/19/2017 06:19 AM, Radim Krčmář wrote: > > 2017-07-17 16:32-0500, Brijesh Singh: > > > Hi Paolo and Radim > > > > > > Any comments on this patch, I could not find it in 4.13-2 branch. > > > > >

Re: [PATCH v5 1/1] KVM: trigger uevents when creating or destroying a VM

2017-07-19 Thread Radim Krčmář
2017-07-17 18:27+0200, Claudio Imbrenda: > On Mon, 17 Jul 2017 17:53:51 +0200 > David Hildenbrand wrote: > > > + tmp = strchrnul(p + 1, '-');> + > > > *tmp = '\0'; > > > + add_uevent_var(env, "PID=%s", p); When we're at it ... PID exists regardless of debugfs,

Re: [PATCH v5 1/1] KVM: trigger uevents when creating or destroying a VM

2017-07-19 Thread Radim Krčmář
2017-07-17 18:27+0200, Claudio Imbrenda: > On Mon, 17 Jul 2017 17:53:51 +0200 > David Hildenbrand wrote: > > > + tmp = strchrnul(p + 1, '-');> + > > > *tmp = '\0'; > > > + add_uevent_var(env, "PID=%s", p); When we're at it ... PID exists regardless of debugfs, so it would be nice

[PATCH v2] KVM: VMX: Fix invalid guest state detection after task-switch emulation

2017-07-19 Thread Radim Krčmář
2017-07-19 08:14-0700, Nadav Amit: > Radim Krčmář <rkrc...@redhat.com> wrote: > > @@ -2363,6 +2368,8 @@ static unsigned long vmx_get_rflags(struct kvm_vcpu > > *vcpu) > > > > static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags) > > { &g

[PATCH v2] KVM: VMX: Fix invalid guest state detection after task-switch emulation

2017-07-19 Thread Radim Krčmář
2017-07-19 08:14-0700, Nadav Amit: > Radim Krčmář wrote: > > @@ -2363,6 +2368,8 @@ static unsigned long vmx_get_rflags(struct kvm_vcpu > > *vcpu) > > > > static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags) > > { > > + unsigned

Re: [PATCH 6/8] x86: add MULTIUSER dependency for KVM

2017-07-19 Thread Radim Krčmář
2017-07-19 16:18+0200, Arnd Bergmann: > On Wed, Jul 19, 2017 at 4:11 PM, Radim Krčmář <rkrc...@redhat.com> wrote: > > 2017-07-19 14:53+0200, Arnd Bergmann: > >> KVM tries to select 'TASKSTATS', which had additional dependencies: > >> > >> warning: (KVM

Re: [PATCH 6/8] x86: add MULTIUSER dependency for KVM

2017-07-19 Thread Radim Krčmář
2017-07-19 16:18+0200, Arnd Bergmann: > On Wed, Jul 19, 2017 at 4:11 PM, Radim Krčmář wrote: > > 2017-07-19 14:53+0200, Arnd Bergmann: > >> KVM tries to select 'TASKSTATS', which had additional dependencies: > >> > >> warning: (KVM) selects TASKSTATS whic

Re: [PATCH 6/8] x86: add MULTIUSER dependency for KVM

2017-07-19 Thread Radim Krčmář
2017-07-19 14:53+0200, Arnd Bergmann: > KVM tries to select 'TASKSTATS', which had additional dependencies: > > warning: (KVM) selects TASKSTATS which has unmet direct dependencies (NET && > MULTIUSER) > > Signed-off-by: Arnd Bergmann > --- Hm, do you know why Kconfig warns

Re: [PATCH 6/8] x86: add MULTIUSER dependency for KVM

2017-07-19 Thread Radim Krčmář
2017-07-19 14:53+0200, Arnd Bergmann: > KVM tries to select 'TASKSTATS', which had additional dependencies: > > warning: (KVM) selects TASKSTATS which has unmet direct dependencies (NET && > MULTIUSER) > > Signed-off-by: Arnd Bergmann > --- Hm, do you know why Kconfig warns instead of

[PATCH] KVM: VMX: Fix invalid guest state detection after task-switch emulation

2017-07-19 Thread Radim Krčmář
rflags and added Paolo's suggestion for the check.] Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- arch/x86/kvm/vmx.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 84e62acf2dd8..a776aea0043a 100644

[PATCH] KVM: VMX: Fix invalid guest state detection after task-switch emulation

2017-07-19 Thread Radim Krčmář
] Signed-off-by: Radim Krčmář --- arch/x86/kvm/vmx.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 84e62acf2dd8..a776aea0043a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2326,6 +2326,11 @@ static void

Re: [PATCH v2] KVM: x86: Avoid guest page table walk when gpa_available is set

2017-07-19 Thread Radim Krčmář
2017-07-17 16:32-0500, Brijesh Singh: > Hi Paolo and Radim > > Any comments on this patch, I could not find it in 4.13-2 branch. > > Please let me know if you want to fix something, or want me to > refresh and resend the patch. Sorry, I tried it during the merge window, but it didn't pass tests

Re: [PATCH v2] KVM: x86: Avoid guest page table walk when gpa_available is set

2017-07-19 Thread Radim Krčmář
2017-07-17 16:32-0500, Brijesh Singh: > Hi Paolo and Radim > > Any comments on this patch, I could not find it in 4.13-2 branch. > > Please let me know if you want to fix something, or want me to > refresh and resend the patch. Sorry, I tried it during the merge window, but it didn't pass tests

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-19 Thread Radim Krčmář
2017-07-17 13:58-0400, Bandan Das: > Radim Krčmář <rkrc...@redhat.com> writes: > ... >>> > and no other mentions of a VM exit, so I think that the VM exit happens >>> > only under these conditions: >>> > >>> > — The EPT memory type (bi

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-19 Thread Radim Krčmář
2017-07-17 13:58-0400, Bandan Das: > Radim Krčmář writes: > ... >>> > and no other mentions of a VM exit, so I think that the VM exit happens >>> > only under these conditions: >>> > >>> > — The EPT memory type (bits 2:0) must be a v

[GIT PULL] Second batch of KVM changes for 4.13

2017-07-15 Thread Radim Krčmář
variable Paolo Bonzini (3): kvm: avoid unused variable warning for UP builds KVM: vmx: expose more information for KVM_INTERNAL_ERROR_DELIVERY_EV exits Merge branch 'annotations' of git://git.kernel.org/.../borntraeger/linux into kvm-master Radim Krčmář (2): KVM: x86:

[GIT PULL] Second batch of KVM changes for 4.13

2017-07-15 Thread Radim Krčmář
variable Paolo Bonzini (3): kvm: avoid unused variable warning for UP builds KVM: vmx: expose more information for KVM_INTERNAL_ERROR_DELIVERY_EV exits Merge branch 'annotations' of git://git.kernel.org/.../borntraeger/linux into kvm-master Radim Krčmář (2): KVM: x86:

Re: [PATCH v8 2/4] KVM: async_pf: Add L1 guest async_pf #PF vmexit handler

2017-07-14 Thread Radim Krčmář
2017-07-13 18:30-0700, Wanpeng Li: > From: Wanpeng Li <wanpeng...@hotmail.com> > > This patch adds the L1 guest async page fault #PF vmexit handler, such > by L1 similar to ordinary async page fault. > > Cc: Paolo Bonzini <pbonz...@redhat.com> > Cc: Radim Krčmář

Re: [PATCH v8 2/4] KVM: async_pf: Add L1 guest async_pf #PF vmexit handler

2017-07-14 Thread Radim Krčmář
2017-07-13 18:30-0700, Wanpeng Li: > From: Wanpeng Li > > This patch adds the L1 guest async page fault #PF vmexit handler, such > by L1 similar to ordinary async page fault. > > Cc: Paolo Bonzini > Cc: Radim Krčmář > Signed-off-by: Wanpeng Li > --- > diff --g

Re: [PATCH v7 2/4] KVM: async_pf: Add L1 guest async_pf #PF vmexit handler

2017-07-13 Thread Radim Krčmář
2017-07-12 23:44+0200, Radim Krčmář: > 2017-06-28 20:01-0700, Wanpeng Li: > > From: Wanpeng Li <wanpeng...@hotmail.com> > > > > This patch adds the L1 guest async page fault #PF vmexit handler, such > > #PF is converted into vmexit from L2 to L1 on #PF which

Re: [PATCH v7 2/4] KVM: async_pf: Add L1 guest async_pf #PF vmexit handler

2017-07-13 Thread Radim Krčmář
2017-07-12 23:44+0200, Radim Krčmář: > 2017-06-28 20:01-0700, Wanpeng Li: > > From: Wanpeng Li > > > > This patch adds the L1 guest async page fault #PF vmexit handler, such > > #PF is converted into vmexit from L2 to L1 on #PF which is then handled > > by L1 sim

Re: [PATCH v7 2/4] KVM: async_pf: Add L1 guest async_pf #PF vmexit handler

2017-07-12 Thread Radim Krčmář
gt; > Cc: Paolo Bonzini <pbonz...@redhat.com> > Cc: Radim Krčmář <rkrc...@redhat.com> > Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> > --- This patch breaks SVM, so I've taken the series off kvm/queue for now; I'll look into it tomorrow. The e

Re: [PATCH v7 2/4] KVM: async_pf: Add L1 guest async_pf #PF vmexit handler

2017-07-12 Thread Radim Krčmář
2017-06-28 20:01-0700, Wanpeng Li: > From: Wanpeng Li > > This patch adds the L1 guest async page fault #PF vmexit handler, such > #PF is converted into vmexit from L2 to L1 on #PF which is then handled > by L1 similar to ordinary async page fault. > > Cc: Paolo Bonzin

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-12 Thread Radim Krčmář
2017-07-12 14:11-0400, Bandan Das: > As much as I would like to disagree with you, I have already spent way more > time on this then I want. Please let's just leave it here, then ? The mmu > unload > will make sure there's an invalid root hpa and whatever happens next, happens. Sure; let's

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-12 Thread Radim Krčmář
2017-07-12 14:11-0400, Bandan Das: > As much as I would like to disagree with you, I have already spent way more > time on this then I want. Please let's just leave it here, then ? The mmu > unload > will make sure there's an invalid root hpa and whatever happens next, happens. Sure; let's

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-12 Thread Radim Krčmář
2017-07-11 16:45-0400, Bandan Das: > Radim Krčmář <rkrc...@redhat.com> writes: > > > 2017-07-11 15:38-0400, Bandan Das: > >> Radim Krčmář <rkrc...@redhat.com> writes: > >> > >> > 2017-07-11 14:35-0400, Bandan Das: > >> >> Ji

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-12 Thread Radim Krčmář
2017-07-11 16:45-0400, Bandan Das: > Radim Krčmář writes: > > > 2017-07-11 15:38-0400, Bandan Das: > >> Radim Krčmář writes: > >> > >> > 2017-07-11 14:35-0400, Bandan Das: > >> >> Jim Mattson writes: > >> >>

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-12 Thread Radim Krčmář
2017-07-11 17:08-0400, Bandan Das: > Radim Krčmář <rkrc...@redhat.com> writes: > > > 2017-07-11 16:34-0400, Bandan Das: > >> Radim Krčmář <rkrc...@redhat.com> writes: > >> > >> > 2017-07-11 15:50-0400, Bandan Das: > >> >> Radi

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-12 Thread Radim Krčmář
2017-07-11 17:08-0400, Bandan Das: > Radim Krčmář writes: > > > 2017-07-11 16:34-0400, Bandan Das: > >> Radim Krčmář writes: > >> > >> > 2017-07-11 15:50-0400, Bandan Das: > >> >> Radim Krčmář writes: > >> >

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 16:34-0400, Bandan Das: > Radim Krčmář <rkrc...@redhat.com> writes: > > > 2017-07-11 15:50-0400, Bandan Das: > >> Radim Krčmář <rkrc...@redhat.com> writes: > >> > 2017-07-11 14:24-0400, Bandan Das: > >> >> Bandan Das <

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 16:34-0400, Bandan Das: > Radim Krčmář writes: > > > 2017-07-11 15:50-0400, Bandan Das: > >> Radim Krčmář writes: > >> > 2017-07-11 14:24-0400, Bandan Das: > >> >> Bandan Das writes: > >> >> > If there's a triple faul

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 15:38-0400, Bandan Das: > Radim Krčmář <rkrc...@redhat.com> writes: > > > 2017-07-11 14:35-0400, Bandan Das: > >> Jim Mattson <jmatt...@google.com> writes: > >> ... > >> >>> I can find the definition for an vmexit in case o

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 15:38-0400, Bandan Das: > Radim Krčmář writes: > > > 2017-07-11 14:35-0400, Bandan Das: > >> Jim Mattson writes: > >> ... > >> >>> I can find the definition for an vmexit in case of index >= > >> >>> V

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 15:50-0400, Bandan Das: > Radim Krčmář <rkrc...@redhat.com> writes: > > 2017-07-11 14:24-0400, Bandan Das: > >> Bandan Das <b...@redhat.com> writes: > >> > If there's a triple fault, I think it's a good idea to inject it > >> > b

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 15:50-0400, Bandan Das: > Radim Krčmář writes: > > 2017-07-11 14:24-0400, Bandan Das: > >> Bandan Das writes: > >> > If there's a triple fault, I think it's a good idea to inject it > >> > back. Basically, there's no need to take care of dama

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 14:24-0400, Bandan Das: > Bandan Das writes: > > If there's a triple fault, I think it's a good idea to inject it > > back. Basically, there's no need to take care of damage control > > that L1 is intentionally doing. > > > >>> + goto fail; > >>> +

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 14:24-0400, Bandan Das: > Bandan Das writes: > > If there's a triple fault, I think it's a good idea to inject it > > back. Basically, there's no need to take care of damage control > > that L1 is intentionally doing. > > > >>> + goto fail; > >>> +

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 14:35-0400, Bandan Das: > Jim Mattson writes: > ... > >>> I can find the definition for an vmexit in case of index >= > >>> VMFUNC_EPTP_ENTRIES, but not for !vmcs12->eptp_list_address in the SDM. > >>> > >>> Can you give me a hint? > >> > >> I don't think there is.

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 14:35-0400, Bandan Das: > Jim Mattson writes: > ... > >>> I can find the definition for an vmexit in case of index >= > >>> VMFUNC_EPTP_ENTRIES, but not for !vmcs12->eptp_list_address in the SDM. > >>> > >>> Can you give me a hint? > >> > >> I don't think there is. Since, we are

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 14:05-0400, Bandan Das: > Radim Krčmář <rkrc...@redhat.com> writes: > > > [David did a great review, so I'll just point out things I noticed.] > > > > 2017-07-11 09:51+0200, David Hildenbrand: > >> On 10.07.2017 22:49, Bandan Das wrote:

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
2017-07-11 14:05-0400, Bandan Das: > Radim Krčmář writes: > > > [David did a great review, so I'll just point out things I noticed.] > > > > 2017-07-11 09:51+0200, David Hildenbrand: > >> On 10.07.2017 22:49, Bandan Das wrote: > >> > When L2 u

Re: [PATCH] KVM: VMX: Fix invalid guest state detection after task-switch emulation

2017-07-11 Thread Radim Krčmář
lation_required > to be set, when in fact invalid guest state emulation is not needed. > > This patch fixes it by updating vmx->emulation_required after the > rflags (and vm86 flag) is updated in task-switch emulation. > > Suggested-by: Nadav Amit <nadav.a...@gmail.com>

Re: [PATCH] KVM: VMX: Fix invalid guest state detection after task-switch emulation

2017-07-11 Thread Radim Krčmář
; to be set, when in fact invalid guest state emulation is not needed. > > This patch fixes it by updating vmx->emulation_required after the > rflags (and vm86 flag) is updated in task-switch emulation. > > Suggested-by: Nadav Amit > Cc: Paolo Bonzini > Cc: Radim Krčmář > Cc:

Re: [PATCH] KVM: s390: Fix KVM_S390_GET_CMMA_BITS ioctl definition

2017-07-11 Thread Radim Krčmář
2017-07-11 10:21+0200, Christian Borntraeger: > On 07/10/2017 11:23 PM, Gleb Fotengauer-Malinovskiy wrote: > > On Mon, Jul 10, 2017 at 08:43:12PM +0200, Christian Borntraeger wrote: > >> On 07/10/2017 04:44 PM, Gleb Fotengauer-Malinovskiy wrote: > >>> This ioctl actually writes to parameter too. >

Re: [PATCH] KVM: s390: Fix KVM_S390_GET_CMMA_BITS ioctl definition

2017-07-11 Thread Radim Krčmář
2017-07-11 10:21+0200, Christian Borntraeger: > On 07/10/2017 11:23 PM, Gleb Fotengauer-Malinovskiy wrote: > > On Mon, Jul 10, 2017 at 08:43:12PM +0200, Christian Borntraeger wrote: > >> On 07/10/2017 04:44 PM, Gleb Fotengauer-Malinovskiy wrote: > >>> This ioctl actually writes to parameter too. >

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
[David did a great review, so I'll just point out things I noticed.] 2017-07-11 09:51+0200, David Hildenbrand: > On 10.07.2017 22:49, Bandan Das wrote: > > When L2 uses vmfunc, L0 utilizes the associated vmexit to > > emulate a switching of the ept pointer by reloading the > > guest MMU. > > > >

Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor

2017-07-11 Thread Radim Krčmář
[David did a great review, so I'll just point out things I noticed.] 2017-07-11 09:51+0200, David Hildenbrand: > On 10.07.2017 22:49, Bandan Das wrote: > > When L2 uses vmfunc, L0 utilizes the associated vmexit to > > emulate a switching of the ept pointer by reloading the > > guest MMU. > > > >

[PATCH] KVM: x86: take slots_lock in kvm_free_pit

2017-07-10 Thread Radim Krčmář
x2d/0x30 [kvm] kvm_put_kvm+0xa7/0x2a0 [kvm] kvm_vm_release+0x21/0x30 [kvm] Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- arch/x86/kvm/i8254.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index a78b445ce411..af192895b1fc 100644

[PATCH] KVM: x86: take slots_lock in kvm_free_pit

2017-07-10 Thread Radim Krčmář
x2d/0x30 [kvm] kvm_put_kvm+0xa7/0x2a0 [kvm] kvm_vm_release+0x21/0x30 [kvm] Signed-off-by: Radim Krčmář --- arch/x86/kvm/i8254.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index a78b445ce411..af192895b1fc 100644 --- a/arch/x86/kvm/i8254.c +

Re: [PATCH 2/2] x86/idle: use dynamic halt poll

2017-07-04 Thread Radim Krčmář
2017-07-03 17:28+0800, Yang Zhang: > The background is that we(Alibaba Cloud) do get more and more complaints > from our customers in both KVM and Xen compare to bare-mental.After > investigations, the root cause is known to us: big cost in message passing > workload(David show it in KVM forum

Re: [PATCH 2/2] x86/idle: use dynamic halt poll

2017-07-04 Thread Radim Krčmář
2017-07-03 17:28+0800, Yang Zhang: > The background is that we(Alibaba Cloud) do get more and more complaints > from our customers in both KVM and Xen compare to bare-mental.After > investigations, the root cause is known to us: big cost in message passing > workload(David show it in KVM forum

Re: [PATCH v6 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-28 Thread Radim Krčmář
n fields. Force a >> nested VM exit from nested_vmx_check_exception() if the injected #PF is >> async page fault. Extending the userspace interface KVM_GET_VCPU_EVENTS >> and KVM_SET_VCPU_EVENTS for live migration. >> >> Cc: Paolo Bonzini <pbonz...@redhat.com&g

Re: [PATCH v6 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-28 Thread Radim Krčmář
orce a >> nested VM exit from nested_vmx_check_exception() if the injected #PF is >> async page fault. Extending the userspace interface KVM_GET_VCPU_EVENTS >> and KVM_SET_VCPU_EVENTS for live migration. >> >> Cc: Paolo Bonzini >> Cc: Radim Krčmář >> Signed-off-by: Wa

Re: [PATCH 2/2] x86/idle: use dynamic halt poll

2017-06-27 Thread Radim Krčmář
2017-06-27 15:56+0200, Paolo Bonzini: > On 27/06/2017 15:40, Radim Krčmář wrote: >>> ... which is not necessarily _wrong_. It's just a different heuristic. >> Right, it's just harder to use than host's single_task_running() -- the >> VCPU calling vcpu_is_preempted() is nev

Re: [PATCH 2/2] x86/idle: use dynamic halt poll

2017-06-27 Thread Radim Krčmář
2017-06-27 15:56+0200, Paolo Bonzini: > On 27/06/2017 15:40, Radim Krčmář wrote: >>> ... which is not necessarily _wrong_. It's just a different heuristic. >> Right, it's just harder to use than host's single_task_running() -- the >> VCPU calling vcpu_is_preempted() is nev

Re: [PATCH 0/2] x86/idle: add halt poll support

2017-06-27 Thread Radim Krčmář
2017-06-23 14:49+0800, Yang Zhang: > On 2017/6/23 12:35, Wanpeng Li wrote: > > 2017-06-23 12:08 GMT+08:00 Yang Zhang : > > > On 2017/6/22 19:50, Wanpeng Li wrote: > > > > > > > > 2017-06-22 19:22 GMT+08:00 root : > > > > > > > > > > From: Yang

Re: [PATCH 0/2] x86/idle: add halt poll support

2017-06-27 Thread Radim Krčmář
2017-06-23 14:49+0800, Yang Zhang: > On 2017/6/23 12:35, Wanpeng Li wrote: > > 2017-06-23 12:08 GMT+08:00 Yang Zhang : > > > On 2017/6/22 19:50, Wanpeng Li wrote: > > > > > > > > 2017-06-22 19:22 GMT+08:00 root : > > > > > > > > > > From: Yang Zhang > > > > > > > > > > Some latency-intensive

Re: [PATCH 2/2] x86/idle: use dynamic halt poll

2017-06-27 Thread Radim Krčmář
2017-06-27 14:28+0200, Paolo Bonzini: > On 27/06/2017 14:23, Wanpeng Li wrote: > I have considered single_task_running() before. But since there is no > such paravirtual interface currently and i am not sure whether it is a > information leak from host if introducing such interface, so

Re: [PATCH 2/2] x86/idle: use dynamic halt poll

2017-06-27 Thread Radim Krčmář
2017-06-27 14:28+0200, Paolo Bonzini: > On 27/06/2017 14:23, Wanpeng Li wrote: > I have considered single_task_running() before. But since there is no > such paravirtual interface currently and i am not sure whether it is a > information leak from host if introducing such interface, so

[GIT PULL] KVM fixes for v4.12-rc7

2017-06-22 Thread Radim Krčmář
of debug registers KVM: PPC: Book3S HV: Ignore timebase offset on POWER9 DD1 Radim Krčmář (2): Merge branch 'kvm-ppc-fixes' of git://git.kernel.org/.../paulus/powerpc Merge tag 'kvm-s390-master-4.12-2' of git://git.kernel.org/.../kvms390/linux arch/mips/kvm/tlb.c

[GIT PULL] KVM fixes for v4.12-rc7

2017-06-22 Thread Radim Krčmář
of debug registers KVM: PPC: Book3S HV: Ignore timebase offset on POWER9 DD1 Radim Krčmář (2): Merge branch 'kvm-ppc-fixes' of git://git.kernel.org/.../paulus/powerpc Merge tag 'kvm-s390-master-4.12-2' of git://git.kernel.org/.../kvms390/linux arch/mips/kvm/tlb.c

Re: [PATCH RFC] KVM: VMX: drop vmm_exclusive module parameter

2017-06-21 Thread Radim Krčmář
2017-06-21 14:48-0300, Arnaldo Carvalho de Melo: > Em Fri, Mar 10, 2017 at 12:47:13PM +0100, David Hildenbrand escreveu: > > vmm_exclusive=0 leads to KVM setting X86_CR4_VMXE always and calling > > VMXON only when the vcpu is loaded. X86_CR4_VMXE is used as an > > indication in

Re: [PATCH RFC] KVM: VMX: drop vmm_exclusive module parameter

2017-06-21 Thread Radim Krčmář
2017-06-21 14:48-0300, Arnaldo Carvalho de Melo: > Em Fri, Mar 10, 2017 at 12:47:13PM +0100, David Hildenbrand escreveu: > > vmm_exclusive=0 leads to KVM setting X86_CR4_VMXE always and calling > > VMXON only when the vcpu is loaded. X86_CR4_VMXE is used as an > > indication in

Re: [PATCH v2 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-20 Thread Radim Krčmář
2017-06-20 05:47+0800, Wanpeng Li: > 2017-06-19 22:51 GMT+08:00 Radim Krčmář <rkrc...@redhat.com>: > > 2017-06-17 13:52+0800, Wanpeng Li: > >> 2017-06-16 23:38 GMT+08:00 Radim Krčmář <rkrc...@redhat.com>: > >> > 2017-06-16 22:24+0800, Wanpeng Li: >

Re: [PATCH v2 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-20 Thread Radim Krčmář
2017-06-20 05:47+0800, Wanpeng Li: > 2017-06-19 22:51 GMT+08:00 Radim Krčmář : > > 2017-06-17 13:52+0800, Wanpeng Li: > >> 2017-06-16 23:38 GMT+08:00 Radim Krčmář : > >> > 2017-06-16 22:24+0800, Wanpeng Li: > >> >> 2017-06-16 21:37 GMT+08:00 Radim Krčm

Re: [PATCH v2 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-19 Thread Radim Krčmář
2017-06-17 13:52+0800, Wanpeng Li: > 2017-06-16 23:38 GMT+08:00 Radim Krčmář <rkrc...@redhat.com>: > > 2017-06-16 22:24+0800, Wanpeng Li: > >> 2017-06-16 21:37 GMT+08:00 Radim Krčmář <rkrc...@redhat.com>: > >> > 2017-06-14 19:26-0700, Wanpeng Li: > &

Re: [PATCH v2 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-19 Thread Radim Krčmář
2017-06-17 13:52+0800, Wanpeng Li: > 2017-06-16 23:38 GMT+08:00 Radim Krčmář : > > 2017-06-16 22:24+0800, Wanpeng Li: > >> 2017-06-16 21:37 GMT+08:00 Radim Krčmář : > >> > 2017-06-14 19:26-0700, Wanpeng Li: > >> >> From: Wanpeng Li > >

Re: [PATCH v2 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-16 Thread Radim Krčmář
2017-06-16 22:24+0800, Wanpeng Li: > 2017-06-16 21:37 GMT+08:00 Radim Krčmář <rkrc...@redhat.com>: > > 2017-06-14 19:26-0700, Wanpeng Li: > >> From: Wanpeng Li <wanpeng...@hotmail.com> > >> > >> Add an async_page_fault field to vcpu->

Re: [PATCH v2 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-16 Thread Radim Krčmář
2017-06-16 22:24+0800, Wanpeng Li: > 2017-06-16 21:37 GMT+08:00 Radim Krčmář : > > 2017-06-14 19:26-0700, Wanpeng Li: > >> From: Wanpeng Li > >> > >> Add an async_page_fault field to vcpu->arch.exception to identify an async > >> page fault, and co

Re: [PATCH v2 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-16 Thread Radim Krčmář
sted_vmx_check_exception() if the injected #PF > is async page fault. > > Cc: Paolo Bonzini <pbonz...@redhat.com> > Cc: Radim Krčmář <rkrc...@redhat.com> > Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com> > --- > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.

Re: [PATCH v2 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-16 Thread Radim Krčmář
ed #PF > is async page fault. > > Cc: Paolo Bonzini > Cc: Radim Krčmář > Signed-off-by: Wanpeng Li > --- > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > @@ -452,7 +452,11 @@ EXPORT_SYMBOL_GPL(kvm_complete_insn_gp); > void kvm_inject_page_fault(struct k

Re: [PATCH 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-14 Thread Radim Krčmář
2017-06-14 22:32+0800, Wanpeng Li: > 2017-06-14 21:20 GMT+08:00 Radim Krčmář <rkrc...@redhat.com>: > > 2017-06-14 21:02+0800, Wanpeng Li: > >> 2017-06-14 20:52 GMT+08:00 Radim Krčmář <rkrc...@redhat.com>: > >> > 2017-06-14 09:07+0800, Wanpeng Li: >

Re: [PATCH 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-14 Thread Radim Krčmář
2017-06-14 22:32+0800, Wanpeng Li: > 2017-06-14 21:20 GMT+08:00 Radim Krčmář : > > 2017-06-14 21:02+0800, Wanpeng Li: > >> 2017-06-14 20:52 GMT+08:00 Radim Krčmář : > >> > 2017-06-14 09:07+0800, Wanpeng Li: > >> >> 2017-06-14 2:55 GMT+08:00

Re: [PATCH 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf

2017-06-14 Thread Radim Krčmář
2017-06-14 21:02+0800, Wanpeng Li: > 2017-06-14 20:52 GMT+08:00 Radim Krčmář <rkrc...@redhat.com>: > > 2017-06-14 09:07+0800, Wanpeng Li: > >> 2017-06-14 2:55 GMT+08:00 Radim Krčmář <rkrc...@redhat.com>: > >> > Using vcpu->arch.cr2 is suspicious as VMX

<    1   2   3   4   5   6   7   8   9   10   >