Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-23 Thread liu ping fan
On Tue, May 21, 2013 at 6:57 PM, Paolo Bonzini pbonz...@redhat.com wrote: Using phys_page_find to translate an AddressSpace to a MemoryRegionSection is unwieldy. It requires to pass the page index rather than the address, and later memory_region_section_addr has to be called. Replace

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-23 Thread liu ping fan
On Thu, May 23, 2013 at 5:59 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 23/05/2013 09:09, liu ping fan ha scritto: void address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, int len, bool is_write) { -AddressSpaceDispatch *d = as-dispatch

Re: [Qemu-devel] [RFC PATCH 1/2] mem: make phys_section and phys_map_nodes prepared for RCU

2013-05-26 Thread liu ping fan
[...] +static PhysPageTable *cur_pgtbl; +static PhysPageTable *next_pgtbl; You shouldn't need cur_pgtbl. Instead, each AddressSpaceDispatch should have a pointer to its own cur_pgtbl. In the commit hook you can then take a lock, unref the old table, assign cur_pgtbl = next_pgtbl and ref

Re: [Qemu-devel] [PATCH v1 07/14] net: hub use lock to protect ports list

2013-05-28 Thread liu ping fan
On Tue, May 21, 2013 at 9:57 PM, Stefan Hajnoczi stefa...@redhat.com wrote: On Tue, May 07, 2013 at 01:46:55PM +0800, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Hub ports will run on multi-threads, so use lock to protect them. Signed-off-by: Liu Ping Fan pingf

Re: [Qemu-devel] [RFC PATCH 1/2] mem: make phys_section and phys_map_nodes prepared for RCU

2013-05-28 Thread liu ping fan
On Mon, May 27, 2013 at 7:54 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 26/05/2013 15:02, liu ping fan ha scritto: [...] +static PhysPageTable *cur_pgtbl; +static PhysPageTable *next_pgtbl; You shouldn't need cur_pgtbl. Instead, each AddressSpaceDispatch should have a pointer to its

[Qemu-devel] [PATCH v1 0/6] make memory listener prepared for rcu style

2013-05-28 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com This series aim to make mmio dispatch lockless. Based on Paolo's tree git://github.com/bonzini/qemu.git, branch iommu For seqlock and rcu, I think Paolo will post them out later. rfcv1-v1: use seqlock to protect reader against writer (thanks

[Qemu-devel] [PATCH v1 1/6] mem: change variable to macro

2013-05-28 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com The secions like phys_section_unassigned always has fixed address in phys_sections, make them declared as macro, so we can use them when having more than one phys_sections, ie, more than one dispatch context. Signed-off-by: Liu Ping Fan pingf

[Qemu-devel] [PATCH v1 4/6] mem: concenter the root of each AddressSpaceDispatch

2013-05-28 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com All of AddressSpaceDispatch's roots are part of dispatch context, along with cur_map_nodes, cur_phys_sections, and we should walk through AddressSpaceDispatchs in the same dispatch context, ie the same memory topology. Concenter the roots, so we can

[Qemu-devel] [PATCH v1 2/6] mem: make global dispatch table ready for rcu

2013-05-28 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com Currently, phys_node_map and phys_sections are shared by all of the AddressSpaceDispatch. When updating mem topology, all AddressSpaceDispatch will rebuild dispatch tables sequentially on them. In order to use rcu-style, introducing next_node_map

[Qemu-devel] [PATCH v1 3/6] mem: fold tcg listener's logic into core memory listener

2013-05-28 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com We can do the tcg listener's logic in core memory listener. And this will help us concentrate the rcu updater. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- exec.c | 19 +-- 1 files changed, 5 insertions(+), 14

[Qemu-devel] [PATCH v1 6/6] mem: change tcg code to rcu style

2013-05-28 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com When adopting rcu style, for tcg code, need to fix two kind of path: -tlb_set_page() will cache translation info. -instruction emualation path Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com Not sure about tcg code, so I took

[Qemu-devel] [PATCH v1 5/6] mem: make dispatch path satify rcu style

2013-05-28 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com Using seqlock to load dispatch context atomic. The dispatch context consist of: cur_map_nodes, cur_sections, cur_roots. Also during the dispatch, we should get the terminal, and dup MemoryRegionSection. So after rcu unlock, the cur dispatch context

Re: [Qemu-devel] [PATCH v1 4/6] mem: concenter the root of each AddressSpaceDispatch

2013-05-29 Thread liu ping fan
On Wed, May 29, 2013 at 3:03 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/05/2013 04:11, Liu Ping Fan ha scritto: From: Liu Ping Fan pingf...@linux.vnet.ibm.com All of AddressSpaceDispatch's roots are part of dispatch context, along with cur_map_nodes, cur_phys_sections, and we should

Re: [Qemu-devel] [PATCH v1 6/6] mem: change tcg code to rcu style

2013-05-29 Thread liu ping fan
On Wed, May 29, 2013 at 3:22 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/05/2013 04:11, Liu Ping Fan ha scritto: From: Liu Ping Fan pingf...@linux.vnet.ibm.com When adopting rcu style, for tcg code, need to fix two kind of path: -tlb_set_page() will cache translation info

Re: [Qemu-devel] [PATCH v1 4/6] mem: concenter the root of each AddressSpaceDispatch

2013-05-29 Thread liu ping fan
On Wed, May 29, 2013 at 4:31 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/05/2013 09:48, liu ping fan ha scritto: On Wed, May 29, 2013 at 3:03 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/05/2013 04:11, Liu Ping Fan ha scritto: From: Liu Ping Fan pingf...@linux.vnet.ibm.com All

Re: [Qemu-devel] broken incoming migration

2013-06-08 Thread liu ping fan
Hi Peter, Is it that sending zero page mostly service the first iteration, ie bluk-stage? And for the subsequent iteration, dirty pages are normally not zero. Thanks On Wed, Jun 5, 2013 at 2:09 PM, Peter Lieven p...@kamp.de wrote: Am 05.06.2013 um 05:37 schrieb Alexey Kardashevskiy

Re: [Qemu-devel] [PATCH v5 2/5] hpet: entitle more irq pins for hpet

2013-09-30 Thread liu ping fan
On Sun, Sep 29, 2013 at 12:15 PM, Michael S. Tsirkin m...@redhat.com wrote: On Sun, Sep 29, 2013 at 11:49:41AM +0800, liu ping fan wrote: On Sun, Sep 29, 2013 at 3:56 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Sep 12, 2013 at 11:25:15AM +0800, Liu Ping Fan wrote: On PC, IRQ2/8 can

Re: [Qemu-devel] [PATCH v5 1/5] hpet: inverse polarity when pin above ISA_NUM_IRQS

2013-09-30 Thread liu ping fan
On Sun, Sep 29, 2013 at 12:20 PM, Michael S. Tsirkin m...@redhat.com wrote: On Sun, Sep 29, 2013 at 11:25:24AM +0800, liu ping fan wrote: On Sun, Sep 29, 2013 at 3:52 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Sep 12, 2013 at 11:25:14AM +0800, Liu Ping Fan wrote: According to hpet

Re: [Qemu-devel] [PATCH v5 2/5] hpet: entitle more irq pins for hpet

2013-10-08 Thread liu ping fan
On Mon, Sep 30, 2013 at 11:58 PM, Michael S. Tsirkin m...@redhat.com wrote: On Mon, Sep 30, 2013 at 05:48:03PM +0200, Paolo Bonzini wrote: Il 30/09/2013 11:30, Michael S. Tsirkin ha scritto: I was really only talking about q35 here. I thought it's ugly that users can control intcap

[Qemu-devel] [PATCH v6 0/5] bugs fix for hpet

2013-10-10 Thread Liu Ping Fan
v4: use stand compat property to fix hpet intcap v3: change hpet interrupt capablity on board's demand Liu Ping Fan (5): hpet: inverse polarity when pin above ISA_NUM_IRQS hpet: enable to entitle more irq pins for hpet PC: use qdev_xx to create hpet instead of sysbus_create_xx PC: add

[Qemu-devel] [PATCH v6 1/5] hpet: inverse polarity when pin above ISA_NUM_IRQS

2013-10-10 Thread Liu Ping Fan
of this inversion inside the hpet logic. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/timer/hpet.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index fcd22ae..8429eb3 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c

[Qemu-devel] [PATCH v6 2/5] hpet: enable to entitle more irq pins for hpet

2013-10-10 Thread Liu Ping Fan
On q35, IRQ2/8 can be reserved for hpet timer 0/1. And pin 16~23 of ioapic can be dynamically assigned to hpet as guest chooses. So we introduce intcap property to do that. (currently, its value is IRQ2. Later, it should be set by board.) Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com

[Qemu-devel] [PATCH v6 5/5] PC: differentiate hpet's interrupt capability on piix and q35

2013-10-10 Thread Liu Ping Fan
For pc-piix-*, hpet's intcap is always hard coded as IRQ2. For q35, if it is pc-q35-1.7 and earlier, we use IRQ2 for compat reason, otherwise IRQ2, IRQ8, and IRQ16~23 are allowed. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/i386/pc.c | 21 - hw/i386

[Qemu-devel] [PATCH v6 3/5] PC: use qdev_xx to create hpet instead of sysbus_create_xx

2013-10-10 Thread Liu Ping Fan
sysbus_create_xx func does not allow us to set a device's extra properties. While hpet need to set its compat property before initialization, so we abandon the wrapper function, and spread its logic inline Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/i386/pc.c| 11

[Qemu-devel] [PATCH v6 4/5] PC: add hpet compat to trace compatability version

2013-10-10 Thread Liu Ping Fan
For guest bug compat, we need to limit hpet's intcap on IRQ2 for pc-q35-1.7 and earlier. We use hpet's compat property to indicate the PC version. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index c6042c7..90f1ea4 100644 --- a/hw

Re: [Qemu-devel] [PATCH v6 2/5] hpet: enable to entitle more irq pins for hpet

2013-10-10 Thread liu ping fan
On Thu, Oct 10, 2013 at 5:11 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 10/10/2013 09:56, Liu Ping Fan ha scritto: On q35, IRQ2/8 can be reserved for hpet timer 0/1. And pin 16~23 of ioapic can be dynamically assigned to hpet as guest chooses. So we introduce intcap property to do

Re: [Qemu-devel] [PATCH v6 2/5] hpet: enable to entitle more irq pins for hpet

2013-10-10 Thread liu ping fan
On Thu, Oct 10, 2013 at 7:41 PM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Oct 10, 2013 at 11:46:42AM +0200, Paolo Bonzini wrote: Il 10/10/2013 11:41, Michael S. Tsirkin ha scritto: Are you sure? This is not done for any other compat property. Paolo It's done if we use the

Re: [Qemu-devel] [PATCH v6 2/5] hpet: enable to entitle more irq pins for hpet

2013-10-11 Thread liu ping fan
On Fri, Oct 11, 2013 at 4:38 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 11/10/2013 04:59, liu ping fan ha scritto: On Thu, Oct 10, 2013 at 7:41 PM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Oct 10, 2013 at 11:46:42AM +0200, Paolo Bonzini wrote: Il 10/10/2013 11:41, Michael S

Re: [Qemu-devel] [PATCH v6 2/5] hpet: enable to entitle more irq pins for hpet

2013-10-14 Thread liu ping fan
On Mon, Oct 14, 2013 at 10:18 PM, Michael S. Tsirkin m...@redhat.com wrote: On Fri, Oct 11, 2013 at 10:59:40AM +0800, liu ping fan wrote: On Thu, Oct 10, 2013 at 7:41 PM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Oct 10, 2013 at 11:46:42AM +0200, Paolo Bonzini wrote: Il 10/10/2013 11

[Qemu-devel] [PATCH v7 0/4] bugs fix for hpet

2013-10-16 Thread Liu Ping Fan
property compat to tell PC version v5: use stand compat property to fix hpet intcap on pc-q35, while on pc-piix, hard code intcap as IRQ2 v4: use stand compat property to fix hpet intcap v3: change hpet interrupt capablity on board's demand Liu Ping Fan (4): hpet: inverse polarity when pin

[Qemu-devel] [PATCH v7 3/4] PC: use qdev_xx to create hpet instead of sysbus_create_xx

2013-10-16 Thread Liu Ping Fan
sysbus_create_xx func does not allow us to set a device's extra properties. While hpet need to set its compat property before initialization, so we abandon the wrapper function, and spread its logic inline Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/i386/pc.c| 11

[Qemu-devel] [PATCH v7 1/4] hpet: inverse polarity when pin above ISA_NUM_IRQS

2013-10-16 Thread Liu Ping Fan
of this inversion inside the hpet logic. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/timer/hpet.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index fcd22ae..8429eb3 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c

[Qemu-devel] [PATCH v7 2/4] hpet: enable to entitle more irq pins for hpet

2013-10-16 Thread Liu Ping Fan
On q35, IRQ2/8 can be reserved for hpet timer 0/1. And pin 16~23 of ioapic can be dynamically assigned to hpet as guest chooses. So we introduce intcap property to do that. (currently, its value is IRQ2. Later, it should be set by board.) Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com

[Qemu-devel] [PATCH v7 4/4] PC: differentiate hpet's interrupt capability on piix and q35

2013-10-16 Thread Liu Ping Fan
For pc-piix-*, hpet's intcap is always hard coded as IRQ2. For q35, if it is pc-q35-1.7 and earlier, we use IRQ2 for compat reason, otherwise IRQ2, IRQ8, and IRQ16~23 are allowed. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/i386/pc.c | 20 +++- hw/i386

Re: [Qemu-devel] [PATCH v7 4/4] PC: differentiate hpet's interrupt capability on piix and q35

2013-10-17 Thread liu ping fan
On Thu, Oct 17, 2013 at 1:44 PM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Oct 17, 2013 at 11:16:05AM +0800, Liu Ping Fan wrote: For pc-piix-*, hpet's intcap is always hard coded as IRQ2. For q35, if it is pc-q35-1.7 and earlier, we use IRQ2 for compat reason, otherwise IRQ2, IRQ8

[Qemu-devel] [PATCH v8 0/2] bugs fix for hpet

2013-10-17 Thread Liu Ping Fan
interrupt capablity on board's demand Liu Ping Fan (2): hpet: inverse polarity when pin above ISA_NUM_IRQS hpet: enable to entitle more irq pins for hpet hw/i386/pc.c | 19 --- hw/i386/pc_piix.c| 3 ++- hw/i386/pc_q35.c | 21 + hw/timer

[Qemu-devel] [PATCH v8 1/2] hpet: inverse polarity when pin above ISA_NUM_IRQS

2013-10-17 Thread Liu Ping Fan
of this inversion inside the hpet logic. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/timer/hpet.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index fcd22ae..8429eb3 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c

[Qemu-devel] [PATCH v8 2/2] hpet: enable to entitle more irq pins for hpet

2013-10-17 Thread Liu Ping Fan
finally have the following value for intcap: For piix, hpet's intcap is hard coded as IRQ2. For pc-q35-1.7 and earlier, we use IRQ2 for compat reason. Otherwise IRQ2, IRQ8, and IRQ16~23 are allowed. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/i386/pc.c | 19

Re: [Qemu-devel] [PATCH v8 0/2] bugs fix for hpet

2013-10-22 Thread liu ping fan
ping? Any further comment? Thanks On Fri, Oct 18, 2013 at 12:00 PM, Liu Ping Fan qemul...@gmail.com wrote: v8: make piix/q35 compat diverge simplify the code, use hpet_irqs to pass intcap value v7: use macro to define intcap in pc.h (as to 3/4 and 4/4, I am not sure about whether

[Qemu-devel] [PATCH 0/2] make slirp drivern by glib directly

2013-10-27 Thread Liu Ping Fan
This series make slirp drivern directly by glib, so we can clean up the hooks for slrip in mainloop and stub Liu Ping Fan (2): slirp: introduce gsource event abstraction slirp: make slirp event dispatch based on slirp instance main-loop.c | 6 --- net/slirp.c | 3

[Qemu-devel] [PATCH 1/2] slirp: introduce gsource event abstraction

2013-10-27 Thread Liu Ping Fan
Introduce struct SlirpGSource. It will ease the usage of GSource associated with a group of files, which are dynamically allocated and release for slirp. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- slirp/Makefile.objs | 2 +- slirp/slirp_gsource.c | 94

[Qemu-devel] [PATCH 2/2] slirp: make slirp event dispatch based on slirp instance

2013-10-27 Thread Liu Ping Fan
Each slirp instance has its own GFuncs, so we can driver slirp by glib main loop. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- For easing the review, This patch does not obey coding guide. Will fix it later --- main-loop.c | 6 --- net/slirp.c | 3 ++ slirp

Re: [Qemu-devel] [PATCH v3 0/3] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe

2013-09-11 Thread liu ping fan
Hi Stefan, Do you think this series is ready to be merged? I have some code to run hpet on a dedicated thread, and in theory it will rely on this. Thanks and regards, Pingfan On Thu, Aug 29, 2013 at 10:42 PM, Stefan Hajnoczi stefa...@redhat.com wrote: v3: * Squashed Paolo's fixes and added

[Qemu-devel] [PATCH v5 0/5] bugs fix for hpet

2013-09-11 Thread Liu Ping Fan
v5: use stand compat property to fix hpet intcap on pc-q35, while on pc-piix, hard code intcap as IRQ2 v4: use stand compat property to fix hpet intcap v3: change hpet interrupt capablity on board's demand Liu Ping Fan (5): hpet: inverse polarity when pin above ISA_NUM_IRQS hpet

[Qemu-devel] [PATCH v5 2/5] hpet: entitle more irq pins for hpet

2013-09-11 Thread Liu Ping Fan
On PC, IRQ2/8 can be reserved for hpet timer 0/1. And pin 16~23 of ioapic can be dynamically assigned to hpet as guest chooses. (Will enable them after introducing pc 1.6 compat) Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/timer/hpet.c | 13 +++-- 1 file changed, 11

[Qemu-devel] [PATCH v5 1/5] hpet: inverse polarity when pin above ISA_NUM_IRQS

2013-09-11 Thread Liu Ping Fan
Ping Fan pingf...@linux.vnet.ibm.com --- hw/timer/hpet.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index fcd22ae..8429eb3 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -198,13 +198,23 @@ static void update_irq(struct

[Qemu-devel] [PATCH v5 3/5] PC: use qdev_xx to create hpet instead of sysbus_create_xx

2013-09-11 Thread Liu Ping Fan
sysbus_create_xx func does not allow us to set a device's extra properties. While hpet need to set its compat property before initialization, so we abandon the wrapper function, and spread its logic inline Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/i386/pc.c | 11

[Qemu-devel] [PATCH v5 4/5] PC: differentiate hpet's interrupt capability on piix and q35

2013-09-11 Thread Liu Ping Fan
For pc-piix-*, hpet's intcap is always hard coded as IRQ2. While for pc-q35-*, we resort to compat property to fix it (a later patch). Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/i386/pc.c | 12 hw/i386/pc_piix.c| 3 ++- hw/i386/pc_q35.c | 2

[Qemu-devel] [PATCH v5 5/5] PC-1.6: add compatibility for hpet intcap on pc-q35-1.6

2013-09-11 Thread Liu Ping Fan
For guest bug compat, we limit hpet's interrupt compatibility on ioapic's IRQ2 for pc-q35-1.6. As to pc-35-1.7 and newer, IRQ2, IRQ8, and IRQ16~23 are allowed. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/timer/hpet.c | 7 ++- include/hw/i386/pc.h | 4 2 files

[Qemu-devel] [PATCH 2/5] irq: implement route method of ioapic

2013-09-11 Thread Liu Ping Fan
Implement the routing of PC's interrupt gpio to intc, and retrieve the gsi. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/core/qdev.c | 8 hw/i386/kvm/i8259.c| 8 +++- hw/i386/kvm/ioapic.c | 21 - hw/i386/pc_q35.c | 4

[Qemu-devel] [RFC 0/5] run hpet on a dedicated thread

2013-09-11 Thread Liu Ping Fan
patches for timers. And it is just for discussion. And code is premature. Liu Ping Fan (5): irq: introduce route method in IRQState to get gsi irq: implement route method of ioapic irqfd: equip irqfd with polarity hpet: deliver irq by irqfd when in dedicated thread mode hpet: run

[Qemu-devel] [PATCH 1/5] irq: introduce route method in IRQState to get gsi

2013-09-11 Thread Liu Ping Fan
in qemu, and forward irq directly to kernel where re-entrance is already allowed. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/core/irq.c| 39 +++ include/hw/irq.h | 5 + 2 files changed, 44 insertions(+) diff --git a/hw/core/irq.c b/hw

[Qemu-devel] [PATCH 3/5] irqfd: equip irqfd with polarity

2013-09-11 Thread Liu Ping Fan
Equip irqfd with polarity, so it can emulate the low-active interrupt. We take one extra bit in flags to pass this info to kernel and keep the default value zero as high-active. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- The kernel will extend this interface correspondingly

[Qemu-devel] [PATCH 5/5] hpet: run on dedicate thread

2013-09-11 Thread Liu Ping Fan
migration is not supported yet. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- hw/timer/hpet.c | 31 ++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index ae54b87..8e32e36 100644 --- a/hw/timer/hpet.c

[Qemu-devel] [PATCH 4/5] hpet: deliver irq by irqfd when in dedicated thread mode

2013-09-11 Thread Liu Ping Fan
Running hpet in iothread, there could be variable payload, which will finally affect the accurate of timing. So we want to run hpet on dedicated thread. For hpet, almost of the things can run out of BQL, except interrupt. We step around interrupt by using irqfd. Signed-off-by: Liu Ping Fan pingf

[Qemu-devel] [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: [Qemu-devel] [PATCH v5 0/5] bugs fix for hpet

2013-09-12 Thread liu ping fan
On Thu, Sep 12, 2013 at 2:29 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 12/09/2013 05:25, Liu Ping Fan ha scritto: v5: use stand compat property to fix hpet intcap on pc-q35, while on pc-piix, hard code intcap as IRQ2 v4: use stand compat property to fix hpet intcap v3

Re: [Qemu-devel] [PATCH v3 0/3] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe

2013-09-12 Thread liu ping fan
On Thu, Sep 12, 2013 at 4:17 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Thu, Sep 12, 2013 at 11:10:01AM +0800, liu ping fan wrote: Do you think this series is ready to be merged? I have some code to run hpet on a dedicated thread, and in theory it will rely on this. Yes, it is ready

Re: [Qemu-devel] [PATCH v3 0/4] timers thread-safe stuff

2013-09-22 Thread liu ping fan
On Wed, Sep 18, 2013 at 9:54 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Tue, Aug 27, 2013 at 11:20:59AM +0800, Liu Ping Fan wrote: Saw the Alex's patches has been merged, rebase mine onto his. v3: 1. rename seqlock_read_check as seqlock_read_retry 2. Document timerlist were

[Qemu-devel] [PATCH v4 0/4] timers thread-safe stuff

2013-09-22 Thread Liu Ping Fan
race issue for qemu_clock_enable(foo,disable) Liu Ping Fan (2): timer: protect timers_state's clock with seqlock timer: make qemu_clock_enable sync between disable and timer's cb Paolo Bonzini (2): seqlock: introduce read-write seqlock qemu-thread: add QemuEvent cpus.c

[Qemu-devel] [PATCH v4 1/4] seqlock: introduce read-write seqlock

2013-09-22 Thread Liu Ping Fan
This lets the read-side access run outside the BQL. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- include/qemu/seqlock.h | 72 ++ 1 file changed, 72 insertions(+) create mode 100644 include/qemu/seqlock.h diff --git

[Qemu-devel] [PATCH v4 2/4] timer: protect timers_state's clock with seqlock

2013-09-22 Thread Liu Ping Fan
Lock rule: private lock innermost, ie BQL-this lock Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- cpus.c | 36 ++-- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/cpus.c b/cpus.c index e566297..870a832 100644 --- a/cpus.c +++ b/cpus.c

[Qemu-devel] [PATCH v4 1/4] seqlock: introduce read-write seqlock

2013-09-22 Thread Liu Ping Fan
This lets the read-side access run outside the BQL. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- include/qemu/seqlock.h | 72 ++ 1 file changed, 72 insertions(+) create mode 100644 include/qemu/seqlock.h diff --git

[Qemu-devel] [PATCH v4 4/4] timer: make qemu_clock_enable sync between disable and timer's cb

2013-09-22 Thread Liu Ping Fan
. And the callers of qemu_clock_enable() should be sync by themselves, not protected by this patch. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- include/qemu/timer.h | 4 qemu-timer.c | 20 +++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH v4 3/4] qemu-thread: add QemuEvent

2013-09-22 Thread Liu Ping Fan
This emulates Win32 manual-reset events using futexes or conditional variables. Typical ways to use them are with multi-producer, single-consumer data structures, to test for a complex condition whose elements come from different threads: for (;;) { qemu_event_reset(ev); ...

[Qemu-devel] [PATCH] sPAPR: implement route_intx_to_irq to get gsi of pci device.

2013-09-22 Thread Liu Ping Fan
This is useful when pci assignment happens on sPAPR. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- This patch will apply on patches which enable xics in kernel. --- hw/intc/xics.c| 5 + hw/ppc/spapr_pci.c| 14 ++ include/hw/ppc/xics.h | 1 + 3 files

Re: [Qemu-devel] [PATCH] sPAPR: implement route_intx_to_irq to get gsi of pci device.

2013-09-22 Thread liu ping fan
On Mon, Sep 23, 2013 at 4:02 AM, Alexander Graf ag...@suse.de wrote: Am 22.09.2013 um 13:47 schrieb Liu Ping Fan qemul...@gmail.com: This is useful when pci assignment happens on sPAPR. This patch doesn't sound useful on its own to me, thus probably belongs in a greater patch set. Yes, I

Re: [Qemu-devel] [PATCH] sPAPR: implement route_intx_to_irq to get gsi of pci device.

2013-09-22 Thread liu ping fan
On Mon, Sep 23, 2013 at 9:59 AM, Alexey Kardashevskiy a...@ozlabs.ru wrote: On 09/22/2013 09:47 PM, Liu Ping Fan wrote: This is useful when pci assignment happens on sPAPR. I have almost the same patch in my queue already, it will enable irqfd for both INTX and MSI, I am just waiting till

Re: [Qemu-devel] [PATCH v4 1/4] seqlock: introduce read-write seqlock

2013-09-23 Thread liu ping fan
On Mon, Sep 23, 2013 at 2:21 PM, Jan Kiszka jan.kis...@siemens.com wrote: On 2013-09-22 10:11, Liu Ping Fan wrote: This lets the read-side access run outside the BQL. In fact, not only BQL. Didn't the original commit provide a changlog about the content of this patch? Otherwise, briefly

Re: [Qemu-devel] [PATCH v4 4/4] timer: make qemu_clock_enable sync between disable and timer's cb

2013-09-23 Thread liu ping fan
On Mon, Sep 23, 2013 at 2:26 PM, Jan Kiszka jan.kis...@siemens.com wrote: On 2013-09-22 10:11, Liu Ping Fan wrote: After disabling the QemuClock, we should make sure that no QemuTimers are still in flight. To implement that with light overhead, we resort to QemuEvent. The caller of disabling

Re: [Qemu-devel] [PATCH v4 2/4] timer: protect timers_state's clock with seqlock

2013-09-24 Thread liu ping fan
On Mon, Sep 23, 2013 at 2:21 PM, Jan Kiszka jan.kis...@siemens.com wrote: On 2013-09-22 10:11, Liu Ping Fan wrote: QEMU_CLOCK_VIRTUAL may be read outside BQL. This will make its foundation, i.e. timers_state exposed to race condition. Using private lock to protect it. After this patch

[Qemu-devel] [PATCH v5 0/4] timers thread-safe stuff

2013-09-25 Thread Liu Ping Fan
qemu_event_wait(tl-ev). v2: 1. fix comment in commit and code 2. fix race issue for qemu_clock_enable(foo,disable) Liu Ping Fan (2): timer: protect timers_state's clock with seqlock timer: make qemu_clock_enable sync between disable and timer's cb Paolo Bonzini (2): seqlock

[Qemu-devel] [PATCH v5 4/4] timer: make qemu_clock_enable sync between disable and timer's cb

2013-09-25 Thread Liu Ping Fan
. And the callers of qemu_clock_enable() should be sync by themselves, not protected by this patch. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- include/qemu/timer.h | 6 ++ qemu-timer.c | 21 - 2 files changed, 26 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH v5 1/4] seqlock: introduce read-write seqlock

2013-09-25 Thread Liu Ping Fan
From: Paolo Bonzini pbonz...@redhat.com Seqlock implementation for QEMU. Usage idiom reader: do{ start = seqlock_read_begin() }while(seqlock_read_try(start)) writer: seqlock_write_lock() ... seqlock_write_unlock() initialization: seqlock_init(QemuSeqLock *sl, QemuMutex *mutex)

[Qemu-devel] [PATCH v5 3/4] qemu-thread: add QemuEvent

2013-09-25 Thread Liu Ping Fan
From: Paolo Bonzini pbonz...@redhat.com This emulates Win32 manual-reset events using futexes or conditional variables. Typical ways to use them are with multi-producer, single-consumer data structures, to test for a complex condition whose elements come from different threads: for (;;) {

Re: [Qemu-devel] [PATCH v5 0/5] bugs fix for hpet

2013-09-25 Thread liu ping fan
Hi, is hpet orphan? Or who can help me to merge this patch-set if my patch is fine. Thanks. On Thu, Sep 12, 2013 at 11:25 AM, Liu Ping Fan qemul...@gmail.com wrote: v5: use stand compat property to fix hpet intcap on pc-q35, while on pc-piix, hard code intcap as IRQ2 v4: use stand

[Qemu-devel] [PATCH v5 2/4] timer: protect timers_state's clock with seqlock

2013-09-25 Thread Liu Ping Fan
on the BQL Lock rule: private lock innermost, ie BQL-this lock Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- cpus.c | 41 + include/qemu/timer.h | 2 ++ 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/cpus.c b/cpus.c

Re: [Qemu-devel] [PATCH v5 1/4] seqlock: introduce read-write seqlock

2013-09-25 Thread liu ping fan
On Wed, Sep 25, 2013 at 2:20 PM, Liu Ping Fan qemul...@gmail.com wrote: From: Paolo Bonzini pbonz...@redhat.com Seqlock implementation for QEMU. Usage idiom reader: do{ start = seqlock_read_begin() }while(seqlock_read_try(start)) writer: seqlock_write_lock

Re: [Qemu-devel] [PATCH v5 3/4] qemu-thread: add QemuEvent

2013-09-25 Thread liu ping fan
On Wed, Sep 25, 2013 at 2:20 PM, Liu Ping Fan qemul...@gmail.com wrote: From: Paolo Bonzini pbonz...@redhat.com This emulates Win32 manual-reset events using futexes or conditional variables. Typical ways to use them are with multi-producer, single-consumer data structures, to test

Re: [Qemu-devel] [PATCH v5 1/5] hpet: inverse polarity when pin above ISA_NUM_IRQS

2013-09-28 Thread liu ping fan
On Sun, Sep 29, 2013 at 3:52 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Sep 12, 2013 at 11:25:14AM +0800, Liu Ping Fan wrote: According to hpet spec, hpet irq is high active. But according to ICH spec, there is inversion before the input of ioapic. So the OS will expect low active

Re: [Qemu-devel] [PATCH v5 2/5] hpet: entitle more irq pins for hpet

2013-09-28 Thread liu ping fan
On Sun, Sep 29, 2013 at 3:56 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Sep 12, 2013 at 11:25:15AM +0800, Liu Ping Fan wrote: On PC, IRQ2/8 can be reserved for hpet timer 0/1. And pin 16~23 of ioapic can be dynamically assigned to hpet as guest chooses. (Will enable them after

Re: [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff

2013-07-22 Thread liu ping fan
On Mon, Jul 22, 2013 at 2:28 PM, Jan Kiszka jan.kis...@siemens.com wrote: On 2013-07-22 06:38, liu ping fan wrote: On Sun, Jul 21, 2013 at 5:53 PM, Alex Bligh a...@alex.org.uk wrote: Liu, --On 21 July 2013 16:42:57 +0800 Liu Ping Fan qemul...@gmail.com wrote: Currently, the timers run

Re: [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff

2013-07-22 Thread liu ping fan
On Mon, Jul 22, 2013 at 6:18 PM, liu ping fan qemul...@gmail.com wrote: On Mon, Jul 22, 2013 at 5:40 PM, Alex Bligh a...@alex.org.uk wrote: Liu, --On 22 July 2013 12:38:02 +0800 liu ping fan qemul...@gmail.com wrote: I read your second series, and try to summary the main different between

Re: [Qemu-devel] [RFC 6/8] timer: run timers on aio_poll

2013-07-22 Thread liu ping fan
On Sun, Jul 21, 2013 at 5:55 PM, Alex Bligh a...@alex.org.uk wrote: --On 21 July 2013 16:43:03 +0800 Liu Ping Fan qemul...@gmail.com wrote: diff --git a/aio-posix.c b/aio-posix.c index b68eccd..29c2769 100644 --- a/aio-posix.c +++ b/aio-posix.c @@ -191,6 +191,8 @@ bool aio_poll(AioContext

Re: [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff

2013-07-23 Thread liu ping fan
On Tue, Jul 23, 2013 at 6:30 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 23/07/2013 04:53, liu ping fan ha scritto: The scenior I can figure out is if adopting timeout of poll, then when changing the deadline, we need to invoke poll, and set the new timeout, right? Yes, you need to call

Re: [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff

2013-07-24 Thread liu ping fan
On Wed, Jul 24, 2013 at 2:42 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 24/07/2013 03:28, liu ping fan ha scritto: On Tue, Jul 23, 2013 at 6:30 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 23/07/2013 04:53, liu ping fan ha scritto: The scenior I can figure out is if adopting timeout

Re: [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff

2013-07-24 Thread liu ping fan
[...] http://social.msdn.microsoft.com/Forums/vstudio/en-US/e8a7cb1e-9edd-4ee3-982e-f66b7bf6ae44/improve-accuracy-waitforsingleobject suggest that WaitFor{Single,Multiple}Objects can have pretty appalling latency anyway (100ms!), and there's no evidence that's limited by making one of the FDs

[Qemu-devel] [RFC v2 0/5] arm AioContext with its own timer stuff

2013-07-28 Thread Liu Ping Fan
problem (Thanks for Jan and Stefan) fix process=true when aio_poll run timers (Thanks for Alex) Liu Ping Fan (5): timer: protect timers_state with lock timer: pick out timer list info from QemuClock timer: make qemu_clock_enable sync between disable and timer's cb timer: associate three

[Qemu-devel] [RFC v2 3/5] timer: make qemu_clock_enable sync between disable and timer's cb

2013-07-28 Thread Liu Ping Fan
After disabling the QemuClock, we should make sure that no QemuTimers are still in flight. To implement that, the caller of disabling will wait until the last user's exit. Note, the callers of qemu_clock_enable() should be sync by themselves, not protected by this patch. Signed-off-by: Liu Ping

[Qemu-devel] [RFC v2 1/5] timer: protect timers_state with lock

2013-07-28 Thread Liu Ping Fan
lock innermost, ie BQL-this lock Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- cpus.c | 26 +- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/cpus.c b/cpus.c index 61e86a8..4af81e9 100644 --- a/cpus.c +++ b/cpus.c @@ -112,7 +112,9 @@ typedef

[Qemu-devel] [RFC v2 2/5] timer: pick out timer list info from QemuClock

2013-07-28 Thread Liu Ping Fan
-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- qemu-timer.c | 106 ++- 1 file changed, 68 insertions(+), 38 deletions(-) diff --git a/qemu-timer.c b/qemu-timer.c index 9500d12..5a42035 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -30,6

[Qemu-devel] [RFC v2 4/5] timer: associate three timerlists with AioContext

2013-07-28 Thread Liu Ping Fan
later, we will run timers in aio_poll. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com -- issue to fix --- Note: before this patch, there should be another one to fix the race issue by qemu_mod_timer() and _run_timers(). --- async.c | 9 include/block/aio.h | 13

[Qemu-devel] [RFC v2 5/5] timer: run timers on aio_poll

2013-07-28 Thread Liu Ping Fan
Stop call timers in main loop and let each mini event-loop run its own timers. Signed-off-by: Liu Ping Fan pingf...@linux.vnet.ibm.com --- aio-posix.c | 2 ++ include/qemu/timer.h | 4 ++-- main-loop.c | 2 -- qemu-timer.c | 15 ++- 4 files changed, 14

Re: [Qemu-devel] [RFC v2 1/5] timer: protect timers_state with lock

2013-07-29 Thread liu ping fan
On Mon, Jul 29, 2013 at 2:26 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/07/2013 05:16, Liu Ping Fan ha scritto: In kvm mode, vm_clock may be read on AioContexts outside BQL(next patch). This will make timers_state --the foundation of vm_clock exposed to race condition. Using private

Re: [Qemu-devel] [RFC v2 3/5] timer: make qemu_clock_enable sync between disable and timer's cb

2013-07-29 Thread liu ping fan
On Mon, Jul 29, 2013 at 2:30 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/07/2013 05:16, Liu Ping Fan ha scritto: After disabling the QemuClock, we should make sure that no QemuTimers are still in flight. To implement that, the caller of disabling will wait until the last user's exit

Re: [Qemu-devel] [RFC v2 4/5] timer: associate three timerlists with AioContext

2013-07-29 Thread liu ping fan
On Mon, Jul 29, 2013 at 2:32 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/07/2013 05:16, Liu Ping Fan ha scritto: Currently, timers run on iothread inside QBL, this limits the usage of timers in some case, e.g. virtio-blk-dataplane. In order to run timers on private thread based

Re: [Qemu-devel] [RFC v2 4/5] timer: associate three timerlists with AioContext

2013-07-29 Thread liu ping fan
On Mon, Jul 29, 2013 at 9:11 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/07/2013 10:20, liu ping fan ha scritto: Another issue is that deadline computation is not using the AioContext's timer lists. Sorry, can not catch the meaning. When AioContext has its own timer lists

Re: [Qemu-devel] [RFC v2 3/5] timer: make qemu_clock_enable sync between disable and timer's cb

2013-07-29 Thread liu ping fan
On Mon, Jul 29, 2013 at 7:21 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/07/2013 10:10, liu ping fan ha scritto: On Mon, Jul 29, 2013 at 2:30 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/07/2013 05:16, Liu Ping Fan ha scritto: After disabling the QemuClock, we should make sure

Re: [Qemu-devel] [RFC v2 0/5] arm AioContext with its own timer stuff

2013-07-29 Thread liu ping fan
On Mon, Jul 29, 2013 at 5:22 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Mon, Jul 29, 2013 at 11:16:03AM +0800, Liu Ping Fan wrote: summary of the model: Three qemu-wide clock source allowed in system. And each AioContext has three corresponding timer list to run timer against

Re: [Qemu-devel] [RFC v2 3/5] timer: make qemu_clock_enable sync between disable and timer's cb

2013-07-31 Thread liu ping fan
On Tue, Jul 30, 2013 at 5:17 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 30/07/2013 04:42, liu ping fan ha scritto: On Mon, Jul 29, 2013 at 7:21 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/07/2013 10:10, liu ping fan ha scritto: On Mon, Jul 29, 2013 at 2:30 PM, Paolo Bonzini pbonz

  1   2   3   4   5   6   7   8   >