Guest handling of IA32_DEBUGCTL MSR

2015-04-28 Thread Nadav Amit
It seems strange that the guest is allowed to set IA32_DEBUGCTL MSR for the nested VM and get this value to the physical IA32_DEBUGCTL (see prepare_vmcs02), while it cannot set IA32_DEBUGCTL for itself (see kvm_set_msr_common). Am I missing something? Regards, Nadav -- To unsubscribe from this

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-28 Thread Christoffer Dall
On Tue, Apr 28, 2015 at 10:34:12AM +0100, Peter Maydell wrote: On 28 April 2015 at 09:42, Alex Bennée alex.ben...@linaro.org wrote: Peter Maydell peter.mayd...@linaro.org writes: Does the kernel already have a conveniently implemented inject exception into guest lump of code? If so it might

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-28 Thread Alex Bennée
Christoffer Dall christoffer.d...@linaro.org writes: On Tue, Apr 28, 2015 at 10:34:12AM +0100, Peter Maydell wrote: On 28 April 2015 at 09:42, Alex Bennée alex.ben...@linaro.org wrote: Peter Maydell peter.mayd...@linaro.org writes: Does the kernel already have a conveniently implemented

[PATCH] context_tracking: remove duplicate enabled check

2015-04-28 Thread Paolo Bonzini
All calls to context_tracking_enter and context_tracking_exit are already checking context_tracking_is_enabled, except the context_tracking_user_enter and context_tracking_user_exit functions left in for the benefit of assembly calls. Pull the check up to those functions, by making them simple

Re: [PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Paolo Bonzini
On 28/04/2015 12:32, Christian Borntraeger wrote: Some architectures already have irq disabled when calling kvm_guest_exit. Push down the disabling into the architectures to avoid double disabling. This also allows to replace irq_save with irq_disable which might be cheaper. arm and mips

Re: [PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Paolo Bonzini
On 28/04/2015 16:10, Christian Borntraeger wrote: Alternatively, the irq-disabled versions could be called __kvm_guest_{enter,exit}. Then you can use those directly when it makes sense. ..having a special __kvm_guest_{enter,exit} without the WARN_ON might be even the cheapest way. In

Re: [PATCH] KVM: x86: cancel delayed EOI work on vm shutdown

2015-04-28 Thread Paolo Bonzini
On 28/04/2015 16:00, Radim Krčmář wrote: kvm_ioapic_eoi_inject_work() can be called after ioapic has been freed, fix it by cancelling its delayed work via a slightly better freeing. (Could have been a one-liner.) Signed-off-by: Radim Krčmář rkrc...@redhat.com --- I noticed it while

Re: [PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Christian Borntraeger
Am 28.04.2015 um 13:37 schrieb Paolo Bonzini: --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c @@ -891,7 +891,9 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu, /* We get here with MSR.EE=1 */ +local_irq_disable();

[PATCH] KVM: x86: cancel delayed EOI work on vm shutdown

2015-04-28 Thread Radim Krčmář
kvm_ioapic_eoi_inject_work() can be called after ioapic has been freed, fix it by cancelling its delayed work via a slightly better freeing. (Could have been a one-liner.) Signed-off-by: Radim Krčmář rkrc...@redhat.com --- I noticed it while reviewing the KVM: x86: drop unneeded null test, so

[PATCH RESEND kvm-unit-tests] x86/run: Rearrange the valid binary and testdev support checks

2015-04-28 Thread Bandan Das
This extends the sanity checks done on known common Qemu binary paths when the user supplies a QEMU= on the command line Fixes: b895b967db94937d5b593c51b95eb32d2889a764 Signed-off-by: Bandan Das b...@redhat.com --- x86/run | 43 +++ 1 file changed, 19

Re: [PATCH] context_tracking: remove duplicate enabled check

2015-04-28 Thread Rik van Riel
On 04/28/2015 07:36 AM, Paolo Bonzini wrote: All calls to context_tracking_enter and context_tracking_exit are already checking context_tracking_is_enabled, except the context_tracking_user_enter and context_tracking_user_exit functions left in for the benefit of assembly calls. Pull the

Re: Guest handling of IA32_DEBUGCTL MSR

2015-04-28 Thread Nadav Amit
Jan Kiszka jan.kis...@siemens.com wrote: Am 2015-04-28 um 13:43 schrieb Paolo Bonzini: On 28/04/2015 13:42, Nadav Amit wrote: It seems strange that the guest is allowed to set IA32_DEBUGCTL MSR for the nested VM and get this value to the physical IA32_DEBUGCTL (see prepare_vmcs02), while it

Re: Guest handling of IA32_DEBUGCTL MSR

2015-04-28 Thread Paolo Bonzini
On 28/04/2015 14:00, Jan Kiszka wrote: It seems strange that the guest is allowed to set IA32_DEBUGCTL MSR for the nested VM and get this value to the physical IA32_DEBUGCTL (see prepare_vmcs02), while it cannot set IA32_DEBUGCTL for itself (see kvm_set_msr_common). Am I

Re: KVM call agenda for 2015-04-24

2015-04-28 Thread Juan Quintela
Juan Quintela quint...@redhat.com wrote: Hi Please, send any topic that you are interested in covering. As there are no topics for Today call, call got cancelled. Thanks, Juan. Call details: By popular demand, a google calendar public entry with it

Re: Guest handling of IA32_DEBUGCTL MSR

2015-04-28 Thread Paolo Bonzini
On 28/04/2015 13:42, Nadav Amit wrote: It seems strange that the guest is allowed to set IA32_DEBUGCTL MSR for the nested VM and get this value to the physical IA32_DEBUGCTL (see prepare_vmcs02), while it cannot set IA32_DEBUGCTL for itself (see kvm_set_msr_common). Am I missing

Re: [PATCH] context_tracking: remove duplicate enabled check

2015-04-28 Thread Rik van Riel
On 04/28/2015 07:36 AM, Paolo Bonzini wrote: All calls to context_tracking_enter and context_tracking_exit are already checking context_tracking_is_enabled, except the context_tracking_user_enter and context_tracking_user_exit functions left in for the benefit of assembly calls. Pull the

Re: Guest handling of IA32_DEBUGCTL MSR

2015-04-28 Thread Jan Kiszka
Am 2015-04-28 um 13:43 schrieb Paolo Bonzini: On 28/04/2015 13:42, Nadav Amit wrote: It seems strange that the guest is allowed to set IA32_DEBUGCTL MSR for the nested VM and get this value to the physical IA32_DEBUGCTL (see prepare_vmcs02), while it cannot set IA32_DEBUGCTL for itself

Re: [PATCH] kvmclock: set scheduler clock stable

2015-04-28 Thread Marcelo Tosatti
On Thu, Apr 23, 2015 at 05:12:42PM -0400, Luiz Capitulino wrote: If you try to enable NOHZ_FULL on a guest today, you'll get the following error when the guest tries to deactivate the scheduler tick: WARNING: CPU: 3 PID: 2182 at kernel/time/tick-sched.c:192 can_stop_full_tick+0xb9/0x290()

Re: x86: kvmclock: drop rdtsc_barrier()

2015-04-28 Thread Marcelo Tosatti
On Fri, Apr 24, 2015 at 10:36:14PM -0300, Marcelo Tosatti wrote: Drop unnecessary rdtsc_barrier(), as has been determined empirically, see 057e6a8c660e95c3f4e7162e00e2fee1fc90c50d for details. Noticed by Andy Lutomirski. Improves clock_gettime() by approximately 15% on Intel i7-3520M @

[PATCH] KVM: PPC: Book3S HV: Fix list traversal in error case

2015-04-28 Thread Paul Mackerras
This fixes a regression introduced in commit 25fedfca94cf, KVM: PPC: Book3S HV: Move vcore preemption point up into kvmppc_run_vcpu, which leads to a user-triggerable oops. In the case where we try to run a vcore on a physical core that is not in single-threaded mode, or the vcore has too many

KVM SR-IOV question: is there a maximum amount of interrupt vectors?

2015-04-28 Thread Richard Thornton
Hi, Sorry to bother you all. In ESXI 6.0 you can have 4096 interrupt vectors if you have 32 CPU's, so 128 interrupt vectors per CPU. How does KVM handle this (I haven't bought the server hardware yet)? Basically I want to have 64 guests on a x86 KVM host, all of which will need 4 x SR-IOV

RE: [PATCH stable] KVM: x86: Fix lost interrupt on irr_pending race

2015-04-28 Thread Saso Slavicic
From: Paolo Bonzini Sent: Tuesday, April 21, 2015 10:48 AM Hi, big thanks to all involved in this and to Brad for endless reboots ;-) Signed-off-by: Nadav Amit na...@cs.technion.ac.il Fixes: 33e4c68656a2e461b296ce714ec322978de85412 Cc: sta...@vger.kernel.org # 2.6.32+ Signed-off-by:

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-28 Thread Alex Bennée
Peter Maydell peter.mayd...@linaro.org writes: On 27 April 2015 at 21:04, Christoffer Dall christoffer.d...@linaro.org wrote: On Thu, Apr 23, 2015 at 03:26:53PM +0100, Alex Bennée wrote: Christoffer Dall christoffer.d...@linaro.org writes: On Tue, Mar 31, 2015 at 04:08:04PM +0100, Alex

Re: [PATCH] KVM: x86: drop unneeded null test

2015-04-28 Thread SF Markus Elfring
If the null test is needed, the call to cancel_delayed_work_sync would have already crashed. Normally, the destroy function should only be called if the init functoin has succeeded, in which case ioapic is not null. Does your commit message need a small fix? Regards, Markus -- To unsubscribe

[PATCH/RFC 0/2] KVM: micro-optimization and interrupt disabling

2015-04-28 Thread Christian Borntraeger
I was able to get rid of some nanoseconds for a guest exit loop on s390. I did my best to not break other architectures but review and comments on the general approach is welcome. Downside is that the existing irq_save things will just work no matter what the callers have done, the new code must

[PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Christian Borntraeger
Some architectures already have irq disabled when calling kvm_guest_exit. Push down the disabling into the architectures to avoid double disabling. This also allows to replace irq_save with irq_disable which might be cheaper. arm and mips already have interrupts disabled. s390/power/x86 need

[PATCH/RFC 1/2] KVM: Push down irq_save to architectures before kvm_guest_enter

2015-04-28 Thread Christian Borntraeger
local_irq_disable can be cheaper than local_irq_save, especially when done only once instead of twice. We can push down the local_irq_save (and replace it with local_irq_disable) to save some cycles. x86, mips and arm already disable the interrupts before calling kvm_guest_enter. Here we save one

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-28 Thread Peter Maydell
On 28 April 2015 at 09:42, Alex Bennée alex.ben...@linaro.org wrote: Peter Maydell peter.mayd...@linaro.org writes: Does the kernel already have a conveniently implemented inject exception into guest lump of code? If so it might be less effort to do it that way round, maybe. So you pointed

[PATCH 1/2] KVM: x86: Fix update RCX/RDI/RSI on REP-string

2015-04-28 Thread Nadav Amit
When REP-string instruction is preceded with an address-size prefix, ECX/EDI/ESI are used as the operation counter and pointers. When they are updated, the high 32-bits of RCX/RDI/RSI are cleared, similarly to the way they are updated on every 32-bit register operation. Fix it. Signed-off-by:

[PATCH 0/2] KVM: x86: Fix REP-string effect on RCX/RSI/RDI

2015-04-28 Thread Nadav Amit
This patch-set fixes KVM behavior when handling a REP-string instruction that runs with an address-size of 32-bit. In this case ECX/EDI/ESI are used as counter and pointers, and the high 32-bits should be cleared. The first patch handles with the simple case. The second one handles the

[PATCH 2/2] KVM: x86: Fix zero iterations REP-string

2015-04-28 Thread Nadav Amit
When a REP-string is executed in 64-bit mode with an address-size prefix, ECX/EDI/ESI are used as counter and pointers. When ECX is initially zero, Intel CPUs clear the high 32-bits of RCX, and recent Intel CPUs update the high bits of the pointers in MOVS/STOS. This behavior is specific to Intel

Re: [PATCH 1/3] KVM: PPC: Book3S HV: Fix race in reading change bit when removing HPTE

2015-04-28 Thread Paul Mackerras
On Tue, Apr 28, 2015 at 10:36:52AM +0530, Aneesh Kumar K.V wrote: Paul Mackerras pau...@samba.org writes: The reference (R) and change (C) bits in a HPT entry can be set by hardware at any time up until the HPTE is invalidated and the TLB invalidation sequence has completed. This means

Re: [PATCH] KVM: x86: drop unneeded null test

2015-04-28 Thread Paolo Bonzini
On 27/04/2015 22:35, Julia Lawall wrote: From: Julia Lawall julia.law...@lip6.fr If the null test is needed, the call to cancel_delayed_work_sync would have already crashed. Normally, the destroy function should only be called if the init functoin has succeeded, in which case ioapic is

[PATCH] KVM: nVMX: Don't return error on nested bitmap memory allocation failure

2015-04-28 Thread Bandan Das
If get_free_page() fails for nested bitmap area, it's evident that we are gonna get screwed anyway but returning failure because we failed allocating memory for a nested structure seems like an unnecessary big hammer. Also, save the call for later; after we are done with other non-nested

Re: [PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Paolo Bonzini
On 28/04/2015 16:10, Christian Borntraeger wrote: Alternatively, the irq-disabled versions could be called __kvm_guest_{enter,exit}. Then you can use those directly when it makes sense. ..having a special __kvm_guest_{enter,exit} without the WARN_ON might be even the cheapest way. In

Re: [PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Christian Borntraeger
Am 28.04.2015 um 13:37 schrieb Paolo Bonzini: --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c @@ -891,7 +891,9 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu, /* We get here with MSR.EE=1 */ +local_irq_disable();

Re: [PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Paolo Bonzini
On 28/04/2015 12:32, Christian Borntraeger wrote: Some architectures already have irq disabled when calling kvm_guest_exit. Push down the disabling into the architectures to avoid double disabling. This also allows to replace irq_save with irq_disable which might be cheaper. arm and mips

[PATCH] KVM: PPC: Book3S HV: Fix list traversal in error case

2015-04-28 Thread Paul Mackerras
This fixes a regression introduced in commit 25fedfca94cf, KVM: PPC: Book3S HV: Move vcore preemption point up into kvmppc_run_vcpu, which leads to a user-triggerable oops. In the case where we try to run a vcore on a physical core that is not in single-threaded mode, or the vcore has too many

[PATCH/RFC 0/2] KVM: micro-optimization and interrupt disabling

2015-04-28 Thread Christian Borntraeger
I was able to get rid of some nanoseconds for a guest exit loop on s390. I did my best to not break other architectures but review and comments on the general approach is welcome. Downside is that the existing irq_save things will just work no matter what the callers have done, the new code must

[PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Christian Borntraeger
Some architectures already have irq disabled when calling kvm_guest_exit. Push down the disabling into the architectures to avoid double disabling. This also allows to replace irq_save with irq_disable which might be cheaper. arm and mips already have interrupts disabled. s390/power/x86 need

[PATCH/RFC 1/2] KVM: Push down irq_save to architectures before kvm_guest_enter

2015-04-28 Thread Christian Borntraeger
local_irq_disable can be cheaper than local_irq_save, especially when done only once instead of twice. We can push down the local_irq_save (and replace it with local_irq_disable) to save some cycles. x86, mips and arm already disable the interrupts before calling kvm_guest_enter. Here we save one

Re: [PATCH 1/3] KVM: PPC: Book3S HV: Fix race in reading change bit when removing HPTE

2015-04-28 Thread Paul Mackerras
On Tue, Apr 28, 2015 at 10:36:52AM +0530, Aneesh Kumar K.V wrote: Paul Mackerras pau...@samba.org writes: The reference (R) and change (C) bits in a HPT entry can be set by hardware at any time up until the HPTE is invalidated and the TLB invalidation sequence has completed. This means