[PATCH v2] powerpc: kvm: optimize sc 1 as fast return

2013-11-15 Thread Liu Ping Fan
In some scene, e.g openstack CI, PR guest can trigger sc 1 frequently, this patch optimizes the path by directly delivering BOOK3S_INTERRUPT_SYSCALL to HV guest, so powernv can return to HV guest without heavy exit, i.e, no need to swap TLB, HTAB,.. etc Signed-off-by: Liu Ping Fan

[PATCH v4] powerpc: kvm: fix rare but potential deadlock scene

2013-11-15 Thread Liu Ping Fan
Since kvmppc_hv_find_lock_hpte() is called from both virtmode and realmode, so it can trigger the deadlock. Suppose the following scene: Two physical cpuM, cpuN, two VM instances A, B, each VM has a group of vcpus. If on cpuM, vcpu_A_1 holds bitlock X (HPTE_V_HVLOCK), then is switched out, and

Re: [PATCH 4/4 v3] kvm: powerpc: use caching attributes as per linux pte

2013-11-15 Thread Scott Wood
On Fri, 2013-11-15 at 11:01 +0530, Bharat Bhushan wrote: @@ -440,9 +437,9 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, } if (likely(!pfnmap)) { - unsigned long tsize_pages = 1 (tsize + 10 - PAGE_SHIFT); + tsize_pages

[PATCH 2/4] KVM: PPC: Book3S HV: Refine barriers in guest entry/exit

2013-11-15 Thread Paul Mackerras
Some users have reported instances of the host hanging with secondary threads of a core waiting for the primary thread to exit the guest, and the primary thread stuck in nap mode. This prompted a review of the memory barriers in the guest entry/exit code, and this is the result. Most of these

[PATCH 3/4] KVM: PPC: Book3S HV: Make tbacct_lock irq-safe

2013-11-15 Thread Paul Mackerras
Lockdep reported that there is a potential for deadlock because vcpu-arch.tbacct_lock is not irq-safe, and is sometimes taken inside the rq_lock (run-queue lock) in the scheduler, which is taken within interrupts. The lockdep splat looks like:

Re: [PATCH v2] powerpc: kvm: optimize sc 1 as fast return

2013-11-15 Thread Paul Mackerras
On Fri, Nov 15, 2013 at 04:35:01PM +0800, Liu Ping Fan wrote: +sc_1_fast_return: + mtspr SPRN_SRR0,r10 + mtspr SPRN_SRR1,r11 + li r10, BOOK3S_INTERRUPT_SYSCALL + li r11, (MSR_ME 1) | 1 /* synthesize MSR_SF | MSR_ME */ + rotldi r11, r11, 63 You need a