Re: [PATCH 3/3] powerpc/kvm: remove redundant assignment

2013-11-07 Thread Alexander Graf
Am 07.11.2013 um 08:55 schrieb Benjamin Herrenschmidt b...@kernel.crashing.org: On Thu, 2013-11-07 at 08:52 +0100, Alexander Graf wrote: Am 06.11.2013 um 20:58 schrieb Benjamin Herrenschmidt b...@kernel.crashing.org: On Wed, 2013-11-06 at 12:24 +0100, Alexander Graf wrote: On

Re: [PATCH 3/3] powerpc/kvm: remove redundant assignment

2013-11-07 Thread Benjamin Herrenschmidt
On Thu, 2013-11-07 at 09:14 +0100, Alexander Graf wrote: And ? An explanation isn't going to be clearer than the code in that case ... It's pretty non-obvious when you do a git show on that patch in 1 year from now, as the redundancy is out of scope of what the diff shows. And ? How would

Re: [PATCH v2 1/2] powerpc/kvm: fix rare but potential deadlock scene

2013-11-07 Thread Alexander Graf
On 07.11.2013, at 07:22, Liu Ping Fan kernelf...@gmail.com wrote: 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

Re: [PATCH v2 1/2] powerpc/kvm: fix rare but potential deadlock scene

2013-11-07 Thread Liu ping fan
On Thu, Nov 7, 2013 at 5:54 PM, Alexander Graf ag...@suse.de wrote: On 07.11.2013, at 07:22, Liu Ping Fan kernelf...@gmail.com wrote: 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,

Re: [PATCH v2 2/2] powerpc/kvm: remove redundant assignment

2013-11-07 Thread Liu ping fan
On Thu, Nov 7, 2013 at 6:06 PM, Alexander Graf ag...@suse.de wrote: On 07.11.2013, at 07:22, Liu Ping Fan kernelf...@gmail.com wrote: ret is assigned twice with the same value, so remove the later one. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com Acked-by: Paul Mackerras

[PATCH] powerpc: kvm: optimize sc 0 as fast return

2013-11-07 Thread Liu Ping Fan
syscall is a very common behavior inside guest, and this patch optimizes the path for the emulation of BOOK3S_INTERRUPT_SYSCALL, so hypervisor can return to guest without heavy exit, i.e, no need to swap TLB, HTAB,.. etc Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- Compiled, but

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

2013-11-07 Thread Alexander Graf
On 08.11.2013, at 03:44, Liu Ping Fan kernelf...@gmail.com wrote: syscall is a very common behavior inside guest, and this patch optimizes the path for the emulation of BOOK3S_INTERRUPT_SYSCALL, so hypervisor can return to guest without heavy exit, i.e, no need to swap TLB, HTAB,.. etc The

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

2013-11-07 Thread Benjamin Herrenschmidt
On Fri, 2013-11-08 at 04:10 +0100, Alexander Graf wrote: On 08.11.2013, at 03:44, Liu Ping Fan kernelf...@gmail.com wrote: syscall is a very common behavior inside guest, and this patch optimizes the path for the emulation of BOOK3S_INTERRUPT_SYSCALL, so hypervisor can return to guest

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

2013-11-07 Thread Liu ping fan
On Fri, Nov 8, 2013 at 11:10 AM, Alexander Graf ag...@suse.de wrote: On 08.11.2013, at 03:44, Liu Ping Fan kernelf...@gmail.com wrote: syscall is a very common behavior inside guest, and this patch optimizes the path for the emulation of BOOK3S_INTERRUPT_SYSCALL, so hypervisor can return to

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

2013-11-07 Thread Liu ping fan
On Fri, Nov 8, 2013 at 12:11 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Fri, 2013-11-08 at 15:05 +1100, Benjamin Herrenschmidt wrote: On Fri, 2013-11-08 at 04:10 +0100, Alexander Graf wrote: On 08.11.2013, at 03:44, Liu Ping Fan kernelf...@gmail.com wrote: syscall is a

[PATCH v3 2/2] powerpc: kvm: fix rare but potential deadlock scene

2013-11-07 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

[PATCH v3 0/2] powerpc kvm: fix deadlock scene

2013-11-07 Thread Liu Ping Fan
v2-v3: introduce kvmppc_hv_unlock_hpte() to pair with kvmppc_hv_find_lock_hpte() and hide the preemption detail inside this pair from the callers Liu Ping Fan (2): powerpc: kvm: pair kvmppc_hv_find_lock_hpte with _unlock_hpte powerpc: kvm: fix rare but potential deadlock scene