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

2012-07-24 Thread Liu Ping Fan
refer to orignal plan posted by Marcelo Tosatti, http://lists.gnu.org/archive/html/qemu-devel/2012-06/msg04315.html These patches protect DeviceState's rd from reclaimer. It is neccessary when no qemu_global_lock protects between them. -- To unsubscribe from this list: send the line "unsubscribe k

[PATCH 3/5] hotplug: introduce qdev_unplug_ack() to remove device from views

2012-07-24 Thread Liu Ping Fan
From: Liu Ping Fan When guest confirm the removal of device, we should --unmap from MemoryRegion view --isolated from device tree view Signed-off-by: Liu Ping Fan --- hw/acpi_piix4.c |4 ++-- hw/qdev.c | 28 hw/qdev.h |3 ++- 3 files changed

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

2012-07-24 Thread Liu Ping Fan
From: Liu Ping Fan acquire device's refcnt with qemu_device_tree_mutex rwlock, so we can safely handle it when mmio dispatch. If in radix-tree, leaf is subpage, then move further step to acquire opaque which is the type --DeiveState. Signed-off-by: Liu Ping Fan --- exec.c |

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

2012-07-24 Thread Liu Ping Fan
From: Liu Ping Fan rwlock: qemu_device_tree_mutex rd side: --device_del(destruction of device will be postphoned until unplug ack from guest), --pci hot-unplug --iteration (qdev_reset_all) wr side: --device_add Signed-off-by: Liu Ping Fan --- hw/pci-hotplug.c |4 hw

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

2012-07-24 Thread Liu Ping Fan
From: Liu Ping Fan 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 --- include/qemu/object.h |2 +- main-loop.c |4 main-loop.h |2 ++ qemu-tool.c |4

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

2012-07-24 Thread Liu Ping Fan
From: Liu Ping Fan Signed-off-by: Liu Ping Fan --- hw/e1000.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index 4573f13..4c1e141 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -1192,6 +1192,18 @@ e1000_cleanup(VLANClientState *nc

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 wrote: > On Wed, Jul 25, 2012 at 4:31 AM, Liu Ping Fan 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 wrote: > Il 25/07/2012 09:03, Stefan Hajnoczi ha scritto: >> From: Liu Ping Fan >> >> iohandler/bh/timer may use DeviceState when its refcnt=0, > > It's not clear how to me. The only reference to devices from an &g

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 wrote: > On Wed, Jul 25, 2012 at 4:31 AM, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> iohandler/bh/timer may use DeviceState when its refcnt=0, >> postpone the reclaimer till they have done with it. >&g

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 wrote: > Il 25/07/2012 05:31, Liu Ping Fan ha scritto: >> From: Liu Ping Fan >> >> rwlock: >> qemu_device_tree_mutex >> >> rd side: >> --device_del(destruction of device will be postphoned until

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 wrote: > Il 25/07/2012 10:12, liu ping fan ha scritto: >>>> >> +qemu_rwlock_rdlock_devtree(); >>>> >> section = phys_page_find(page >> TARGET_PAGE_BITS); >>&g

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 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; >>> + >>> +qemu_rwlo

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 wrote: > On 07/26/2012 03:56 PM, liu ping fan wrote: >> On Wed, Jul 25, 2012 at 5:08 PM, Paolo Bonzini wrote: >>> Il 25/07/2012 05:31, Liu Ping Fan ha scritto: >>>> From: Liu Ping Fan >>>> >>>> r

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

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan Signed-off-by: Liu Ping Fan --- 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 index 8b17776..58db9d0 100644 --- a/include/qemu

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan Collect unused object and release them at caller demand. Signed-off-by: Liu Ping Fan --- include/qemu/reclaimer.h | 28 ++ main-loop.c |5 qemu-tool.c |5 qom/Makefile.objs|2 +- qom/reclaimer.c

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan 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 --- exec.c |3 +++ memory.c | 22 ++ memory.h |2 ++ 3 files changed, 27 insertions(+

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

2012-08-07 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 mem

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan 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 Fan --- hw/ide/piix.c

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan 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-off

[PATCH 01/15] atomic: introduce atomic operations

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan 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 --- include/qemu/atomic.h

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

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

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan 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 --- exec.c |8 memory.c | 33

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan 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-by: Liu Ping Fan --- exec.c

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan 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 --- exec.c | 27 +-- 1 files changed, 21 insertions(+), 6 deletions(-) diff --git a/exec.c b

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan Signed-off-by: Liu Ping Fan --- 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/cpus.c @@ -611,6 +611,7 @@ static void

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan 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 --- hw/pci-hotplug.c |4 hw/qdev

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan When guest confirm the removal of device, we should --unmap from MemoryRegion view --isolated from device tree view Signed-off-by: Liu Ping Fan --- hw/acpi_piix4.c |4 ++-- hw/pci.c| 13 - hw/pci.h|2 ++ hw/qdev.c | 28

[PATCH 14/15] qom: object_unref call reclaimer

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan 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 --- qom/object.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/qom/object.c b/qom/object.c index

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

2012-08-07 Thread Liu Ping Fan
From: Liu Ping Fan Signed-off-by: Liu Ping Fan --- 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 +1192,13 @@ e1000_cleanup(VLANClientState *nc) s

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 wrote: > On 08/08/2012 09:25 AM, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Using refcnt for mr, so we can separate mr's life cycle management >> from refered object. >> When mr->ref 0->1, inc the ref

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 wrote: > On 08/08/2012 09:25 AM, Liu Ping Fan wrote: >> From: Liu Ping Fan >> > > Please explain the motivation. AFAICT, the big qemu lock is sufficient. > Oh, this is one of the series locks for the removal of big qemu lock

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 wrote: > Il 08/08/2012 08:25, Liu Ping Fan ha scritto: >> From: Liu Ping Fan >> >> Signed-off-by: Liu Ping Fan >> --- >> cpus.c | 12 >> main-loop.h |3 +++ >> 2 files changed

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 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 */

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 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(); &g

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 wrote: > On Wed, Aug 8, 2012 at 6:25 AM, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Using mem_map_lock to protect among updaters. So we can get the intact >> snapshot of mem topology -- FlatView & radix-tree. &g

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 wrote: > On 08/08/2012 09:25 AM, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Using mem_map_lock to protect among updaters. So we can get the intact >> snapshot of mem topology -- FlatView & radix-tree. &g

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 wrote: > On Wed, Aug 8, 2012 at 6:25 AM, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> PhysMap contain the flatview and radix-tree view, they are snapshot >> of system topology and should be consistent. With PhysMap, we c

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 wrote: > On Wed, Aug 8, 2012 at 6:25 AM, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Flatview and radix view are all under the protection of pointer. >> And this make sure the change of them seem to be atomic! >>

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 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 >>>> > >>>> > Collect unused object and release them at caller demand. &

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 wrote: > Il 08/08/2012 08:25, Liu Ping Fan ha scritto: >> From: Liu Ping Fan >> >> Collect unused object and release them at caller demand. >> >> Signed-off-by: Liu Ping Fan >> --- >> include/qemu/recla

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

2012-08-09 Thread liu ping fan
On Thu, Aug 9, 2012 at 4:00 PM, Paolo Bonzini wrote: > Il 09/08/2012 09:28, liu ping fan ha scritto: >>> > VCPU threadI/O thread >>> > = >>> > get MMIO request &

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

2012-08-09 Thread liu ping fan
On Thu, Aug 9, 2012 at 3:40 PM, Paolo Bonzini 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

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

2012-08-09 Thread liu ping fan
On Thu, Aug 9, 2012 at 4:18 PM, Avi Kivity 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 >>>

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

2012-08-09 Thread liu ping fan
On Thu, Aug 9, 2012 at 4:38 PM, Avi Kivity wrote: > On 08/09/2012 10:27 AM, liu ping fan wrote: >> On Wed, Aug 8, 2012 at 5:20 PM, Avi Kivity wrote: >>> On 08/08/2012 09:25 AM, Liu Ping Fan wrote: >>>> From: Liu Ping Fan >>>> >>>> U

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 4:24 PM, Avi Kivity wrote: > On 08/09/2012 10:28 AM, liu ping fan wrote: >>> >>> Seems to me that nothing in memory.c can susceptible to races. It must >>> already be called under the big qemu lock, and with the exception of >>>

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 wrote: > On 08/08/2012 09:25 AM, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Flatview and radix view are all under the protection of pointer. >> And this make sure the change of them seem to be atomic! >> >>

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 wrote: > On Wed, Aug 8, 2012 at 5:41 PM, Avi Kivity wrote: >> On 08/08/2012 09:25 AM, Liu Ping Fan wrote: >>> From: Liu Ping Fan >>> >>> Flatview and radix view are all under the protection of pointer. >>&g

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 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. Jan,

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 wrote: > On 09/04/2012 11:17 AM, liu ping fan wrote: >> On Mon, Sep 3, 2012 at 7:48 PM, Avi Kivity wrote: >>> On 09/03/2012 09:44 AM, Juan Quintela wrote: >>>> >>>> Hi >>>> >>>&

Re: [Qemu-devel] [PATCH 2/2] LAPIC: make lapic support cpu hotplug

2011-10-05 Thread liu ping fan
On Wed, Oct 5, 2011 at 7:01 PM, Jan Kiszka wrote: > On 2011-10-05 12:26, liu ping fan wrote: >>>  > And make the creation of apic as part of cpu initialization, so >>>> apic's state has been ready, before setting kvm_apic. >>> >>> There is no k

Re: [Qemu-devel] [PATCH 2/2] LAPIC: make lapic support cpu hotplug

2011-10-07 Thread liu ping fan
On 10/6/11, Jan Kiszka wrote: > On 2011-10-06 03:13, liu ping fan wrote: >> On Wed, Oct 5, 2011 at 7:01 PM, Jan Kiszka wrote: >>> On 2011-10-05 12:26, liu ping fan wrote: >>>>> > And make the creation of apic as part of cpu initialization, so >>>&g

[PATCH 0] A series patches for kvm&qemu to enable vcpu destruction in kvm

2011-11-24 Thread Liu Ping Fan
A series of patches from kvm, qemu to guest. These patches will finally enable vcpu destruction in kvm instance and let vcpu thread exit in qemu. Currently, the vcpu online feature enables the dynamical creation of vcpu and vcpu thread, while the offline feature can not destruct the vcpu and le

[PATCH 1/2] kvm: make vcpu life cycle separated from kvm instance

2011-11-24 Thread Liu Ping Fan
From: Liu Ping Fan Currently, vcpu can be destructed only when kvm instance destroyed. Change this to vcpu as a refer to kvm, and then vcpu MUST and CAN be destroyed before kvm's destroy. Qemu will take advantage of this to exit the vcpu thread if the thread is no longer in use by guest. S

[PATCH 2/2] kvm: exit to userspace with reason KVM_EXIT_VCPU_DEAD

2011-11-26 Thread Liu Ping Fan
From: Liu Ping Fan The vcpu can be safely released when --1.guest tells us that the vcpu is not needed any longer. --2.vcpu hits the last instruction _halt_ If both of the conditions are satisfied, kvm exits to userspace with the reason vcpu dead. So the user thread can exit safely. Signed-off

[PATCH 1/5] QEMU Add cpu_phyid_to_cpu() to map cpu phyid to CPUState

2011-11-26 Thread Liu Ping Fan
From: Liu Ping Fan The guest has different cpu logic id from qemu, but they have the same phyid. When cpu phyid is told by guest, we need to obtain the corresponding CPUState. Signed-off-by: Liu Ping Fan --- target-i386/cpu.h|2 ++ target-i386/helper.c | 12 2 files

[PATCH 2/5] QEMU Add cpu_free() to support arch related CPUState release

2011-11-26 Thread Liu Ping Fan
From: Liu Ping Fan When exiting from vcpu thread, the CPUState must be freed firstly. And the handling process is an arch related. Signed-off-by: Liu Ping Fan --- hw/apic.c|4 target-i386/cpu.h|3 +++ target-i386/helper.c |8 3 files changed, 15

[PATCH 3/5] QEMU Introduce a pci device "cpustate" to get CPU_DEAD event in guest

2011-11-26 Thread Liu Ping Fan
From: Liu Ping Fan This device's driver in guest can get vcpu dead event and notify qemu through the device. Signed-off-by: Liu Ping Fan --- Makefile.target |1 + hw/pc_piix.c |1 + hw/pci.c | 22 +++ hw/pci.h |1 + hw/pci_cpustate.c |

[PATCH 4/5] QEMU Release vcpu and finally exit vcpu thread safely

2011-11-26 Thread Liu Ping Fan
From: Liu Ping Fan When guest driver tell us that the vcpu is no longer needed, qemu can release the vcpu and finally exit vcpu thread Signed-off-by: Liu Ping Fan --- cpu-defs.h|5 + cpus.c| 21 + hmp-commands.hx |2 +- hw/acpi_piix4.c

[PATCH 5/5] QEMU tmp patches for linux-header files

2011-11-26 Thread Liu Ping Fan
From: Liu Ping Fan Temporary patch for qemu to compile. Normally the headers should be copied from kernel. Signed-off-by: Liu Ping Fan --- kvm/include/linux/kvm.h |9 - linux-headers/linux/kvm.h |9 + 2 files changed, 17 insertions(+), 1 deletions(-) diff --git a

[PATCH] virtio: add a pci driver to notify host the CPU_DEAD event

2011-11-26 Thread Liu Ping Fan
From: Liu Ping Fan A driver for qemu device "cpustate". This driver catch the guest CPU_DEAD event, and notify host. Signed-off-by: Liu Ping Fan --- drivers/virtio/Kconfig |6 ++ drivers/virtio/Makefile|1 + drivers/virtio/cpustate_stu

Re: [PATCH 0] A series patches for kvm&qemu to enable vcpu destruction in kvm

2011-11-26 Thread Liu ping fan
On Sat, Nov 26, 2011 at 1:54 AM, Jan Kiszka wrote: > On 2011-11-25 00:35, Liu Ping Fan wrote: >> A series of patches from kvm, qemu to guest. These patches will finally >> enable vcpu destruction in kvm instance and let vcpu thread exit in qemu. >> >> Currently, the

Re: [Qemu-devel] [PATCH 2/2] kvm: exit to userspace with reason KVM_EXIT_VCPU_DEAD

2011-11-27 Thread Liu ping fan
On Sun, Nov 27, 2011 at 6:50 PM, Gleb Natapov wrote: > On Sun, Nov 27, 2011 at 12:36:55PM +0200, Avi Kivity wrote: >> On 11/27/2011 04:42 AM, Liu Ping Fan wrote: >> > From: Liu Ping Fan >> > >> > The vcpu can be safely released when >> > --1.guest te

[PATCH] kvm: make vcpu life cycle separated from kvm instance

2011-12-01 Thread Liu Ping Fan
From: Liu Ping Fan Currently, vcpu can be destructed only when kvm instance destroyed. Change this to vcpu's destruction taken when its refcnt is zero, and then vcpu MUST and CAN be destroyed before kvm's destroy. Signed-off-by: Liu Ping Fan --- arch/x86/kvm/i8254.c | 14 ++

Re: [PATCH] kvm: make vcpu life cycle separated from kvm instance

2011-12-04 Thread Liu ping fan
On Sat, Dec 3, 2011 at 2:26 AM, Jan Kiszka wrote: > On 2011-12-02 07:26, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Currently, vcpu can be destructed only when kvm instance destroyed. >> Change this to vcpu's destruction taken when its refcnt is zero,

Re: [PATCH] kvm: make vcpu life cycle separated from kvm instance

2011-12-04 Thread Liu ping fan
On Sun, Dec 4, 2011 at 6:23 PM, Avi Kivity wrote: > On 12/02/2011 08:26 AM, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Currently, vcpu can be destructed only when kvm instance destroyed. >> Change this to vcpu's destruction taken when its refcnt is zero,

Re: [PATCH] kvm: make vcpu life cycle separated from kvm instance

2011-12-04 Thread Liu ping fan
On Sun, Dec 4, 2011 at 8:10 PM, Gleb Natapov wrote: > On Sun, Dec 04, 2011 at 07:53:37PM +0800, Liu ping fan wrote: >> On Sat, Dec 3, 2011 at 2:26 AM, Jan Kiszka wrote: >> > On 2011-12-02 07:26, Liu Ping Fan wrote: >> >> From: Liu Ping Fan >> >> >>

Re: [PATCH] kvm: make vcpu life cycle separated from kvm instance

2011-12-05 Thread Liu ping fan
On Mon, Dec 5, 2011 at 4:41 PM, Gleb Natapov wrote: > On Mon, Dec 05, 2011 at 01:39:37PM +0800, Liu ping fan wrote: >> On Sun, Dec 4, 2011 at 8:10 PM, Gleb Natapov wrote: >> > On Sun, Dec 04, 2011 at 07:53:37PM +0800, Liu ping fan wrote: >> >> On Sat, Dec 3, 2011

[PATCH V2] kvm: make vcpu life cycle separated from kvm instance

2011-12-08 Thread Liu Ping Fan
From: Liu Ping Fan Currently, vcpu can be destructed only when kvm instance destroyed. Change this to vcpu's destruction taken when its refcnt is zero, and then vcpu MUST and CAN be destroyed before kvm's destroy. Signed-off-by: Liu Ping Fan --- arch/x86/kvm/i8254.c | 10 ++

[PATCH v3] kvm: make vcpu life cycle separated from kvm instance

2011-12-11 Thread Liu Ping Fan
From: Liu Ping Fan Currently, vcpu can be destructed only when kvm instance destroyed. Change this to vcpu's destruction taken when its refcnt is zero, and then vcpu MUST and CAN be destroyed before kvm's destroy. Signed-off-by: Liu Ping Fan --- arch/x86/kvm/i8254.c | 10 ++

Re: [PATCH v3] kvm: make vcpu life cycle separated from kvm instance

2011-12-13 Thread Liu ping fan
On Mon, Dec 12, 2011 at 8:54 PM, Gleb Natapov wrote: > On Mon, Dec 12, 2011 at 10:41:23AM +0800, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Currently, vcpu can be destructed only when kvm instance destroyed. >> Change this to vcpu's destruction taken when

Re: [PATCH v3] kvm: make vcpu life cycle separated from kvm instance

2011-12-14 Thread Liu ping fan
On Tue, Dec 13, 2011 at 7:36 PM, Marcelo Tosatti wrote: > On Mon, Dec 12, 2011 at 10:41:23AM +0800, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Currently, vcpu can be destructed only when kvm instance destroyed. >> Change this to vcpu's destruction taken when

[PATCH v4] kvm: make vcpu life cycle separated from kvm instance

2011-12-14 Thread Liu Ping Fan
From: Liu Ping Fan Currently, vcpu can be destructed only when kvm instance destroyed. Change this to vcpu's destruction before kvm instance, so vcpu MUST and CAN be destroyed before kvm's destroy. Signed-off-by: Liu Ping Fan --- arch/x86/kvm/i8254.c |8 ++- arch/x86/k

Re: [PATCH v4] kvm: make vcpu life cycle separated from kvm instance

2011-12-14 Thread Liu ping fan
On Thu, Dec 15, 2011 at 1:33 PM, Xiao Guangrong wrote: > On 12/15/2011 12:28 PM, Liu Ping Fan wrote: > > >> --- a/arch/x86/kvm/mmu.c >> +++ b/arch/x86/kvm/mmu.c >> @@ -1833,11 +1833,12 @@ static void kvm_mmu_put_page(struct kvm_mmu_page >> *sp, u6

Re: [PATCH v3] kvm: make vcpu life cycle separated from kvm instance

2011-12-15 Thread Liu ping fan
2011/12/15 Gleb Natapov : > On Thu, Dec 15, 2011 at 11:21:37AM +0800, Liu ping fan wrote: >> On Tue, Dec 13, 2011 at 7:36 PM, Marcelo Tosatti wrote: >> > On Mon, Dec 12, 2011 at 10:41:23AM +0800, Liu Ping Fan wrote: >> >> From: Liu Ping Fan >> >> >>

Re: [PATCH v4] kvm: make vcpu life cycle separated from kvm instance

2011-12-15 Thread Liu ping fan
On Thu, Dec 15, 2011 at 5:10 PM, Gleb Natapov wrote: > On Thu, Dec 15, 2011 at 12:28:48PM +0800, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Currently, vcpu can be destructed only when kvm instance destroyed. >> Change this to vcpu's destruction before kvm i

[PATCH v5] kvm: make vcpu life cycle separated from kvm instance

2011-12-16 Thread Liu Ping Fan
From: Liu Ping Fan Currently, vcpu can be destructed only when kvm instance destroyed. Change this to vcpu's destruction before kvm instance, so vcpu MUST and CAN be destroyed before kvm's destroy. Signed-off-by: Liu Ping Fan --- arch/x86/kvm/i8254.c | 10 +++-- arch/x86/k

Re: [PATCH v4] kvm: make vcpu life cycle separated from kvm instance

2011-12-16 Thread Liu ping fan
2011/12/15 Takuya Yoshikawa : > (2011/12/15 13:28), Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Currently, vcpu can be destructed only when kvm instance destroyed. >> Change this to vcpu's destruction before kvm instance, so vcpu MUST >> and CAN be destroy

Re: [PATCH v5] kvm: make vcpu life cycle separated from kvm instance

2011-12-26 Thread Liu ping fan
On Mon, Dec 26, 2011 at 7:09 PM, Gleb Natapov wrote: > On Sat, Dec 17, 2011 at 11:19:35AM +0800, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Currently, vcpu can be destructed only when kvm instance destroyed. >> Change this to vcpu's destruction before kvm i

[PATCH v6] kvm: make vcpu life cycle separated from kvm instance

2011-12-27 Thread Liu Ping Fan
From: Liu Ping Fan Currently, vcpu can be destructed only when kvm instance destroyed. Change this to vcpu's destruction before kvm instance, so vcpu MUST and CAN be destroyed before kvm's destroy. Signed-off-by: Liu Ping Fan --- arch/x86/kvm/i8254.c | 10 +++-- arch/x86/k

Re: [PATCH v6] kvm: make vcpu life cycle separated from kvm instance

2011-12-27 Thread Liu ping fan
2011/12/27 Takuya Yoshikawa : > (2011/12/27 17:38), Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Currently, vcpu can be destructed only when kvm instance destroyed. >> Change this to vcpu's destruction before kvm instance, so vcpu MUST >> and CAN be destro

Re: [PATCH v6] kvm: make vcpu life cycle separated from kvm instance

2011-12-29 Thread Liu ping fan
On Wed, Dec 28, 2011 at 5:53 PM, Avi Kivity wrote: > On 12/28/2011 08:54 AM, Liu ping fan wrote: >> >> >> >>   struct kvm_vcpu { >> >>       struct kvm *kvm; >> >> +     struct list_head list; >> >>   #ifdef CONFIG_PREEMPT

Re: [PATCH v6] kvm: make vcpu life cycle separated from kvm instance

2012-01-05 Thread Liu ping fan
On Thu, Dec 29, 2011 at 10:31 PM, Avi Kivity wrote: > On 12/29/2011 04:03 PM, Liu ping fan wrote: >> > Why do we want an independent grace period, is hotunplugging a vcpu that >> > much different from hotunplugging memory? >> > >> I thought that if less

[PATCH v7] kvm: make vcpu life cycle separated from kvm instance

2012-01-06 Thread Liu Ping Fan
From: Liu Ping Fan Currently, vcpu will be destructed only after kvm instance is destroyed. This result to vcpu keep idle in kernel, but can not be freed when it is unplugged in guest. Change this to vcpu's destruction before kvm instance, so vcpu MUST and CAN be destroyed before kvm ins

Could anybody give some description about the implement of hyercall in kvm?

2012-01-11 Thread Liu ping fan
Hi, Could anybody give some description about the implement of hyercall in kvm? Or give some links about it? Thanks, ping fan -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majo

Re: Could anybody give some description about the implement of hyercall in kvm?

2012-01-12 Thread Liu ping fan
On Thu, Jan 12, 2012 at 5:21 PM, Stefan Hajnoczi wrote: > On Thu, Jan 12, 2012 at 4:38 AM, Liu ping fan wrote: >> Could anybody give some description about the implement of hyercall in >> kvm? Or give some links about it? > > Try git grep hypercall arch/x86/kvm. > >

Re: Could anybody give some description about the implement of hyercall in kvm?

2012-01-13 Thread Liu ping fan
On Fri, Jan 13, 2012 at 6:11 PM, Stefan Hajnoczi wrote: > On Fri, Jan 13, 2012 at 7:45 AM, Liu ping fan wrote: >> On Thu, Jan 12, 2012 at 5:21 PM, Stefan Hajnoczi wrote: >>> On Thu, Jan 12, 2012 at 4:38 AM, Liu ping fan wrote: >>>> Could anybody give some desc

Re: [PATCH v7] kvm: make vcpu life cycle separated from kvm instance

2012-01-15 Thread Liu ping fan
On Thu, Jan 12, 2012 at 8:37 PM, Avi Kivity wrote: > On 01/07/2012 04:55 AM, Liu Ping Fan wrote: >> From: Liu Ping Fan >> >> Currently, vcpu will be destructed only after kvm instance is >> destroyed. This result to vcpu keep idle in kernel, but can not >> be fr

vhost-net: is there a race for sock in handle_tx/rx?

2012-05-03 Thread Liu ping fan
Hi, During reading the vhost-net code, I find the following, static void handle_tx(struct vhost_net *net) { struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_TX]; unsigned out, in, s; int head; struct msghdr msg = { .msg_name = NULL,

Re: vhost-net: is there a race for sock in handle_tx/rx?

2012-05-03 Thread Liu ping fan
Oh, got it. It is a very interesting implement. Thanks and regards, pingfan On Thu, May 3, 2012 at 4:41 PM, Michael S. Tsirkin wrote: > On Thu, May 03, 2012 at 04:33:55PM +0800, Liu ping fan wrote: >> Hi, >> >> During reading the vhost-net code, I find the following, >&g

[RFC:kvm] export host NUMA info to guest & make emulated device NUMA attr

2012-05-17 Thread Liu Ping Fan
Currently, the guest can not know the NUMA info of the vcpu, which will result in performance drawback. This is the discovered and experiment by Shirley Ma Krishna Kumar Tom Lendacky Refer to - http://www.mail-archive.com/kvm@vger.kernel.org/msg69868.html we can see the

[PATCH 1/2] [kvm/vhost]: make vhost support NUMA model.

2012-05-17 Thread Liu Ping Fan
From: Liu Ping Fan Make vhost allocate vhost_virtqueue on different host nodes as required. Signed-off-by: Liu Ping Fan --- drivers/vhost/vhost.c | 380 +++-- drivers/vhost/vhost.h | 41 -- include/linux/vhost.h |2 +- 3 files changed

[PATCH 1/2] [kvm/virtio]: make virtio support NUMA attr

2012-05-17 Thread Liu Ping Fan
From: Liu Ping Fan For each numa node reported by vhost, we alloc a pair of i/o vq, and assign them msix IRQ, and set irq affinity to a set of vcpu in the same node. Also we alloc vqs on PAGE_SIZE align, so they will be allocated by host when pg fault happen on different node. Signed-off-by

[PATCH 2/2] [net/virtio_net]: make virtio_net support NUMA info

2012-05-17 Thread Liu Ping Fan
From: Liu Ping Fan Vhost net uses separate transfer logic unit in different node. Virtio net must determine which logic unit it will talk with, so we can improve the performance. Signed-off-by: Liu Ping Fan --- drivers/net/virtio_net.c | 425 ++ 1

[PATCH 2/2] [kvm/vhost-net]: make vhost net own NUMA attribute

2012-05-17 Thread Liu Ping Fan
From: Liu Ping Fan Make vhost net support to spread on host node according the command. And consider the whole vhost_net componsed of lots of logic net units. for each node, there is a unit, which includes a vhost_worker thread, rx/tx vhost_virtqueue. Signed-off-by: Liu Ping Fan --- drivers

Re: [RFC:kvm] export host NUMA info to guest & make emulated device NUMA attr

2012-05-22 Thread Liu ping fan
On Sat, May 19, 2012 at 12:14 AM, Shirley Ma wrote: > On Thu, 2012-05-17 at 17:20 +0800, Liu Ping Fan wrote: >> Currently, the guest can not know the NUMA info of the vcpu, which >> will >> result in performance drawback. >> >> This is the discovered and ex

[RFC] kvm: export host NUMA info to guest's scheduler

2012-05-22 Thread Liu Ping Fan
Currently, the guest can not know the NUMA info of the vcpu, which will result in performance drawback. For example: Supposing vcpu-a on nodeA, vcpu-b on nodeB, when load balance, the tasks' pull and push between these vcpus will cost more. But unfortunately, currently, the guest is just blind to

[PATCH 1/2] sched: add virt sched domain for the guest

2012-05-22 Thread Liu Ping Fan
From: Liu Ping Fan The guest's scheduler can not see the numa info on the host and this will result to the following scene: Supposing vcpu-a on nodeA, vcpu-b on nodeB, when load balance, the tasks' pull and push between these vcpus will cost more. But unfortunately, currently, th

[PATCH 2/2] sched: add virt domain device's driver

2012-05-22 Thread Liu Ping Fan
From: Liu Ping Fan A driver plays with Qemu's emulated "virt domain device". They aims to export the host numa info to the guest. --todo: A more proper place to archive this driver? Signed-off-by: Liu Ping Fan --- drivers/virtio/Kconfig |4 ++ drivers/virtio/Makefile |

[PATCH] kvm: collect vcpus' numa info for guest's scheduler

2012-05-22 Thread Liu Ping Fan
From: Liu Ping Fan The guest's scheduler can not see the numa info on the host and this will result to the following scene: Supposing vcpu-a on nodeA, vcpu-b on nodeB, when load balance, the tasks' pull and push between these vcpus will cost more. But unfortunately, currently, th

  1   2   >