Re: [RFC 01/11] sched: introduce sys_cpumask in tsk to adapt asymmetric system

2014-11-17 Thread Liu ping fan
powerKVM to give more power when switching back to host, so introduce sys_allowed cpumask to reflect the cpuset which the vcpu thread can run on. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- include/linux/init_task.h | 1 + include/linux/sched.h | 6 ++ kernel/sched

Re: [RFC 03/11] powerpc: kvm: add interface to control kvm function on a core

2014-11-17 Thread Liu ping fan
and coreB, we want to enable KVM on coreA, while keeping coreB unchanged. In fact, I try to acheive something un-symmetric on the platform. Do you think it is an justification? Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kernel/sysfs.c| 39

Re: [RFC 04/11] powerpc: kvm: introduce a kthread on primary thread to anti tickless

2014-11-17 Thread Liu ping fan
mode. (I thought that anti_tickless thread can goto NAP, so we can let the secondary run). Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kernel/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc

Re: [RFC 06/11] powerpc: kvm: introduce online in paca to indicate whether cpu is needed by host

2014-11-17 Thread Liu ping fan
for dedicated KVM env. Achieve this by setting paca-online as false. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/include/asm/paca.h | 3 +++ arch/powerpc/kernel/asm-offsets.c | 3 +++ arch/powerpc/kernel/smp.c | 3 +++ arch/powerpc

Re: [RFC 09/11] powerpc: kvm: handle time base on secondary hwthread

2014-11-17 Thread Liu ping fan
time. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 89ea16c..a817ba6 100644 --- a/arch

Re: [RFC 11/11] powerpc: kvm: Kconfig add an option for enabling secondary hwthread

2014-11-17 Thread Liu ping fan
On Mon, Oct 27, 2014 at 2:44 PM, Preeti U Murthy pre...@linux.vnet.ibm.com wrote: On 10/17/2014 01:00 AM, kernelf...@gmail.com wrote: Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kvm/Kconfig | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kvm

Re: [PATCH] powerpc: kvm: make the setup of hpte under the protection of KVMPPC_RMAP_LOCK_BIT

2014-07-29 Thread Liu ping fan
On Tue, Jul 29, 2014 at 2:57 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Mon, 2014-07-28 at 15:58 +0800, Liu ping fan wrote: Hope I am right. Take the following seq as an example if (hptep[0] HPTE_V_VALID) { /* HPTE was previously valid, so we need to invalidate

[PATCH] powerpc: kvm: make the setup of hpte under the protection of KVMPPC_RMAP_LOCK_BIT

2014-07-28 Thread Liu Ping Fan
In current code, the setup of hpte is under the risk of race with mmu_notifier_invalidate, i.e we may setup a hpte with a invalid pfn. Resolve this issue by sync the two actions by KVMPPC_RMAP_LOCK_BIT. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kvm

Re: [PATCH] powerpc: kvm: make the setup of hpte under the protection of KVMPPC_RMAP_LOCK_BIT

2014-07-28 Thread Liu ping fan
, 2014 at 2:42 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Mon, 2014-07-28 at 14:09 +0800, Liu Ping Fan wrote: In current code, the setup of hpte is under the risk of race with mmu_notifier_invalidate, i.e we may setup a hpte with a invalid pfn. Resolve this issue by sync the two

[PATCH v4] powerpc: kvm: make _PAGE_NUMA take effect

2014-04-15 Thread Liu Ping Fan
is marked with _PAGE_NUMA, it will NOT be mapped in real mode, instead, it will be mapped in virt mode and have the opportunity to be checked with placement. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- v4: more detail

[PATCH v4] powerpc: kvm: make _PAGE_NUMA take effect

2014-04-15 Thread Liu Ping Fan
is marked with _PAGE_NUMA, it will NOT be mapped in real mode, instead, it will be mapped in virt mode and have the opportunity to be checked with placement. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- v4: more detail

Re: [PATCH v3] powerpc: kvm: make _PAGE_NUMA take effect

2014-04-14 Thread liu ping fan
On Mon, Apr 14, 2014 at 2:43 PM, Alexander Graf ag...@suse.de wrote: On 13.04.14 04:27, Liu ping fan wrote: On Fri, Apr 11, 2014 at 10:03 PM, Alexander Graf ag...@suse.de wrote: On 11.04.2014, at 13:45, Liu Ping Fan pingf...@linux.vnet.ibm.com wrote: When we mark pte with _PAGE_NUMA we

Re: [PATCH v3] powerpc: kvm: make _PAGE_NUMA take effect

2014-04-14 Thread liu ping fan
On Mon, Apr 14, 2014 at 2:43 PM, Alexander Graf ag...@suse.de wrote: On 13.04.14 04:27, Liu ping fan wrote: On Fri, Apr 11, 2014 at 10:03 PM, Alexander Graf ag...@suse.de wrote: On 11.04.2014, at 13:45, Liu Ping Fan pingf...@linux.vnet.ibm.com wrote: When we mark pte with _PAGE_NUMA we

Re: [PATCH v3] powerpc: kvm: make _PAGE_NUMA take effect

2014-04-12 Thread Liu ping fan
On Fri, Apr 11, 2014 at 10:03 PM, Alexander Graf ag...@suse.de wrote: On 11.04.2014, at 13:45, Liu Ping Fan pingf...@linux.vnet.ibm.com wrote: When we mark pte with _PAGE_NUMA we already call mmu_notifier_invalidate_range_start and mmu_notifier_invalidate_range_end, which will mark existing

[PATCH v3] powerpc: kvm: make _PAGE_NUMA take effect

2014-04-11 Thread Liu Ping Fan
When we mark pte with _PAGE_NUMA we already call mmu_notifier_invalidate_range_start and mmu_notifier_invalidate_range_end, which will mark existing guest hpte entry as HPTE_V_ABSENT. Now we need to do that when we are inserting new guest hpte entries. Signed-off-by: Liu Ping Fan pingf

Re: [PATCH v2] powernv: kvm: make _PAGE_NUMA take effect

2014-04-09 Thread Liu ping fan
On Mon, Apr 7, 2014 at 4:36 PM, Alexander Graf ag...@suse.de wrote: On 07.04.14 09:42, Aneesh Kumar K.V wrote: Alexander Graf ag...@suse.com writes: On 03.04.14 04:36, Liu ping fan wrote: Hi Alex, could you help to pick up this patch? since v3.14 kernel can enable numa fault for powerpc

Re: [PATCH v2] powernv: kvm: make _PAGE_NUMA take effect

2014-04-02 Thread Liu ping fan
Hi Alex, could you help to pick up this patch? since v3.14 kernel can enable numa fault for powerpc. Thx, Fan On Mon, Jan 27, 2014 at 5:11 PM, Alexander Graf ag...@suse.de wrote: On 21.01.2014, at 10:42, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com wrote: Liu Ping Fan kernelf

Re: [PATCH 0/4] powernv: kvm: numa fault improvement

2014-02-25 Thread Liu ping fan
); shm_unlink(SHM_FNAME); } On Mon, Jan 20, 2014 at 10:48 PM, Alexander Graf ag...@suse.de wrote: On 15.01.2014, at 07:36, Liu ping fan kernelf...@gmail.com wrote: On Thu, Jan 9, 2014 at 8:08 PM, Alexander Graf ag...@suse.de wrote: On 11.12.2013, at 09:47, Liu Ping Fan kernelf...@gmail.com wrote

[PATCH v2] powernv: kvm: make _PAGE_NUMA take effect

2014-01-21 Thread Liu Ping Fan
To make sure that on host, the pages marked with _PAGE_NUMA result in a fault when guest access them, we should force the checking when guest uses hypercall to setup hpte. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- v2: It should be the reply to [PATCH 2/4] powernv: kvm: make

[PATCH v2] powernv: kvm: make _PAGE_NUMA take effect

2014-01-21 Thread Liu Ping Fan
To make sure that on host, the pages marked with _PAGE_NUMA result in a fault when guest access them, we should force the checking when guest uses hypercall to setup hpte. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- v2: It should be the reply to [PATCH 2/4] powernv: kvm: make

Re: [PATCH 0/4] powernv: kvm: numa fault improvement

2014-01-21 Thread Liu ping fan
On Tue, Jan 21, 2014 at 11:40 AM, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com wrote: Liu ping fan kernelf...@gmail.com writes: On Mon, Jan 20, 2014 at 11:45 PM, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com wrote: Liu ping fan kernelf...@gmail.com writes: On Thu, Jan 9, 2014 at 8:08

Re: [PATCH 0/4] powernv: kvm: numa fault improvement

2014-01-21 Thread Liu ping fan
On Tue, Jan 21, 2014 at 5:07 PM, Liu ping fan kernelf...@gmail.com wrote: On Tue, Jan 21, 2014 at 11:40 AM, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com wrote: Liu ping fan kernelf...@gmail.com writes: On Mon, Jan 20, 2014 at 11:45 PM, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com

Re: [PATCH 0/4] powernv: kvm: numa fault improvement

2014-01-20 Thread Liu ping fan
On Mon, Jan 20, 2014 at 11:45 PM, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com wrote: Liu ping fan kernelf...@gmail.com writes: On Thu, Jan 9, 2014 at 8:08 PM, Alexander Graf ag...@suse.de wrote: On 11.12.2013, at 09:47, Liu Ping Fan kernelf...@gmail.com wrote: This series is based

Re: [PATCH 0/4] powernv: kvm: numa fault improvement

2014-01-14 Thread Liu ping fan
On Thu, Jan 9, 2014 at 8:08 PM, Alexander Graf ag...@suse.de wrote: On 11.12.2013, at 09:47, Liu Ping Fan kernelf...@gmail.com wrote: This series is based on Aneesh's series [PATCH -V2 0/5] powerpc: mm: Numa faults support for ppc64 For this series, I apply the same idea from the previous

[PATCH 0/4] powernv: kvm: numa fault improvement

2013-12-11 Thread Liu Ping Fan
that I have a good justification -- the fact of heavy cost when switching context between guest and host, which is well known. If my suppose is correct, will CCing k...@vger.kernel.org from next version. Liu Ping Fan (4): mm: export numa_migrate_prep() powernv: kvm: make _PAGE_NUMA take

[PATCH 3/4] powernv: kvm: extend input param for lookup_linux_pte

2013-12-11 Thread Liu Ping Fan
It will be helpful for next patch Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- Can it be merged with the next patch? --- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch

[PATCH 2/4] powernv: kvm: make _PAGE_NUMA take effect

2013-12-11 Thread Liu Ping Fan
To make _PAGE_NUMA take effect, we should force the checking when guest uses hypercall to setup hpte. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm

[PATCH 4/4] powernv: kvm: make the handling of _PAGE_NUMA faster for guest

2013-12-11 Thread Liu Ping Fan
The period check of _PAGE_NUMA can probably happen on the correctly placed page. For this case, when guest try to setup hpte in real mode, we try to resolve the numa fault in real mode, since the switch between guest context and host context costs too much. Signed-off-by: Liu Ping Fan pingf

[PATCH 1/4] mm: export numa_migrate_prep()

2013-12-11 Thread Liu Ping Fan
powerpc will use it in fast path. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- include/linux/mm.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 5ab0e22..420fb77 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h

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

2013-11-19 Thread Liu ping fan
On Tue, Nov 19, 2013 at 6:39 PM, Alexander Graf ag...@suse.de wrote: On 19.11.2013, at 07:12, 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 RESEND v4] powerpc: kvm: fix rare but potential deadlock scene

2013-11-19 Thread Liu ping fan
On Tue, Nov 19, 2013 at 6:39 PM, Alexander Graf ag...@suse.de wrote: On 19.11.2013, at 07:12, 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

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

2013-11-18 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 pingf

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

2013-11-18 Thread Liu Ping Fan
! deadlock happens Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 +- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 4 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm

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

2013-11-18 Thread Liu Ping Fan
! deadlock happens Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 +- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 4 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm

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

2013-11-18 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 pingf

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

2013-11-17 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 pingf

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

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

2013-11-15 Thread Liu Ping Fan
! deadlock happens Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- v4: remove the over-engineered part and keep it simple, also add some notes. --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 +- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 4 2 files changed, 9 insertions(+), 1

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

2013-11-08 Thread Liu ping fan
On Fri, Nov 8, 2013 at 12:19 PM, Liu ping fan kernelf...@gmail.com wrote: 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

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 pau

[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

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

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

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

2013-11-07 Thread Liu Ping Fan
! deadlock happens Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/include/asm/kvm_book3s.h | 4 ++-- arch/powerpc/kvm/book3s_64_mmu_hv.c | 5 +++-- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 20 3 files changed, 21 insertions(+), 8 deletions(-) diff

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

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

2013-11-06 Thread Liu Ping Fan
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 pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b

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

2013-11-05 Thread Liu ping fan
On Wed, Nov 6, 2013 at 1:04 PM, Paul Mackerras pau...@samba.org wrote: On Tue, Nov 05, 2013 at 03:42:43PM +0800, Liu Ping Fan wrote: Since kvmppc_hv_find_lock_hpte() is called from both virtmode and realmode, so it can trigger the deadlock. Good catch, we should have preemption disabled while

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

2013-11-04 Thread Liu Ping Fan
! deadlock happens Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 043eec8..28160ac 100644 --- a/arch/powerpc/kvm

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

2013-11-04 Thread Liu Ping Fan
Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 28160ac..7682837 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c

[PATCH 1/3] powerpc/kvm: simplify the entering logic for secondary thread

2013-11-04 Thread Liu Ping Fan
that if primary vcpu runs, the secondary vcpu can not be scheduled. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- arch/powerpc/kvm/book3s_hv.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 62a2b5a

[PATCH] KVM: IRQFD: equip irqfd and resamplefd with polarity

2013-09-11 Thread Liu Ping Fan
Nowadays, irqfd can emulate trigger mode, but it can not emulate trigger polarity. While in some cases, ioapic ioredtbl[x] expects _low_ active. So equipping irqfd with the ability. Correspondingly, resamplefd will have the same polarity as irqfd. Signed-off-by: Liu Ping Fan pingf

Re: What's the usage model (purpose) of interrupt remapping in IOMMU?

2013-08-13 Thread Liu ping fan
On Wed, Nov 2, 2011 at 11:31 PM, Alex Williamson alex.william...@redhat.com wrote: On Wed, 2011-11-02 at 13:26 +0800, Kai Huang wrote: Hi, In case of direct io, without the interrupt remapping in IOMMU (intel VT-d or AMD IOMMU), hypervisor needs to inject interrupt for guest when the guest

Re: What's the usage model (purpose) of interrupt remapping in IOMMU?

2013-08-13 Thread Liu ping fan
On Wed, Nov 2, 2011 at 11:31 PM, Alex Williamson alex.william...@redhat.com wrote: On Wed, 2011-11-02 at 13:26 +0800, Kai Huang wrote: Hi, In case of direct io, without the interrupt remapping in IOMMU (intel VT-d or AMD IOMMU), hypervisor needs to inject interrupt for guest when the guest

Re: What's the usage model (purpose) of interrupt remapping in IOMMU?

2013-08-13 Thread Liu ping fan
On Wed, Aug 14, 2013 at 10:50 AM, Alex Williamson alex.william...@redhat.com wrote: On Wed, 2013-08-14 at 10:37 +0800, Liu ping fan wrote: On Wed, Nov 2, 2011 at 11:31 PM, Alex Williamson alex.william...@redhat.com wrote: On Wed, 2011-11-02 at 13:26 +0800, Kai Huang wrote: Hi, In case

Re: [Qemu-devel] [RFC PATCH v3 05/19] Implement dimm device abstraction

2012-10-25 Thread liu ping fan
On Thu, Oct 25, 2012 at 1:16 AM, Vasilis Liaskovitis vasilis.liaskovi...@profitbricks.com wrote: Hi, On Wed, Oct 24, 2012 at 12:15:17PM +0200, Stefan Hajnoczi wrote: On Wed, Oct 24, 2012 at 10:06 AM, liu ping fan qemul...@gmail.com wrote: On Tue, Oct 23, 2012 at 8:25 PM, Stefan Hajnoczi

Re: [Qemu-devel] [RFC PATCH v3 05/19] Implement dimm device abstraction

2012-10-24 Thread liu ping fan
On Tue, Oct 23, 2012 at 8:25 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Fri, Sep 21, 2012 at 01:17:21PM +0200, Vasilis Liaskovitis wrote: +static void dimm_populate(DimmDevice *s) +{ +DeviceState *dev= (DeviceState*)s; +MemoryRegion *new = NULL; + +new =

Re: KVM call agenda for Tuesday, September 4th

2012-09-04 Thread liu ping fan
On Mon, Sep 3, 2012 at 7:48 PM, Avi Kivity a...@redhat.com wrote: On 09/03/2012 09:44 AM, Juan Quintela wrote: Hi Please send in any agenda items you are interested in covering. - protecting MemoryRegion::opaque during dispatch I'm guessing Ping won't make it due to timezone problems.

Re: KVM call agenda for Tuesday, September 4th

2012-09-04 Thread liu ping fan
On Tue, Sep 4, 2012 at 4:21 PM, Avi Kivity a...@redhat.com wrote: On 09/04/2012 11:17 AM, liu ping fan wrote: On Mon, Sep 3, 2012 at 7:48 PM, Avi Kivity a...@redhat.com wrote: On 09/03/2012 09:44 AM, Juan Quintela wrote: Hi Please send in any agenda items you are interested in covering

Re: [PATCH 09/15] memory: prepare flatview and radix-tree for rcu style access

2012-08-11 Thread liu ping fan
On Sat, Aug 11, 2012 at 9:58 AM, liu ping fan qemul...@gmail.com wrote: On Wed, Aug 8, 2012 at 5:41 PM, Avi Kivity a...@redhat.com wrote: On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Flatview and radix view are all under the protection of pointer

Re: [PATCH 13/15] hotplug: introduce qdev_unplug_complete() to remove device from views

2012-08-10 Thread liu ping fan
On Thu, Aug 9, 2012 at 4:00 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 09/08/2012 09:28, liu ping fan ha scritto: VCPU threadI/O thread = get MMIO request rcu_read_lock() walk

Re: [PATCH 15/15] e1000: using new interface--unmap to unplug

2012-08-10 Thread liu ping fan
On Thu, Aug 9, 2012 at 3:40 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 09/08/2012 09:28, liu ping fan ha scritto: +static void +pci_e1000_unmap(PCIDevice *p) +{ +/* DO NOT FREE anything!until refcnt=0 */ +/* isolate from memory view */ +} At least you need to call

Re: [PATCH 03/15] qom: introduce reclaimer to release obj

2012-08-10 Thread liu ping fan
On Thu, Aug 9, 2012 at 4:18 PM, Avi Kivity a...@redhat.com wrote: On 08/09/2012 10:49 AM, Paolo Bonzini wrote: Il 09/08/2012 09:33, liu ping fan ha scritto: Yes, it is to defer destructors. See 0009-memory-prepare-flatview-and-radix-tree-for-rcu-style.patch When MemoryRegion is _del_subregion

Re: [PATCH 06/15] memory: use refcnt to manage MemoryRegion

2012-08-10 Thread liu ping fan
On Thu, Aug 9, 2012 at 4:38 PM, Avi Kivity a...@redhat.com wrote: On 08/09/2012 10:27 AM, liu ping fan wrote: On Wed, Aug 8, 2012 at 5:20 PM, Avi Kivity a...@redhat.com wrote: On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Using refcnt for mr, so

Re: [PATCH 09/15] memory: prepare flatview and radix-tree for rcu style access

2012-08-10 Thread liu ping fan
On Wed, Aug 8, 2012 at 5:41 PM, Avi Kivity a...@redhat.com wrote: On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Flatview and radix view are all under the protection of pointer. And this make sure the change of them seem to be atomic! The mr

Re: [PATCH 06/15] memory: use refcnt to manage MemoryRegion

2012-08-09 Thread liu ping fan
On Wed, Aug 8, 2012 at 5:20 PM, Avi Kivity a...@redhat.com wrote: On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Using refcnt for mr, so we can separate mr's life cycle management from refered object. When mr-ref 0-1, inc the refered object

Re: [PATCH 11/15] lock: introduce global lock for device tree

2012-08-09 Thread liu ping fan
On Wed, Aug 8, 2012 at 5:42 PM, Avi Kivity a...@redhat.com wrote: On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Please explain the motivation. AFAICT, the big qemu lock is sufficient. Oh, this is one of the series locks for the removal of big

Re: [PATCH 11/15] lock: introduce global lock for device tree

2012-08-09 Thread liu ping fan
On Wed, Aug 8, 2012 at 5:41 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 08/08/2012 08:25, Liu Ping Fan ha scritto: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- cpus.c | 12 main-loop.h |3 +++ 2

Re: [PATCH 15/15] e1000: using new interface--unmap to unplug

2012-08-09 Thread liu ping fan
On Wed, Aug 8, 2012 at 5:56 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 08/08/2012 08:25, Liu Ping Fan ha scritto: +static void +pci_e1000_unmap(PCIDevice *p) +{ +/* DO NOT FREE anything!until refcnt=0 */ +/* isolate from memory view */ +} At least you need to call

Re: [PATCH 13/15] hotplug: introduce qdev_unplug_complete() to remove device from views

2012-08-09 Thread liu ping fan
On Wed, Aug 8, 2012 at 5:52 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 08/08/2012 08:25, Liu Ping Fan ha scritto: +void qdev_unplug_complete(DeviceState *dev, Error **errp) +{ +/* isolate from mem view */ +qdev_unmap(dev); +qemu_lock_devtree(); +/* isolate from device

Re: [PATCH 04/15] memory: MemoryRegion topology must be stable when updating

2012-08-09 Thread liu ping fan
On Thu, Aug 9, 2012 at 3:17 AM, Blue Swirl blauwir...@gmail.com wrote: On Wed, Aug 8, 2012 at 6:25 AM, Liu Ping Fan qemul...@gmail.com wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Using mem_map_lock to protect among updaters. So we can get the intact snapshot of mem topology

Re: [PATCH 04/15] memory: MemoryRegion topology must be stable when updating

2012-08-09 Thread liu ping fan
On Wed, Aug 8, 2012 at 5:13 PM, Avi Kivity a...@redhat.com wrote: On 08/08/2012 09:25 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Using mem_map_lock to protect among updaters. So we can get the intact snapshot of mem topology -- FlatView radix-tree. Signed-off

Re: [PATCH 08/15] memory: introduce PhysMap to present snapshot of toploygy

2012-08-09 Thread liu ping fan
On Thu, Aug 9, 2012 at 3:18 AM, Blue Swirl blauwir...@gmail.com wrote: On Wed, Aug 8, 2012 at 6:25 AM, Liu Ping Fan qemul...@gmail.com wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com PhysMap contain the flatview and radix-tree view, they are snapshot of system topology and should

Re: [PATCH 09/15] memory: prepare flatview and radix-tree for rcu style access

2012-08-09 Thread liu ping fan
On Thu, Aug 9, 2012 at 3:23 AM, Blue Swirl blauwir...@gmail.com wrote: On Wed, Aug 8, 2012 at 6:25 AM, Liu Ping Fan qemul...@gmail.com wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Flatview and radix view are all under the protection of pointer. And this make sure the change of them

Re: [PATCH 03/15] qom: introduce reclaimer to release obj

2012-08-09 Thread liu ping fan
On Wed, Aug 8, 2012 at 5:15 PM, Avi Kivity a...@redhat.com wrote: On 08/08/2012 12:07 PM, Paolo Bonzini wrote: Il 08/08/2012 11:05, Avi Kivity ha scritto: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Collect unused object and release them at caller demand. Please explain

Re: [PATCH 03/15] qom: introduce reclaimer to release obj

2012-08-09 Thread liu ping fan
On Wed, Aug 8, 2012 at 5:35 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 08/08/2012 08:25, Liu Ping Fan ha scritto: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Collect unused object and release them at caller demand. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com

[PATCH 02/15] qom: using atomic ops to re-implement object_ref

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- include/qemu/object.h |3 ++- qom/object.c | 13 + 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/qemu/object.h b/include/qemu/object.h

[PATCH 03/15] qom: introduce reclaimer to release obj

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com Collect unused object and release them at caller demand. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- include/qemu/reclaimer.h | 28 ++ main-loop.c |5 qemu-tool.c |5

[PATCH 04/15] memory: MemoryRegion topology must be stable when updating

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com Using mem_map_lock to protect among updaters. So we can get the intact snapshot of mem topology -- FlatView radix-tree. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- exec.c |3 +++ memory.c | 22

[PATCH 0/15 v2] prepare unplug out of protection of global lock

2012-08-08 Thread Liu Ping Fan
background: refer to orignal plan posted by Marcelo Tosatti, http://lists.gnu.org/archive/html/qemu-devel/2012-06/msg04315.html prev version: https://lists.gnu.org/archive/html/qemu-devel/2012-07/msg03312.html changes v1-v2 --introduce atomic ops --introduce ref cnt for MemoryRegion --make

[PATCH 05/15] memory: introduce life_ops to MemoryRegion

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com The types of referred object by MemoryRegion are variable, ex, another mr, DeviceState, or other struct defined by drivers. So the refer/unrefer may be different by drivers. Using this ops, we can mange the backend object. Signed-off-by: Liu Ping

[PATCH 06/15] memory: use refcnt to manage MemoryRegion

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com Using refcnt for mr, so we can separate mr's life cycle management from refered object. When mr-ref 0-1, inc the refered object. When mr-ref 1-0, dec the refered object. The refered object can be DeviceStae, another mr, or other opaque. Signed

[PATCH 01/15] atomic: introduce atomic operations

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com If out of global lock, we will be challenged by SMP in low level, so need atomic ops. This file is heavily copied from kernel. Currently, only x86 atomic ops included, and will be extended for other arch for future. Signed-off-by: Liu Ping Fan

[PATCH 07/15] memory: inc/dec mr's ref when adding/removing from mem view

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com memory_region_{add,del}_subregion will inc/dec mr's refcnt. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- memory.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/memory.c b/memory.c index 5dc8b59..2eaa2fc

[PATCH 08/15] memory: introduce PhysMap to present snapshot of toploygy

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com PhysMap contain the flatview and radix-tree view, they are snapshot of system topology and should be consistent. With PhysMap, we can swap the pointer when updating and achieve the atomic. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com

[PATCH 09/15] memory: prepare flatview and radix-tree for rcu style access

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com Flatview and radix view are all under the protection of pointer. And this make sure the change of them seem to be atomic! The mr accessed by radix-tree leaf or flatview will be reclaimed after the prev PhysMap not in use any longer Signed-off

[PATCH 10/15] memory: change tcg related code to using PhysMap

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com Change tcg code to use PhysMap. This is separated from the prev patch for review purpose. Should be merged into prev one. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- exec.c | 27 +-- 1 files changed, 21

[PATCH 11/15] lock: introduce global lock for device tree

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- cpus.c | 12 main-loop.h |3 +++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/cpus.c b/cpus.c index b182b3d..a734b36 100644 --- a/cpus.c +++ b

[PATCH 12/15] qdev: using devtree lock to protect device's accessing

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com lock: qemu_device_tree_mutex competitors: --device_del(destruction of device will be postphoned until unplug ack from guest), --pci hot-unplug --iteration (qdev_reset_all) --device_add Signed-off-by: Liu Ping Fan pingf

[PATCH 13/15] hotplug: introduce qdev_unplug_complete() to remove device from views

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com When guest confirm the removal of device, we should --unmap from MemoryRegion view --isolated from device tree view Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/acpi_piix4.c |4 ++-- hw/pci.c| 13 - hw

[PATCH 14/15] qom: object_unref call reclaimer

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com iohandler/bh/timer may use DeviceState when its refcnt=0, postpone the reclaimer till they have done with it. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- qom/object.c |9 - 1 files changed, 8 insertions(+), 1 deletions

[PATCH 15/15] e1000: using new interface--unmap to unplug

2012-08-08 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/e1000.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index 4573f13..fa71455 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -1192,6

Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it

2012-07-26 Thread liu ping fan
On Wed, Jul 25, 2012 at 5:08 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 25/07/2012 05:31, Liu Ping Fan ha scritto: From: Liu Ping Fan pingf...@linux.vnet.ibm.com rwlock: qemu_device_tree_mutex rd side: --device_del(destruction of device will be postphoned until unplug ack

Re: [PATCH 2/5] exec.c: use refcnt to protect device during dispatching

2012-07-26 Thread liu ping fan
On Wed, Jul 25, 2012 at 5:18 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 25/07/2012 10:12, liu ping fan ha scritto: +qemu_rwlock_rdlock_devtree(); section = phys_page_find(page TARGET_PAGE_BITS); +if (!(memory_region_is_ram(section-mr

Re: [PATCH 2/5] exec.c: use refcnt to protect device during dispatching

2012-07-26 Thread liu ping fan
On Wed, Jul 25, 2012 at 8:27 PM, Avi Kivity a...@redhat.com wrote: On 07/25/2012 01:58 PM, Avi Kivity wrote: while (len 0) { page = addr TARGET_PAGE_MASK; l = (page + TARGET_PAGE_SIZE) - addr; if (l len) l = len; + +

Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it

2012-07-26 Thread liu ping fan
On Thu, Jul 26, 2012 at 9:00 PM, Avi Kivity a...@redhat.com wrote: On 07/26/2012 03:56 PM, liu ping fan wrote: On Wed, Jul 25, 2012 at 5:08 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 25/07/2012 05:31, Liu Ping Fan ha scritto: From: Liu Ping Fan pingf...@linux.vnet.ibm.com rwlock

Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it

2012-07-26 Thread liu ping fan
On Thu, Jul 26, 2012 at 9:15 PM, Avi Kivity a...@redhat.com wrote: On 07/26/2012 04:14 PM, liu ping fan wrote: From the description above, I don't see why it can't be a mutex. Searching in the device tree (or MemoryRegion view) can be often in parallel, especially in mmio-dispatch code path

Re: [PATCH 2/5] exec.c: use refcnt to protect device during dispatching

2012-07-25 Thread liu ping fan
On Wed, Jul 25, 2012 at 3:43 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Wed, Jul 25, 2012 at 4:31 AM, Liu Ping Fan qemul...@gmail.com wrote: @@ -3396,13 +3420,25 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, uint32_t val; target_phys_addr_t page

Re: [PATCH 4/5] qom: delay DeviceState's reclaim to main-loop

2012-07-25 Thread liu ping fan
On Wed, Jul 25, 2012 at 3:37 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 25/07/2012 09:03, Stefan Hajnoczi ha scritto: From: Liu Ping Fan pingf...@linux.vnet.ibm.com iohandler/bh/timer may use DeviceState when its refcnt=0, It's not clear how to me. The only reference to devices from

Re: [PATCH 4/5] qom: delay DeviceState's reclaim to main-loop

2012-07-25 Thread liu ping fan
On Wed, Jul 25, 2012 at 3:03 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Wed, Jul 25, 2012 at 4:31 AM, Liu Ping Fan qemul...@gmail.com wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com iohandler/bh/timer may use DeviceState when its refcnt=0, postpone the reclaimer till they have

  1   2   >