[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 t

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

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 mip

[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 adopti

[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 l

[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 do

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 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 that when