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

2017-03-14 Thread Radim Krčmář
exclusive=0 > this seems to be pretty much untested. So let's better drop it. Totally, Reviewed-by: Radim Krčmář > While at it, directly move setting/clearing X86_CR4_VMXE into > kvm_cpu_vmxon/off. > > Signed-off-by: David Hildenbrand > --- > arch/x86/kvm/vmx.c | 38 +++

Re: kvm: WARNING in mmu_spte_clear_track_bits

2017-03-14 Thread Radim Krčmář
2017-03-12 12:20+0100, Dmitry Vyukov: > On Tue, Jan 17, 2017 at 5:00 PM, Dmitry Vyukov wrote: >> On Tue, Jan 17, 2017 at 4:20 PM, Paolo Bonzini wrote: >>> >>> >>> On 13/01/2017 12:15, Dmitry Vyukov wrote: I've commented out the WARNING for now,

Re: kvm: WARNING in mmu_spte_clear_track_bits

2017-03-14 Thread Radim Krčmář
2017-03-12 12:20+0100, Dmitry Vyukov: > On Tue, Jan 17, 2017 at 5:00 PM, Dmitry Vyukov wrote: >> On Tue, Jan 17, 2017 at 4:20 PM, Paolo Bonzini wrote: >>> >>> >>> On 13/01/2017 12:15, Dmitry Vyukov wrote: I've commented out the WARNING for now, but I am seeing lots of

Re: [PATCH v3] kvm: better MWAIT emulation for guests

2017-03-14 Thread Radim Krčmář
2017-03-14 01:44+0200, Michael S. Tsirkin: > Guests running Mac OS 5, 6, and 7 (Leopard through Lion) have a problem: > unless explicitly provided with kernel command line argument > "idlehalt=0" they'd implicitly assume MONITOR and MWAIT availability, > without checking CPUID. > > We currently

Re: [PATCH v3] kvm: better MWAIT emulation for guests

2017-03-14 Thread Radim Krčmář
2017-03-14 01:44+0200, Michael S. Tsirkin: > Guests running Mac OS 5, 6, and 7 (Leopard through Lion) have a problem: > unless explicitly provided with kernel command line argument > "idlehalt=0" they'd implicitly assume MONITOR and MWAIT availability, > without checking CPUID. > > We currently

Re: [PATCH] kvm: better MWAIT emulation for guests

2017-03-13 Thread Radim Krčmář
2017-03-13 22:03+0200, Michael S. Tsirkin: > On Mon, Mar 13, 2017 at 08:39:11PM +0100, Radim Krčmář wrote: > > 2017-03-13 18:08+0200, Michael S. Tsirkin: > > > On Mon, Mar 13, 2017 at 04:46:20PM +0100, Radim Krčmář wrote: >> >> What about keeping just the last

Re: [PATCH] kvm: better MWAIT emulation for guests

2017-03-13 Thread Radim Krčmář
2017-03-13 22:03+0200, Michael S. Tsirkin: > On Mon, Mar 13, 2017 at 08:39:11PM +0100, Radim Krčmář wrote: > > 2017-03-13 18:08+0200, Michael S. Tsirkin: > > > On Mon, Mar 13, 2017 at 04:46:20PM +0100, Radim Krčmář wrote: >> >> What about keeping just the last

Re: [PATCH] kvm: better MWAIT emulation for guests

2017-03-13 Thread Radim Krčmář
2017-03-13 18:08+0200, Michael S. Tsirkin: > On Mon, Mar 13, 2017 at 04:46:20PM +0100, Radim Krčmář wrote: >> 2017-03-10 00:29+0200, Michael S. Tsirkin: >> > Some guests call mwait without checking the cpu flags. We currently >> > emulate that as a NOP but on VMX we ca

Re: [PATCH] kvm: better MWAIT emulation for guests

2017-03-13 Thread Radim Krčmář
2017-03-13 18:08+0200, Michael S. Tsirkin: > On Mon, Mar 13, 2017 at 04:46:20PM +0100, Radim Krčmář wrote: >> 2017-03-10 00:29+0200, Michael S. Tsirkin: >> > Some guests call mwait without checking the cpu flags. We currently >> > emulate that as a NOP but on VMX we ca

Re: [PATCH] kvm: better MWAIT emulation for guests

2017-03-13 Thread Radim Krčmář
2017-03-10 00:29+0200, Michael S. Tsirkin: > Some guests call mwait without checking the cpu flags. We currently > emulate that as a NOP but on VMX we can do better: let guest stop the > CPU until timer or IPI. CPU will be busy but that isn't any worse than > a NOP emulation. > > Note that

Re: [PATCH] kvm: better MWAIT emulation for guests

2017-03-13 Thread Radim Krčmář
2017-03-10 00:29+0200, Michael S. Tsirkin: > Some guests call mwait without checking the cpu flags. We currently > emulate that as a NOP but on VMX we can do better: let guest stop the > CPU until timer or IPI. CPU will be busy but that isn't any worse than > a NOP emulation. > > Note that

[GIT PULL] KVM fixes for 4.11-rc2

2017-03-11 Thread Radim Krčmář
't pretend to support IRQ/FIQ bypass Mark Rutland (2): arm: KVM: Survive unknown traps from guests arm64: KVM: Survive unknown traps from guests Radim Krčmář (2): KVM: nVMX: do not warn when MSR bitmap address is not backed Merge tag 'kvm-arm-for-4.11-rc2' of git://git.kernel.org/

[GIT PULL] KVM fixes for 4.11-rc2

2017-03-11 Thread Radim Krčmář
't pretend to support IRQ/FIQ bypass Mark Rutland (2): arm: KVM: Survive unknown traps from guests arm64: KVM: Survive unknown traps from guests Radim Krčmář (2): KVM: nVMX: do not warn when MSR bitmap address is not backed Merge tag 'kvm-arm-for-4.11-rc2' of git://git.kernel.org/

Re: [PATCH] KVM: nVMX: do not warn when MSR bitmap address is not backed

2017-03-07 Thread Radim Krčmář
ta sheets, but couldn't find where they say that :( Emulating a (preferable userspace-configurable) fallback would need deeper changes, though. > Reviewed-by: Jim Mattson <jmatt...@google.com> > > On Tue, Mar 7, 2017 at 8:51 AM, Radim Krčmář <rkrc...@redhat.com> wrote: >>

Re: [PATCH] KVM: nVMX: do not warn when MSR bitmap address is not backed

2017-03-07 Thread Radim Krčmář
ta sheets, but couldn't find where they say that :( Emulating a (preferable userspace-configurable) fallback would need deeper changes, though. > Reviewed-by: Jim Mattson > > On Tue, Mar 7, 2017 at 8:51 AM, Radim Krčmář wrote: >> Before trying to do nested_get_page() in nested_vmx_merge_

[PATCH] KVM: nVMX: do not warn when MSR bitmap address is not backed

2017-03-07 Thread Radim Krčmář
kvm_vcpu_ioctl+0x673/0x1120 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2570 Reported-by: Dmitry Vyukov <dvyu...@google.com> Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- arch/x86/kvm/vmx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x

[PATCH] KVM: nVMX: do not warn when MSR bitmap address is not backed

2017-03-07 Thread Radim Krčmář
kvm_vcpu_ioctl+0x673/0x1120 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2570 Reported-by: Dmitry Vyukov Signed-off-by: Radim Krčmář --- arch/x86/kvm/vmx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ab338581b3ec..98e82ee1e699 100644

Re: [PATCH v3] KVM: nVMX: reset nested_run_pending if the vCPU is going to be reset

2017-03-07 Thread Radim Krčmář
n should be stopped since the CPU is going to > reset here. This patch resets the nested_run_pending since the CPU is going > to be reset hence there should be nothing pending. > > Reported-by: Dmitry Vyukov <dvyu...@google.com> > Suggested-by: Radim Krčmář <rkrc...@redh

Re: [PATCH v3] KVM: nVMX: reset nested_run_pending if the vCPU is going to be reset

2017-03-07 Thread Radim Krčmář
ince the CPU is going to > reset here. This patch resets the nested_run_pending since the CPU is going > to be reset hence there should be nothing pending. > > Reported-by: Dmitry Vyukov > Suggested-by: Radim Krčmář > Cc: Paolo Bonzini > Cc: Radim Krčmář > Cc: Dmitry Vyukov &

[GIT PULL] Second batch of KVM changes for 4.11 merge window

2017-03-04 Thread Radim Krčmář
to refcount_t Jérémy Lefaure (1): x86/kvm/vmx: remove unused variable in segment_base() Paul Mackerras (2): KVM: PPC: Book3S HV: Fix software walk of guest process page tables KVM: PPC: Book3S HV: Don't use ASDR for real-mode HPT faults on POWER9 Radim Krčmář (1): Merge branch

[GIT PULL] Second batch of KVM changes for 4.11 merge window

2017-03-04 Thread Radim Krčmář
to refcount_t Jérémy Lefaure (1): x86/kvm/vmx: remove unused variable in segment_base() Paul Mackerras (2): KVM: PPC: Book3S HV: Fix software walk of guest process page tables KVM: PPC: Book3S HV: Don't use ASDR for real-mode HPT faults on POWER9 Radim Krčmář (1): Merge branch

Re: kvm: WARNING in nested_vmx_vmexit

2017-03-02 Thread Radim Krčmář
2017-03-02 20:28+0800, Wanpeng Li: > 2017-03-02 2:31 GMT+08:00 Radim Krčmář <rkrc...@redhat.com>: >> 2017-03-01 10:44+0100, Dmitry Vyukov: >>> On Wed, Mar 1, 2017 at 7:13 AM, Wanpeng Li <kernel...@gmail.com> wrote: >>>> 2017-02-28 20:15 GMT+08:00 Dmitr

Re: kvm: WARNING in nested_vmx_vmexit

2017-03-02 Thread Radim Krčmář
2017-03-02 20:28+0800, Wanpeng Li: > 2017-03-02 2:31 GMT+08:00 Radim Krčmář : >> 2017-03-01 10:44+0100, Dmitry Vyukov: >>> On Wed, Mar 1, 2017 at 7:13 AM, Wanpeng Li wrote: >>>> 2017-02-28 20:15 GMT+08:00 Dmitry Vyukov : >>>>> Hello, >&

Re: kvm: WARNING in nested_vmx_merge_msr_bitmap

2017-03-01 Thread Radim Krčmář
2017-02-28 13:07-0800, Jim Mattson: > I believe this happens when the VMCS12 MSR bitmap address is valid, > but no device is configured to respond to the bus request. I agree > that the warning should be removed. However, in this case, the VMCS12 > MSR bitmap should read as all 1s. The same is

Re: kvm: WARNING in nested_vmx_merge_msr_bitmap

2017-03-01 Thread Radim Krčmář
2017-02-28 13:07-0800, Jim Mattson: > I believe this happens when the VMCS12 MSR bitmap address is valid, > but no device is configured to respond to the bus request. I agree > that the warning should be removed. However, in this case, the VMCS12 > MSR bitmap should read as all 1s. The same is

Re: kvm: WARNING in nested_vmx_vmexit

2017-03-01 Thread Radim Krčmář
2017-03-01 10:44+0100, Dmitry Vyukov: > On Wed, Mar 1, 2017 at 7:13 AM, Wanpeng Li wrote: >> 2017-02-28 20:15 GMT+08:00 Dmitry Vyukov : >>> Hello, >>> >>> The following program triggers WARNING in nested_vmx_vmexit: >>>

Re: kvm: WARNING in nested_vmx_vmexit

2017-03-01 Thread Radim Krčmář
2017-03-01 10:44+0100, Dmitry Vyukov: > On Wed, Mar 1, 2017 at 7:13 AM, Wanpeng Li wrote: >> 2017-02-28 20:15 GMT+08:00 Dmitry Vyukov : >>> Hello, >>> >>> The following program triggers WARNING in nested_vmx_vmexit: >>>

Re: [PATCH v2 4/5] KVM: MIPS: remove useless kvm_request_clear

2017-03-01 Thread Radim Krčmář
2017-02-28 11:29+, James Hogan: > On Mon, Feb 27, 2017 at 11:03:51AM +0100, David Hildenbrand wrote: >> Am 27.02.2017 um 09:45 schrieb Andrew Jones: >> > On Fri, Feb 24, 2017 at 08:50:01PM +0100, Radim Krčmář wrote: >> >> Signed-off-by: Radim Krčmář <rkrc...@

Re: [PATCH v2 4/5] KVM: MIPS: remove useless kvm_request_clear

2017-03-01 Thread Radim Krčmář
2017-02-28 11:29+, James Hogan: > On Mon, Feb 27, 2017 at 11:03:51AM +0100, David Hildenbrand wrote: >> Am 27.02.2017 um 09:45 schrieb Andrew Jones: >> > On Fri, Feb 24, 2017 at 08:50:01PM +0100, Radim Krčmář wrote: >> >> Signed-off-by: Radim Krčmář >> &

Re: kvm: WARNING in nested_vmx_vmexit

2017-03-01 Thread Radim Krčmář
2017-02-28 13:48+0100, Dmitry Vyukov: > On Tue, Feb 28, 2017 at 1:15 PM, Dmitry Vyukov wrote: >> Hello, >> >> The following program triggers WARNING in nested_vmx_vmexit: >>

Re: kvm: WARNING in nested_vmx_vmexit

2017-03-01 Thread Radim Krčmář
2017-02-28 13:48+0100, Dmitry Vyukov: > On Tue, Feb 28, 2017 at 1:15 PM, Dmitry Vyukov wrote: >> Hello, >> >> The following program triggers WARNING in nested_vmx_vmexit: >>

Re: [PATCH v2 2/5] KVM: add KVM request variants without barrier

2017-03-01 Thread Radim Krčmář
2017-02-28 15:40+0800, Peter Xu: > On Tue, Feb 28, 2017 at 03:34:24PM +0800, Peter Xu wrote: > > [...] > >> > diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c >> > index ee4af898bcf6..552ae2b5e911 100644 >> > --- a/arch/mips/kvm/emulate.c >> > +++ b/arch/mips/kvm/emulate.c >> > @@

Re: [PATCH v2 2/5] KVM: add KVM request variants without barrier

2017-03-01 Thread Radim Krčmář
2017-02-28 15:40+0800, Peter Xu: > On Tue, Feb 28, 2017 at 03:34:24PM +0800, Peter Xu wrote: > > [...] > >> > diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c >> > index ee4af898bcf6..552ae2b5e911 100644 >> > --- a/arch/mips/kvm/emulate.c >> > +++ b/arch/mips/kvm/emulate.c >> > @@

Re: [PATCH v2 2/5] KVM: add KVM request variants without barrier

2017-03-01 Thread Radim Krčmář
2017-02-27 11:18+0100, David Hildenbrand: > Am 27.02.2017 um 11:02 schrieb David Hildenbrand: >> Am 24.02.2017 um 20:49 schrieb Radim Krčmář: >>> The leading underscores denote that the call is just a bitop wrapper. >> >> Actually, the leading underscore is mislead

Re: [PATCH v2 2/5] KVM: add KVM request variants without barrier

2017-03-01 Thread Radim Krčmář
2017-02-27 11:18+0100, David Hildenbrand: > Am 27.02.2017 um 11:02 schrieb David Hildenbrand: >> Am 24.02.2017 um 20:49 schrieb Radim Krčmář: >>> The leading underscores denote that the call is just a bitop wrapper. >> >> Actually, the leading underscore is mislead

Re: [PATCH v2 1/5] KVM: rename API for requests to match bit operations

2017-03-01 Thread Radim Krčmář
2017-02-27 10:54+0100, David Hildenbrand: > Am 24.02.2017 um 20:49 schrieb Radim Krčmář: >> kvm_make_request was a wrapper that added barriers to set_bit and >> kvm_check_request did the same for test_bit and check_bit, but the name >> was not very obvious

Re: [PATCH v2 1/5] KVM: rename API for requests to match bit operations

2017-03-01 Thread Radim Krčmář
2017-02-27 10:54+0100, David Hildenbrand: > Am 24.02.2017 um 20:49 schrieb Radim Krčmář: >> kvm_make_request was a wrapper that added barriers to set_bit and >> kvm_check_request did the same for test_bit and check_bit, but the name >> was not very obvious

Re: [PATCH v3] KVM: nVMX: Fix pending events injection

2017-03-01 Thread Radim Krčmář
> nested events check to kvm_vcpu_running")' results in the handle events > order reversely on non-APICv box. This patch fixes it by bailing out for > pending events and not consider new events in this scenario. > > Cc: Paolo Bonzini <pbonz...@redhat.com> > Cc: Radi

Re: [PATCH v3] KVM: nVMX: Fix pending events injection

2017-03-01 Thread Radim Krčmář
vm_vcpu_running")' results in the handle events > order reversely on non-APICv box. This patch fixes it by bailing out for > pending events and not consider new events in this scenario. > > Cc: Paolo Bonzini > Cc: Radim Krčmář > Cc: Jan Kiszka > Signed-off-by

[PATCH v2 3/5] KVM: add kvm_request_pending

2017-02-24 Thread Radim Krčmář
Just to complete the encapsulation. Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- v2: add READ_ONCE [Drew] --- arch/mips/kvm/trap_emul.c | 2 +- arch/powerpc/kvm/booke.c | 2 +- arch/powerpc/kvm/powerpc.c | 4 ++-- arch/s390/kvm/kvm-s390.c | 2 +- arch/x86/kvm/x86.c

[PATCH v2 3/5] KVM: add kvm_request_pending

2017-02-24 Thread Radim Krčmář
Just to complete the encapsulation. Signed-off-by: Radim Krčmář --- v2: add READ_ONCE [Drew] --- arch/mips/kvm/trap_emul.c | 2 +- arch/powerpc/kvm/booke.c | 2 +- arch/powerpc/kvm/powerpc.c | 4 ++-- arch/s390/kvm/kvm-s390.c | 2 +- arch/x86/kvm/x86.c | 4 ++-- include/linux

[PATCH v2 0/5] KVM: rename and encapsulate vcpu->requests API

2017-02-24 Thread Radim Krčmář
(Paolo) * added a MIPS cleanup, [4/5] Radim Krčmář (5): KVM: rename API for requests to match bit operations KVM: add KVM request variants without barrier KVM: add kvm_request_pending KVM: MIPS: remove useless kvm_request_clear KVM: optimize kvm_make_all_cpus_request arch/mips/kvm/emulate.c

[PATCH v2 1/5] KVM: rename API for requests to match bit operations

2017-02-24 Thread Radim Krčmář
omated with coccinelle script: @@ expression VCPU, REQ; @@ -kvm_make_request(REQ, VCPU) +kvm_request_set(REQ, VCPU) @@ expression VCPU, REQ; @@ -kvm_check_request(REQ, VCPU) +kvm_request_test_and_clear(REQ, VCPU) Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- v2: * added s

[PATCH v2 0/5] KVM: rename and encapsulate vcpu->requests API

2017-02-24 Thread Radim Krčmář
(Paolo) * added a MIPS cleanup, [4/5] Radim Krčmář (5): KVM: rename API for requests to match bit operations KVM: add KVM request variants without barrier KVM: add kvm_request_pending KVM: MIPS: remove useless kvm_request_clear KVM: optimize kvm_make_all_cpus_request arch/mips/kvm/emulate.c

[PATCH v2 1/5] KVM: rename API for requests to match bit operations

2017-02-24 Thread Radim Krčmář
omated with coccinelle script: @@ expression VCPU, REQ; @@ -kvm_make_request(REQ, VCPU) +kvm_request_set(REQ, VCPU) @@ expression VCPU, REQ; @@ -kvm_check_request(REQ, VCPU) +kvm_request_test_and_clear(REQ, VCPU) Signed-off-by: Radim Krčmář --- v2: * added sob [Cornelia] * tweaked TODO

[PATCH v2 2/5] KVM: add KVM request variants without barrier

2017-02-24 Thread Radim Krčmář
REQ; @@ -clear_bit(REQ, >requests) +__kvm_request_clear(REQ, VCPU) @@ expression VCPU, REQ; @@ -test_bit(REQ, >requests) +__kvm_request_test(REQ, VCPU) Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- v2: clear_bit in __kvm_request_clear [Paolo] --- arch/mip

[PATCH v2 2/5] KVM: add KVM request variants without barrier

2017-02-24 Thread Radim Krčmář
REQ; @@ -clear_bit(REQ, >requests) +__kvm_request_clear(REQ, VCPU) @@ expression VCPU, REQ; @@ -test_bit(REQ, >requests) +__kvm_request_test(REQ, VCPU) Signed-off-by: Radim Krčmář --- v2: clear_bit in __kvm_request_clear [Paolo] --- arch/mips/kvm/emulate.c | 2 +- arc

[PATCH v2 5/5] KVM: optimize kvm_make_all_cpus_request

2017-02-24 Thread Radim Krčmář
Use __kvm_request_set to avoid repeated use of wmb(). kvm_make_all_cpus_request is also a candidate for renaming. Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- virt/kvm/kvm_main.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/vi

[PATCH v2 5/5] KVM: optimize kvm_make_all_cpus_request

2017-02-24 Thread Radim Krčmář
Use __kvm_request_set to avoid repeated use of wmb(). kvm_make_all_cpus_request is also a candidate for renaming. Signed-off-by: Radim Krčmář --- virt/kvm/kvm_main.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index

[PATCH v2 4/5] KVM: MIPS: remove useless kvm_request_clear

2017-02-24 Thread Radim Krčmář
Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- arch/mips/kvm/emulate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c index 552ae2b5e911..70614ca41744 100644 --- a/arch/mips/kvm/emulate.c +++ b/arch/mips/kvm/emulate.c @@ -865,7

[PATCH v2 4/5] KVM: MIPS: remove useless kvm_request_clear

2017-02-24 Thread Radim Krčmář
Signed-off-by: Radim Krčmář --- arch/mips/kvm/emulate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c index 552ae2b5e911..70614ca41744 100644 --- a/arch/mips/kvm/emulate.c +++ b/arch/mips/kvm/emulate.c @@ -865,7 +865,6 @@ enum

Re: [PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-23 Thread Radim Krčmář
2017-02-23 12:01+0100, Paolo Bonzini: > On 16/02/2017 17:04, Radim Krčmář wrote: >> A macro to optimize requests that do not need a memory barrier because >> they have no dependencies. An architecture can implement a function >> that says which requests do not need memory b

Re: [PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-23 Thread Radim Krčmář
2017-02-23 12:01+0100, Paolo Bonzini: > On 16/02/2017 17:04, Radim Krčmář wrote: >> A macro to optimize requests that do not need a memory barrier because >> they have no dependencies. An architecture can implement a function >> that says which requests do not need memory b

Re: [PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-23 Thread Radim Krčmář
2017-02-22 20:23+0100, Christian Borntraeger: > On 02/22/2017 04:17 PM, Radim Krčmář wrote: >> [Oops, the end of this thread got dragged into a mark-as-read spree ...] >> >> 2017-02-17 11:13+0100, David Hildenbrand: >>>>> This is really complicated stuf

Re: [PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-23 Thread Radim Krčmář
2017-02-22 20:23+0100, Christian Borntraeger: > On 02/22/2017 04:17 PM, Radim Krčmář wrote: >> [Oops, the end of this thread got dragged into a mark-as-read spree ...] >> >> 2017-02-17 11:13+0100, David Hildenbrand: >>>>> This is really complicated stuf

Re: [PATCH 2/5] KVM: add KVM request variants without barrier

2017-02-23 Thread Radim Krčmář
2017-02-23 11:57+0100, Paolo Bonzini: > On 16/02/2017 17:04, Radim Krčmář wrote: >> + >> +static inline void __kvm_request_clear(unsigned req, struct kvm_vcpu *vcpu) >> +{ >> +test_bit(req, >requests); >> } > > Are you sure? :) No, as always. :)

Re: [PATCH 2/5] KVM: add KVM request variants without barrier

2017-02-23 Thread Radim Krčmář
2017-02-23 11:57+0100, Paolo Bonzini: > On 16/02/2017 17:04, Radim Krčmář wrote: >> + >> +static inline void __kvm_request_clear(unsigned req, struct kvm_vcpu *vcpu) >> +{ >> +test_bit(req, >requests); >> } > > Are you sure? :) No, as always. :)

Re: [PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-23 Thread Radim Krčmář
2017-02-23 11:20+0100, David Hildenbrand: > Am 22.02.2017 um 20:57 schrieb Christian Borntraeger: >> On 02/22/2017 04:17 PM, Radim Krčmář wrote: >>> >> [...] >>> while (vcpu->arch.sie_block->prog0c & PROG_IN_SIE) >>> cpu_relax(

Re: [PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-23 Thread Radim Krčmář
2017-02-23 11:20+0100, David Hildenbrand: > Am 22.02.2017 um 20:57 schrieb Christian Borntraeger: >> On 02/22/2017 04:17 PM, Radim Krčmář wrote: >>> >> [...] >>> while (vcpu->arch.sie_block->prog0c & PROG_IN_SIE) >>> cpu_relax(

Re: [PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-22 Thread Radim Krčmář
[Oops, the end of this thread got dragged into a mark-as-read spree ...] 2017-02-17 11:13+0100, David Hildenbrand: >>> This is really complicated stuff, and the basic reason for it (if I >>> remember correctly) is that s390x does reenable all interrupts when >>> entering the sie (see

Re: [PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-22 Thread Radim Krčmář
[Oops, the end of this thread got dragged into a mark-as-read spree ...] 2017-02-17 11:13+0100, David Hildenbrand: >>> This is really complicated stuff, and the basic reason for it (if I >>> remember correctly) is that s390x does reenable all interrupts when >>> entering the sie (see

Re: [PATCH 1/5] KVM: change API for requests to match bit operations

2017-02-17 Thread Radim Krčmář
2017-02-17 10:30+0100, Cornelia Huck: > On Thu, 16 Feb 2017 17:04:45 +0100 > Radim Krčmář <rkrc...@redhat.com> wrote: > >> kvm_make_request was a wrapper that added barriers to bit_set and >> kvm_check_request did the same for bit_test and bit_check, but the name >

Re: [PATCH 1/5] KVM: change API for requests to match bit operations

2017-02-17 Thread Radim Krčmář
2017-02-17 10:30+0100, Cornelia Huck: > On Thu, 16 Feb 2017 17:04:45 +0100 > Radim Krčmář wrote: > >> kvm_make_request was a wrapper that added barriers to bit_set and >> kvm_check_request did the same for bit_test and bit_check, but the name >> was not very obvio

Re: [PATCH 5/5] KVM: add kvm_request_pending

2017-02-17 Thread Radim Krčmář
2017-02-17 10:51+0100, Andrew Jones: > On Thu, Feb 16, 2017 at 05:04:49PM +0100, Radim Krčmář wrote: > ... >> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h >> index 2cc438685af8..563cf964dc5c 100644 >> --- a/include/linux/kvm_host.h >>

Re: [PATCH 5/5] KVM: add kvm_request_pending

2017-02-17 Thread Radim Krčmář
2017-02-17 10:51+0100, Andrew Jones: > On Thu, Feb 16, 2017 at 05:04:49PM +0100, Radim Krčmář wrote: > ... >> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h >> index 2cc438685af8..563cf964dc5c 100644 >> --- a/include/linux/kvm_host.h >>

Re: [PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-16 Thread Radim Krčmář
2017-02-16 20:49+0100, David Hildenbrand: > Am 16.02.2017 um 17:04 schrieb Radim Krčmář: >> A macro to optimize requests that do not need a memory barrier because >> they have no dependencies. An architecture can implement a function >> that says which requests do not need

Re: [PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-16 Thread Radim Krčmář
2017-02-16 20:49+0100, David Hildenbrand: > Am 16.02.2017 um 17:04 schrieb Radim Krčmář: >> A macro to optimize requests that do not need a memory barrier because >> they have no dependencies. An architecture can implement a function >> that says which requests do not need

Re: [PATCH 3/3] KVM: Support vCPU-based gfn->hva cache

2017-02-16 Thread Radim Krčmář
k.com> > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- Reviewd-by: Radim Krčmář <rkrc...@redhat.com> > arch/x86/kvm/lapic.c | 22 ++ > arch/x86/kvm/x86.c | 41 ---

Re: [PATCH 3/3] KVM: Support vCPU-based gfn->hva cache

2017-02-16 Thread Radim Krčmář
be logged in the vcpu dirty ring, instead of the global dirty ring, > for ring-based dirty memory tracking. > > Signed-off-by: Lei Cao > Message-Id: > > Signed-off-by: Paolo Bonzini > --- Reviewd-by: Radim Krčmář > arch/x86/kvm/lapic.c | 22 +++

Re: [PATCH 2/3] KVM: use separate generations for each address space

2017-02-16 Thread Radim Krčmář
2017-02-15 23:00+0100, Paolo Bonzini: > This will make it easier to support multiple address spaces in > kvm_gfn_to_hva_cache_init. Instead of having to check the address > space id, we can keep on checking just the generation number. > > Signed-off-by: Paolo Bonzini > ---

Re: [PATCH 2/3] KVM: use separate generations for each address space

2017-02-16 Thread Radim Krčmář
2017-02-15 23:00+0100, Paolo Bonzini: > This will make it easier to support multiple address spaces in > kvm_gfn_to_hva_cache_init. Instead of having to check the address > space id, we can keep on checking just the generation number. > > Signed-off-by: Paolo Bonzini > --- Reviewed-by: Radim

Re: [PATCH 1/3] KVM: only retrieve memslots once when initializing cache

2017-02-16 Thread Radim Krčmář
2017-02-15 23:00+0100, Paolo Bonzini: > This will make it a bit simpler to handle multiple address spaces > in gfn_to_hva_cache. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- Reviewed-by: Radim Krčmář <rkrc...@redhat.com> > virt/kvm/kvm_main.c |

Re: [PATCH 1/3] KVM: only retrieve memslots once when initializing cache

2017-02-16 Thread Radim Krčmář
2017-02-15 23:00+0100, Paolo Bonzini: > This will make it a bit simpler to handle multiple address spaces > in gfn_to_hva_cache. > > Signed-off-by: Paolo Bonzini > --- Reviewed-by: Radim Krčmář > virt/kvm/kvm_main.c | 21 ++--- > 1 file changed, 14 inser

Re: [PATCH] KVM: VMX: use vmcs_set/clear_bits for CPU-based execution controls

2017-02-16 Thread Radim Krčmář
2017-02-15 15:44+0100, Paolo Bonzini: > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> Reviewed-by: Radim Krčmář <rkrc...@redhat.com> > --- > arch/x86/kvm/vmx.c | 30 -- > 1 file changed, 8 insertions(+), 22 deletions(-) > > dif

Re: [PATCH] KVM: VMX: use vmcs_set/clear_bits for CPU-based execution controls

2017-02-16 Thread Radim Krčmář
2017-02-15 15:44+0100, Paolo Bonzini: > Signed-off-by: Paolo Bonzini Reviewed-by: Radim Krčmář > --- > arch/x86/kvm/vmx.c | 30 -- > 1 file changed, 8 insertions(+), 22 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c &g

Re: [PATCH] KVM: race-free exit from KVM_RUN without POSIX signals

2017-02-16 Thread Radim Krčmář
> > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- The old immediate exit with signal did more work, but none of it should affect user-space, so it looks like another minor optimization, Reviewed-by: Radim Krčmář <rkrc...@redhat.com> > change from RFC: &

Re: [PATCH] KVM: race-free exit from KVM_RUN without POSIX signals

2017-02-16 Thread Radim Krčmář
gt; > Signed-off-by: Paolo Bonzini > --- The old immediate exit with signal did more work, but none of it should affect user-space, so it looks like another minor optimization, Reviewed-by: Radim Krčmář > change from RFC: > - implement in each architecture to ensure M

[PATCH 3/5] KVM: optimize kvm_make_all_cpus_request

2017-02-16 Thread Radim Krčmář
Use __kvm_request_set to avoid repeated use of wmb(). kvm_make_all_cpus_request is also a candidate for renaming. Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- virt/kvm/kvm_main.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/vi

[PATCH 3/5] KVM: optimize kvm_make_all_cpus_request

2017-02-16 Thread Radim Krčmář
Use __kvm_request_set to avoid repeated use of wmb(). kvm_make_all_cpus_request is also a candidate for renaming. Signed-off-by: Radim Krčmář --- virt/kvm/kvm_main.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index

[PATCH 2/5] KVM: add KVM request variants without barrier

2017-02-16 Thread Radim Krčmář
REQ; @@ -clear_bit(REQ, >requests) +__kvm_request_clear(REQ, VCPU) @@ expression VCPU, REQ; @@ -test_bit(REQ, >requests) +__kvm_request_test(REQ, VCPU) Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- arch/mips/kvm/emulate.c | 2 +- arch/powerpc/kvm/book3s

[PATCH 2/5] KVM: add KVM request variants without barrier

2017-02-16 Thread Radim Krčmář
REQ; @@ -clear_bit(REQ, >requests) +__kvm_request_clear(REQ, VCPU) @@ expression VCPU, REQ; @@ -test_bit(REQ, >requests) +__kvm_request_test(REQ, VCPU) Signed-off-by: Radim Krčmář --- arch/mips/kvm/emulate.c | 2 +- arch/powerpc/kvm/book3s_pr.c | 2 +- arch/po

[PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-16 Thread Radim Krčmář
A macro to optimize requests that do not need a memory barrier because they have no dependencies. An architecture can implement a function that says which requests do not need memory barriers when handling them. Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- include/linux/kvm_host.

[PATCH 4/5] KVM: add __kvm_request_needs_mb

2017-02-16 Thread Radim Krčmář
A macro to optimize requests that do not need a memory barrier because they have no dependencies. An architecture can implement a function that says which requests do not need memory barriers when handling them. Signed-off-by: Radim Krčmář --- include/linux/kvm_host.h | 41

[PATCH 5/5] KVM: add kvm_request_pending

2017-02-16 Thread Radim Krčmář
Just to complete the encapsulation. Signed-off-by: Radim Krčmář <rkrc...@redhat.com> --- arch/mips/kvm/trap_emul.c | 2 +- arch/powerpc/kvm/booke.c | 2 +- arch/powerpc/kvm/powerpc.c | 4 ++-- arch/s390/kvm/kvm-s390.c | 2 +- arch/x86/kvm/x86.c | 4 ++-- include/linux/kvm_

[PATCH 1/5] KVM: change API for requests to match bit operations

2017-02-16 Thread Radim Krčmář
kvm_make_request was a wrapper that added barriers to bit_set and kvm_check_request did the same for bit_test and bit_check, but the name was not very obvious and we were also lacking operations that cover bit_test and bit_clear, which resulted in an inconsistent use. The renaming:

[PATCH 5/5] KVM: add kvm_request_pending

2017-02-16 Thread Radim Krčmář
Just to complete the encapsulation. Signed-off-by: Radim Krčmář --- arch/mips/kvm/trap_emul.c | 2 +- arch/powerpc/kvm/booke.c | 2 +- arch/powerpc/kvm/powerpc.c | 4 ++-- arch/s390/kvm/kvm-s390.c | 2 +- arch/x86/kvm/x86.c | 4 ++-- include/linux/kvm_host.h | 5 + 6 files

[PATCH 1/5] KVM: change API for requests to match bit operations

2017-02-16 Thread Radim Krčmář
kvm_make_request was a wrapper that added barriers to bit_set and kvm_check_request did the same for bit_test and bit_check, but the name was not very obvious and we were also lacking operations that cover bit_test and bit_clear, which resulted in an inconsistent use. The renaming:

[PATCH 0/5] KVM: rename and extend vcpu->requests API

2017-02-16 Thread Radim Krčmář
kvm_vcpu_kick() into kvm_set_request(), but I hope to get an early feedback about the idea. (Series based on current kvm/queue.) Radim Krčmář (5): KVM: change API for requests to match bit operations KVM: add KVM request variants without barrier KVM: optimize kvm_make_all_cpus_request KVM

[PATCH 0/5] KVM: rename and extend vcpu->requests API

2017-02-16 Thread Radim Krčmář
kvm_vcpu_kick() into kvm_set_request(), but I hope to get an early feedback about the idea. (Series based on current kvm/queue.) Radim Krčmář (5): KVM: change API for requests to match bit operations KVM: add KVM request variants without barrier KVM: optimize kvm_make_all_cpus_request KVM

Re: [PATCH 6/6] kvm: x86: do not use KVM_REQ_EVENT for APICv interrupt injection

2017-02-09 Thread Radim Krčmář
2017-02-08 17:23+0100, Paolo Bonzini: > On 07/02/2017 20:58, Radim Krčmář wrote: >>> - local_irq_disable(); >>> + if (kvm_lapic_enabled(vcpu)) { >>> + /* >>> +* This handles the case where a posted interrupt was >>

Re: [PATCH 6/6] kvm: x86: do not use KVM_REQ_EVENT for APICv interrupt injection

2017-02-09 Thread Radim Krčmář
2017-02-08 17:23+0100, Paolo Bonzini: > On 07/02/2017 20:58, Radim Krčmář wrote: >>> - local_irq_disable(); >>> + if (kvm_lapic_enabled(vcpu)) { >>> + /* >>> +* This handles the case where a posted interrupt was >>

Re: [PATCH 5/6] KVM: x86: do not scan IRR twice on APICv vmentry

2017-02-08 Thread Radim Krčmář
2017-02-08 15:10+0100, Paolo Bonzini: > > > On 07/02/2017 21:19, Radim Krčmář wrote: > > 2016-12-19 17:17+0100, Paolo Bonzini: > >> Calls to apic_find_highest_irr are scanning IRR twice, once > >> in vmx_sync_pir_from_irr and once in apic_search_irr. Change >

Re: [PATCH 5/6] KVM: x86: do not scan IRR twice on APICv vmentry

2017-02-08 Thread Radim Krčmář
2017-02-08 15:10+0100, Paolo Bonzini: > > > On 07/02/2017 21:19, Radim Krčmář wrote: > > 2016-12-19 17:17+0100, Paolo Bonzini: > >> Calls to apic_find_highest_irr are scanning IRR twice, once > >> in vmx_sync_pir_from_irr and once in apic_search_irr. Change >

Re: [PATCH v2 0/6] KVM: x86: cleanup and speedup for APICv

2017-02-08 Thread Radim Krčmář
2017-02-08 11:04+0100, Paolo Bonzini: > On 07/02/2017 22:52, Radim Krčmář wrote: >> there might be some rough >> edges with nested, but it was broken even before, and they fix at least >> one known bug. > > I don't think so, nested IRQ injection is tested v

Re: [PATCH v2 0/6] KVM: x86: cleanup and speedup for APICv

2017-02-08 Thread Radim Krčmář
2017-02-08 11:04+0100, Paolo Bonzini: > On 07/02/2017 22:52, Radim Krčmář wrote: >> there might be some rough >> edges with nested, but it was broken even before, and they fix at least >> one known bug. > > I don't think so, nested IRQ injection is tested v

Re: [RFC PATCH] KVM: race-free exit from KVM_RUN without POSIX signals

2017-02-08 Thread Radim Krčmář
2017-02-08 12:10+0100, Paolo Bonzini: > The purpose of the KVM_SET_SIGNAL_MASK API is to let userspace "kick" > a VCPU out of KVM_RUN through a POSIX signal. A signal is attached > to a dummy signal handler; by blocking the signal outside KVM_RUN and > unblocking it inside, this possible race is

Re: [RFC PATCH] KVM: race-free exit from KVM_RUN without POSIX signals

2017-02-08 Thread Radim Krčmář
2017-02-08 12:10+0100, Paolo Bonzini: > The purpose of the KVM_SET_SIGNAL_MASK API is to let userspace "kick" > a VCPU out of KVM_RUN through a POSIX signal. A signal is attached > to a dummy signal handler; by blocking the signal outside KVM_RUN and > unblocking it inside, this possible race is

Re: [PATCH v2 0/6] KVM: x86: cleanup and speedup for APICv

2017-02-07 Thread Radim Krčmář
2017-02-07 18:23+0100, Paolo Bonzini: > On 19/12/2016 17:17, Paolo Bonzini wrote: >> These are the fixed patches that now pass vmx.flat. The issue in >> "KVM: x86: do not scan IRR twice on APICv vmentry" was that, >> in v1 of the patches, kvm_cpu_get_interrupt did not scan IRR >> at all if it

Re: [PATCH v2 0/6] KVM: x86: cleanup and speedup for APICv

2017-02-07 Thread Radim Krčmář
2017-02-07 18:23+0100, Paolo Bonzini: > On 19/12/2016 17:17, Paolo Bonzini wrote: >> These are the fixed patches that now pass vmx.flat. The issue in >> "KVM: x86: do not scan IRR twice on APICv vmentry" was that, >> in v1 of the patches, kvm_cpu_get_interrupt did not scan IRR >> at all if it

Re: [PATCH 5/6] KVM: x86: do not scan IRR twice on APICv vmentry

2017-02-07 Thread Radim Krčmář
2017-02-07 21:19+0100, Radim Krčmář: > 2016-12-19 17:17+0100, Paolo Bonzini: > > Calls to apic_find_highest_irr are scanning IRR twice, once > > in vmx_sync_pir_from_irr and once in apic_search_irr. Change > > sync_pir_from_irr to get the new maximum IRR from kvm_api

<    4   5   6   7   8   9   10   11   12   13   >