Re: [Qemu-devel] [PATCH v3 1/2] COW: Speed up writes

2013-11-15 Thread Charlie Shepherd
On 13/11/2013 12:59, Kevin Wolf wrote: Am 06.11.2013 um 16:59 hat Charlie Shepherd geschrieben: Process a whole sector's worth of COW bits by reading a sector, setting the bits after skipping any already set bits, then writing it out again. Make sure we only flush once before writing metadata

[Qemu-devel] [PATCH 0/2] COW: Speed up writes

2013-11-15 Thread Charlie Shepherd
necessary check in cow_set_bits Following on from Paolo's commits 26ae980 and 276cbc7, this patchset implements some changes he recommended earlier which I didn't previously have time to do while on GSoC. Charlie Shepherd (2): COW: Speed up writes COW: Extend checking allocated bits to beyond one

[Qemu-devel] [PATCH 2/2] COW: Extend checking allocated bits to beyond one sector

2013-11-15 Thread Charlie Shepherd
cow_co_is_allocated() only checks one sector's worth of allocated bits before returning. This is allowed but (slightly) inefficient, so extend it to check all of the file's metadata sectors. Signed-off-by: Charlie Shepherd char...@ctshepherd.com Reviewed-by: Paolo Bonzini pbonz...@redhat.com

[Qemu-devel] [PATCH 1/2] COW: Speed up writes

2013-11-15 Thread Charlie Shepherd
Process a whole sector's worth of COW bits by reading a sector, setting the bits after skipping any already set bits, then writing it out again. Make sure we only flush once before writing metadata, and only if we need to write metadata. Signed-off-by: Charlie Shepherd char...@ctshepherd.com

[Qemu-devel] [PATCH 00/80] COW: Speed up writes

2013-11-06 Thread Charlie Shepherd
Charlie Shepherd (3): COW: Speed up writes COW: Extend checking allocated bits to beyond one sector COW: Skip setting already set bits Gerd Hoffmann (3): pc: add etc/e820 fw_cfg file pc: register e820 entries for ram qxl: replace pipe signaling with bottom half Igor Mammedov (1

[Qemu-devel] [PATCH 01/80] pc: add etc/e820 fw_cfg file

2013-11-06 Thread Charlie Shepherd
though as the number of entries can be figured from the file size. Cc: Andrea Arcangeli aarca...@redhat.com Signed-off-by: Gerd Hoffmann kra...@redhat.com Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- hw/i386/pc.c | 39 --- 1 file changed, 28 insertions

[Qemu-devel] [PATCH 02/80] pc: register e820 entries for ram

2013-11-06 Thread Charlie Shepherd
From: Gerd Hoffmann kra...@redhat.com So RAM shows up in the new etc/e820 fw_cfg file. Cc: Andrea Arcangeli aarca...@redhat.com Signed-off-by: Gerd Hoffmann kra...@redhat.com Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- hw/i386/pc.c | 8 +--- 1 file changed, 1 insertion(+), 7

Re: [Qemu-devel] [PATCH 01/80] pc: add etc/e820 fw_cfg file

2013-11-06 Thread Charlie Shepherd
Sorry all, some confusion using git-publish, apologies for the spam. Charlie

[Qemu-devel] [PATCH 2/3] COW: Extend checking allocated bits to beyond one sector

2013-11-06 Thread Charlie Shepherd
cow_co_is_allocated() only checks one sector's worth of allocated bits before returning. This is allowed but (slightly) inefficient, so extend it to check all of the file's metadata sectors. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block/cow.c | 36

[Qemu-devel] [PATCH 1/3] COW: Speed up writes

2013-11-06 Thread Charlie Shepherd
Process a whole sector's worth of COW bits by reading a sector, setting the bits, then writing it out again. Make sure we only flush once, before writing metadata. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block/cow.c | 79

[Qemu-devel] [PATCH 0/3] COW: Speed up writes

2013-11-06 Thread Charlie Shepherd
but in the end cow_find_streak was sufficient, so it may not strictly be necessary. Charlie Shepherd (3): COW: Speed up writes COW: Extend checking allocated bits to beyond one sector COW: Skip setting already set bits block/cow.c | 122

[Qemu-devel] [PATCH 3/3] COW: Skip setting already set bits

2013-11-06 Thread Charlie Shepherd
Rather than unnecessarily setting bits that are already set, re-use cow_find_streak to find how many bits are already set for this sector, and only set unset bits. Do this before the flush to avoid it if no bits need to be set at all. Signed-off-by: Charlie Shepherd char...@ctshepherd.com

Re: [Qemu-devel] [PATCH 3/3] COW: Skip setting already set bits

2013-11-06 Thread Charlie Shepherd
On 06/11/2013 12:29, Paolo Bonzini wrote: Il 06/11/2013 13:23, Charlie Shepherd ha scritto: +set = cow_find_streak(bitmap, 1, bitnum, sector_bits); +if (set == sector_bits) { +continue; I think this shouldn't be a continue; these lines should be executed

[Qemu-devel] [PATCH v2 2/3] COW: Extend checking allocated bits to beyond one sector

2013-11-06 Thread Charlie Shepherd
cow_co_is_allocated() only checks one sector's worth of allocated bits before returning. This is allowed but (slightly) inefficient, so extend it to check all of the file's metadata sectors. Signed-off-by: Charlie Shepherd char...@ctshepherd.com Reviewed-by: Paolo Bonzini pbonz...@redhat.com

[Qemu-devel] [PATCH v2 3/3] COW: Skip setting already set bits

2013-11-06 Thread Charlie Shepherd
Rather than unnecessarily setting bits that are already set, re-use cow_find_streak to find how many bits are already set for this sector, and only set unset bits. Do this before the flush to avoid it if no bits need to be set at all. Signed-off-by: Charlie Shepherd char...@ctshepherd.com

[Qemu-devel] [PATCH v2 1/3] COW: Speed up writes

2013-11-06 Thread Charlie Shepherd
Process a whole sector's worth of COW bits by reading a sector, setting the bits, then writing it out again. Make sure we only flush once, before writing metadata. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block/cow.c | 79

[Qemu-devel] [PATCH v2 0/3] COW: Speed up writes

2013-11-06 Thread Charlie Shepherd
v2: - Fix bit position calculations in cow_update_bitmap - Add necessary check in cow_set_bits Following on from Paolo's commits 26ae980 and 276cbc7, this patchset implements some changes he recommended earlier which I didn't previously have time to do while on GSoC. Charlie Shepherd (3

Re: [Qemu-devel] [PATCH v2 3/3] COW: Skip setting already set bits

2013-11-06 Thread Charlie Shepherd
On 06/11/2013 13:03, Paolo Bonzini wrote: Il 06/11/2013 13:56, Charlie Shepherd ha scritto: Rather than unnecessarily setting bits that are already set, re-use cow_find_streak to find how many bits are already set for this sector, and only set unset bits. Do this before the flush to avoid

[Qemu-devel] [PATCH v3 2/2] COW: Extend checking allocated bits to beyond one sector

2013-11-06 Thread Charlie Shepherd
cow_co_is_allocated() only checks one sector's worth of allocated bits before returning. This is allowed but (slightly) inefficient, so extend it to check all of the file's metadata sectors. Signed-off-by: Charlie Shepherd char...@ctshepherd.com Reviewed-by: Paolo Bonzini pbonz...@redhat.com

[Qemu-devel] [PATCH v3 1/2] COW: Speed up writes

2013-11-06 Thread Charlie Shepherd
Process a whole sector's worth of COW bits by reading a sector, setting the bits after skipping any already set bits, then writing it out again. Make sure we only flush once before writing metadata, and only if we need to write metadata. Signed-off-by: Charlie Shepherd char...@ctshepherd.com

[Qemu-devel] [PATCH v3 0/2] COW: Speed up writes

2013-11-06 Thread Charlie Shepherd
Paolo's commits 26ae980 and 276cbc7, this patchset implements some changes he recommended earlier which I didn't previously have time to do while on GSoC. Charlie Shepherd (2): COW: Speed up writes COW: Extend checking allocated bits to beyond one sector block/cow.c | 123

Re: [Qemu-devel] [PATCH v3 1/2] COW: Speed up writes

2013-11-06 Thread Charlie Shepherd
On 06/11/2013 16:17, Paolo Bonzini wrote: Reviewed-by: Paolo Bonzini pbonz...@redhat.com Thanks for your help with this series! Charlie

[Qemu-devel] [PATCH v3 0/2] Documentation for coroutine annotations

2013-10-27 Thread Charlie Shepherd
then I will redo the later parts in several smaller and more manageable patchsets. Charlie Shepherd (2): Add an explanation of when a function should be marked coroutine_fn Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper coroutine-gthread.c | 2

[Qemu-devel] [PATCH v3 1/2] Add an explanation of when a function should be marked coroutine_fn

2013-10-27 Thread Charlie Shepherd
Coroutine functions that can yield directly or indirectly should be annotated with a coroutine_fn annotation. Add an explanation to that effect in include/block/coroutine.h. --- include/block/coroutine.h | 8 1 file changed, 8 insertions(+) diff --git a/include/block/coroutine.h

[Qemu-devel] [PATCH v3 2/2] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper

2013-10-27 Thread Charlie Shepherd
While it only really makes sense to call qemu_coroutine_self() in a coroutine context, some coroutine internals need to call it from functions not annotated as coroutine_fn, so add an annotated wrapper and rename the implementation versions to qemu_coroutine_self_int. --- coroutine-gthread.c

Re: [Qemu-devel] [PATCH v3 0/2] Documentation for coroutine annotations

2013-10-27 Thread Charlie Shepherd
On 27/10/2013 20:37, Gabriel Kerneis wrote: On Sun, Oct 27, 2013 at 04:23:54PM +0100, Charlie Shepherd wrote: These patches were the first two from my GSoC series and were reasonably straight-forward and well accepted. Gabriel and I are hoping the patches from GSoC can be merged before I start

[Qemu-devel] [PATCH v4 1/4] Add an explanation of when a function should be marked coroutine_fn

2013-10-27 Thread Charlie Shepherd
Coroutine functions that can yield directly or indirectly should be annotated with a coroutine_fn annotation. Add an explanation to that effect in include/block/coroutine.h. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- include/block/coroutine.h | 8 1 file changed, 8

[Qemu-devel] [PATCH v4 2/4] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper

2013-10-27 Thread Charlie Shepherd
While it only really makes sense to call qemu_coroutine_self() in a coroutine context, some coroutine internals need to call it from functions not annotated as coroutine_fn, so add an annotated wrapper and rename the implementation versions to qemu_coroutine_self_int. Signed-off-by: Charlie

[Qemu-devel] [PATCH v4 3/4] Introduce blocking_fn annotation

2013-10-27 Thread Charlie Shepherd
From: Gabriel Kerneis gabr...@kerneis.info A blocking function is a function that must not be called in coroutine context, for example because it might block for a long amount of time. This annotation should be used to mark normal functions that have a coroutine_fn counterpart, to make sure that

[Qemu-devel] [PATCH v4 0/4] Documentation for coroutine annotations

2013-10-27 Thread Charlie Shepherd
then I will redo the later parts in several smaller and more manageable patchsets. --- Changes since v3: - Added missing sign-off. - Added patches by Gabriel Kerneis to add blocking_fn annotation and to protect coroutine_fn and blocking_fn with #ifndef. Charlie Shepherd (2): Add an explanation

[Qemu-devel] [PATCH v4 4/4] Protect coroutine_fn and blocking_fn with #ifndef

2013-10-27 Thread Charlie Shepherd
From: Gabriel Kerneis gabr...@kerneis.info This patch allows defining coroutine and blocking annotations with ./configure --extra-cflags instead of modifying coroutine.h. Signed-off-by: Gabriel Kerneis gabr...@kerneis.info --- include/block/coroutine.h | 4 1 file changed, 4 insertions(+)

Re: [Qemu-devel] [RFC] Introducing CoroCheck and proposal for a blocking_fn annotation

2013-09-06 Thread Charlie Shepherd
On 06/09/2013 15:30, Gabriel Kerneis wrote: Note that CoroCheck has been written as a plugin to CIL [5]. Contrary to CPC, which is still somewhat of a prototype (although a pretty good one!), CIL is a solid piece of software, packaged in both Fedora and (very soon) Debian. CoroCheck makes use of

[Qemu-devel] Buildbot Failures

2013-08-29 Thread Charlie Shepherd
Hi all, This is an attempt to do some triaging of the 18 current buildbot failures[1]. default_ppc: http://buildbot.b1-systems.de/qemu/builders/default_ppc/builds/729/steps/compile/logs/stdio LINK ppc-linux-user/qemu-ppc target-ppc/translate.o:(.text+0x53518): undefined reference to

[Qemu-devel] [PATCH] Remove Python 2.5 syntax from scripts/qapi-visit.py

2013-08-29 Thread Charlie Shepherd
On 29/08/2013 10:57, Charlie Shepherd wrote: default_x86_64_rhel5: http://buildbot.b1-systems.de/qemu/builders/default_x86_64_rhel5/builds/684/steps/compile/logs/stdio File /home/buildbot/slave-public/default_x86_64_rhel5/build/scripts/qapi-visit.py, line 23 full_name = name

Re: [Qemu-devel] [PATCH] Remove Python 2.5 syntax from scripts/qapi-visit.py

2013-08-29 Thread Charlie Shepherd
On 29/08/2013 11:14, Stefan Hajnoczi wrote: On Thu, Aug 29, 2013 at 12:02 PM, Charlie Shepherd char...@ctshepherd.com wrote: On 29/08/2013 10:57, Charlie Shepherd wrote: default_x86_64_rhel5: http://buildbot.b1-systems.de/qemu/builders/default_x86_64_rhel5/builds/684/steps/compile/logs/stdio

[Qemu-devel] [PATCH v2] Remove Python 2.5 syntax from scripts/qapi-visit.py

2013-08-29 Thread Charlie Shepherd
The syntax `var = a if b else c` was added in Python 2.5, but QEMU has a minimum Python version of 2.4, which chokes on this syntax. This patch converts the new syntax to Python 2.4 compatible syntax. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- scripts/qapi-visit.py | 12

Re: [Qemu-devel] Buildbot Failures

2013-08-29 Thread Charlie Shepherd
On 29/08/2013 11:23, Stefan Hajnoczi wrote: On Thu, Aug 29, 2013 at 12:19 PM, Anthony PERARD anthony.per...@citrix.com wrote: On 29/08/13 10:57, Charlie Shepherd wrote: xen40: xen41: xen42: xen_unstable: arm-softmmu/qemu-system-arm: error while loading shared libraries: libxenstore.so.3.0

Re: [Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to coroutine_fn

2013-08-29 Thread Charlie Shepherd
On 29/08/2013 13:11, Stefan Hajnoczi wrote: On Fri, Aug 09, 2013 at 07:43:54PM +0200, Charlie Shepherd wrote: Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block.c | 8 block/blkdebug.c | 4 ++-- block/blkverify.c | 4 ++-- block

Re: [Qemu-devel] [RFC v2 05/15] Make qcow2_open synchronous

2013-08-29 Thread Charlie Shepherd
On 29/08/2013 13:33, Stefan Hajnoczi wrote: On Fri, Aug 09, 2013 at 07:43:55PM +0200, Charlie Shepherd wrote: The previous patch convert all .bdrv_open functions to run from a coroutine context. However qcow2's open method is also called from qcow2_invalidate_cache. bdrv_invalidate_cache

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-21 Thread Charlie Shepherd
On 21/08/2013 09:14, Paolo Bonzini wrote: Il 21/08/2013 00:53, Charlie Shepherd ha scritto: What if nb_sectors 512 * 8? For cow_co_is_allocated, you have the luxury of returning information only for the fewer than nb_sectors. That is, you can set *num_same to a smaller value than nb_sectors

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-21 Thread Charlie Shepherd
On 21/08/2013 10:19, Paolo Bonzini wrote: Il 21/08/2013 11:11, Charlie Shepherd ha scritto: It still seems worthwhile to me to be as efficient as possible, I guess that means processing a sector's worth of metadata at a time? Yes, that's what my patches do. My is_allocated and flushing

[Qemu-devel] [PATCH] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-20 Thread Charlie Shepherd
they need in one go, update it and then write it out, which should be much more more efficient. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block/cow.c | 116 1 file changed, 62 insertions(+), 54 deletions(-) diff --git

Re: [Qemu-devel] [PATCH] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-20 Thread Charlie Shepherd
On 20/08/2013 14:45, Paolo Bonzini wrote: I had very similar patches in my series to add get_block_status... Ah, sorry if I've duplicated something you've already done. Stefan encouraged me to contribute to an area of QEMU I found interesting and seeing the XXX I thought I'd take a shot at

[Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-20 Thread Charlie Shepherd
$ qemu-io -c 'read 0 100M' test.cow Average over 3 runs: 426 Mb/s Which is a ~300x increase in write speed and a ~10x increase in read speed. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block/cow.c | 119 ++-- 1 file changed

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-20 Thread Charlie Shepherd
Sorry, this is not only NOT 1/2, but it should say v2, as this is also based on merging in Paolo's similar patch in his get_block_status series. On 20/08/2013 19:34, Charlie Shepherd wrote: cow_co_is_allocated and cow_update_bitmap set bits by reading the relevant word, setting the specific

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-20 Thread Charlie Shepherd
On 20/08/2013 21:48, Paolo Bonzini wrote: Il 20/08/2013 20:34, Charlie Shepherd ha scritto: /* Return true if first block has been changed (ie. current version is @@ -146,40 +114,82 @@ static inline int is_bit_set(BlockDriverState *bs, int64_t bitnum) static int coroutine_fn

[Qemu-devel] [RFC v2 01/15] Add an explanation of when a function should be marked coroutine_fn

2013-08-09 Thread Charlie Shepherd
Coroutine functions that can yield directly or indirectly should be annotated with a coroutine_fn annotation. Add an explanation to that effect in include/block/coroutine.h. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- include/block/coroutine.h | 8 1 file changed, 8

[Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper

2013-08-09 Thread Charlie Shepherd
While it only really makes sense to call qemu_coroutine_self() in a coroutine context, some coroutine internals need to call it from functions not annotated as coroutine_fn, so add an annotated wrapper and rename the implementation versions to qemu_coroutine_self_int. Signed-off-by: Charlie

[Qemu-devel] [RFC v2 15/15] Add coroutine_fn annotations to nbd_co_* functions.

2013-08-09 Thread Charlie Shepherd
nbd_co_* are all meant to be only be run in a coroutine context, annotate them accordingly. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block/nbd.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index a0e3562

[Qemu-devel] [RFC v2 10/15] Convert bdrv_read, bdrv_write and associated functions to coroutine functions

2013-08-09 Thread Charlie Shepherd
Now that .bdrv_co_read and .bdrv_co_write are only called in a coroutine context, convert their callers in block.c to be coroutine only, and add bdrv_sync_* versions for synchronous callers. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block.c | 106

[Qemu-devel] [RFC v2 07/15] Call bdrv-open via a synchronous wrapper in block/snapshot.c

2013-08-09 Thread Charlie Shepherd
block/snapshot.c calls bdrv-open directly from a non-coroutine context. Provide a synchronous wrapper to ensure correctness. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block/snapshot.c | 32 +++- 1 file changed, 31 insertions(+), 1 deletion(-) diff

[Qemu-devel] [RFC v2 13/15] Introduce a run_handler function in qemu-img.c

2013-08-09 Thread Charlie Shepherd
qemu-img doesn't run in a coroutine context, but uses block layer functions which do need to run in a coroutine context. This patch converts qemu-img to run the various qemu-img functions in a coroutine context correctly. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- qemu-img.c | 54

[Qemu-devel] [RFC v2 14/15] Add coroutine annotations for qemu_co_rwlock_rdlock and qemu_co_rwlock_wrlock

2013-08-09 Thread Charlie Shepherd
qemu_co_rwlock_rdlock and qemu_co_rwlock_wrlock can only run in a coroutine context, so annotate them with coroutine_fn. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- include/block/coroutine.h | 4 ++-- qemu-coroutine-lock.c | 4 ++-- 2 files changed, 4 insertions(+), 4

[Qemu-devel] [RFC v2 06/15] Explicitly mark BlockDriver functions .bdrv_write and .bdrv_read as coroutine functions

2013-08-09 Thread Charlie Shepherd
Convert .bdrv_write and .bdrv_read to coroutine functions and rename them to .bdrv_co_write and .bdrv_co_read. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block.c | 4 ++-- block/bochs.c | 2 +- block/cloop.c | 2 +- block/cow.c

[Qemu-devel] [RFC v2 09/15] Add a synchronous wrapper bdrv_sync_rwco

2013-08-09 Thread Charlie Shepherd
A number of functions in block.c pass an RwCo struct to a coroutine entry point in order to synchronise an asynchronous function. This patch factors this pattern out into a function. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block.c | 37

[Qemu-devel] [RFC v2 12/15] Make bdrv_flush coroutine only and add bdrv_sync_flush

2013-08-09 Thread Charlie Shepherd
This patch renames the coroutine only bdrv_co_flush to bdrv_flush and the original bdrv_flush to bdrv_sync_flush. bdrv_sync_flush is synchronous only. This patch also converts a caller in block/mirror.c to coroutine_fn. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block.c

[Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to coroutine_fn

2013-08-09 Thread Charlie Shepherd
Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block.c | 8 block/blkdebug.c | 4 ++-- block/blkverify.c | 4 ++-- block/bochs.c | 4 ++-- block/cloop.c | 4 ++-- block/cow.c | 4 ++-- block/curl.c

[Qemu-devel] [RFC v2 05/15] Make qcow2_open synchronous

2013-08-09 Thread Charlie Shepherd
annotations up the call chain, turn qcow2_open into a synchronous wrapper. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block/qcow2.c | 38 +- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/block/qcow2.c b/block/qcow2.c index c6dc209

[Qemu-devel] [RFC v2 08/15] Convert bdrv_create and associated functions to be coroutine_fn

2013-08-09 Thread Charlie Shepherd
This patch converts bdrv_create, bdrv_create_file and bdrv_img_create to be coroutine only functions. It adds a synchronous wrapper, bdrv_sync_create, for any synchronous callers. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block.c | 56

[Qemu-devel] [RFC v2 11/15] Make bdrv_discard coroutine only and add bdrv_sync_discard

2013-08-09 Thread Charlie Shepherd
This patch renames the coroutine only bdrv_co_discard to bdrv_discard and the original bdrv_discard to bdrv_sync_discard. bdrv_sync_discard is synchronous only. Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block.c | 12 +++- include/block/block.h | 3 ++- 2

[Qemu-devel] [RFC v2 03/15] Explicitly mark BlockDriver function .bdrv_create as coroutine and rename it bdrv_co_create.

2013-08-09 Thread Charlie Shepherd
Signed-off-by: Charlie Shepherd char...@ctshepherd.com --- block.c | 4 ++-- block/cow.c | 4 ++-- block/qcow.c | 4 ++-- block/qcow2.c | 4 ++-- block/qed.c | 4 ++-- block/raw-posix.c | 14 +++--- block

Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield

2013-08-08 Thread Charlie Shepherd
On 08/08/2013 07:16, Gabriel Kerneis wrote: On Thu, Aug 08, 2013 at 02:29:39AM +0100, Charlie Shepherd wrote: On 07/08/2013 23:13, Gabriel Kerneis wrote: On Wed, Aug 07, 2013 at 09:18:05PM +0200, Stefan Hajnoczi wrote: I guess the practical problem is that CPC will get upset that it's being

Re: [Qemu-devel] RFC: [PATCH 0/5] Explicitly annotating coroutine_fn functions

2013-08-08 Thread Charlie Shepherd
On 08/08/2013 08:15, Kevin Wolf wrote: Am 08.08.2013 um 03:22 hat Charlie Shepherd geschrieben: On 06/08/2013 10:37, Kevin Wolf wrote: Against which tree is this? It didn't apply on top of qemu-git master, nor on my block branch. Sorry, just to clarify, this isn't based on QEMU

Re: [Qemu-devel] [PATCH] Test coroutine execution order (v2)

2013-08-08 Thread Charlie Shepherd
On 08/08/2013 09:28, Stefan Hajnoczi wrote: On Thu, Aug 08, 2013 at 03:23:14AM +0100, Charlie Shepherd wrote: This patch's commit message will say Test coroutine execution order (v2) when applied. In the future please put the v2 into the [PATCH ...] tag list instead so it gets stripped

Re: [Qemu-devel] [PATCH 3/5] Convert BlockDriver to explicit coroutine annotations

2013-08-07 Thread Charlie Shepherd
On 06/08/2013 10:24, Kevin Wolf wrote: Am 05.08.2013 um 20:44 hat Charlie Shepherd geschrieben: This patch converts the .bdrv_open, .bdrv_file_open and .bdrv_create members of struct BlockDriver to be explicitly annotated as coroutine_fn, rather than yielding dynamically depending on whether

Re: [Qemu-devel] [PATCH 4/5] Convert block functions to coroutine versions

2013-08-07 Thread Charlie Shepherd
On 06/08/2013 10:36, Kevin Wolf wrote: Am 05.08.2013 um 20:44 hat Charlie Shepherd geschrieben: This patch follows on from the previous one and converts some block layer functions to be explicitly annotated with coroutine_fn instead of yielding depending upon calling context. --- block.c

Re: [Qemu-devel] [PATCH 5/5] Convert block layer callers' annotations

2013-08-07 Thread Charlie Shepherd
On 05/08/2013 21:15, Gabriel Kerneis wrote: On Mon, Aug 05, 2013 at 08:44:07PM +0200, Charlie Shepherd wrote: This patch updates the callers of block layer functions converted to explicit coroutine_fn annotation in the previous patch. It looks like this patch is made of three parts: - updating

Re: [Qemu-devel] [PATCH 1/5] Add an explanation of when a function should be marked coroutine_fn

2013-08-07 Thread Charlie Shepherd
On 06/08/2013 09:39, Stefan Hajnoczi wrote: On Mon, Aug 05, 2013 at 08:44:03PM +0200, Charlie Shepherd wrote: From: Charlie Shepherd cs...@cam.ac.uk Coroutine functions that can yield directly or indirectly should be annotated with a coroutine_fn annotation. Add an explanation to that effect

Re: [Qemu-devel] RFC: [PATCH 0/5] Explicitly annotating coroutine_fn functions

2013-08-07 Thread Charlie Shepherd
On 06/08/2013 10:37, Kevin Wolf wrote: Am 05.08.2013 um 20:44 hat Charlie Shepherd geschrieben: This patch series is a follow up to a previous RFC about converting functions that dynamically yield execution depending on whether they are in executing in a coroutine context

Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield

2013-08-07 Thread Charlie Shepherd
On 07/08/2013 20:18, Stefan Hajnoczi wrote: On Mon, Aug 05, 2013 at 08:44:04PM +0200, Charlie Shepherd wrote: From: Charlie Shepherd cs...@cam.ac.uk While it only really makes sense to call qemu_coroutine_self() in a coroutine context, it cannot actually yield execution itself, so remove

Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield

2013-08-07 Thread Charlie Shepherd
On 07/08/2013 23:13, Gabriel Kerneis wrote: On Wed, Aug 07, 2013 at 09:18:05PM +0200, Stefan Hajnoczi wrote: I guess the practical problem is that CPC will get upset that it's being called by the coroutine implementation from non-coroutine contexts. But is it really the case? If Charlie added

Re: [Qemu-devel] [PATCH 3/5] Convert BlockDriver to explicit coroutine annotations

2013-08-07 Thread Charlie Shepherd
On 07/08/2013 20:30, Stefan Hajnoczi wrote: On Mon, Aug 05, 2013 at 08:33:10PM +0100, Charlie Shepherd wrote: On 05/08/2013 20:23, Gabriel Kerneis wrote: On Mon, Aug 05, 2013 at 08:44:05PM +0200, Charlie Shepherd wrote: diff --git a/include/block/coroutine_int.h b/include/block

[Qemu-devel] RFC: [PATCH 0/5] Explicitly annotating coroutine_fn functions

2013-08-05 Thread Charlie Shepherd
-werror --target-list=x86_64-softmmu --cc=$CPC --extra-cflags=--noMakeStaticGlobal --useLogicalOperators --useCaseRange --save-temps -U__SSE2__ -w -Dcoroutine_fn='__attribute__((__cps__))' --docpsInference --warnall $ make Charlie Shepherd (5): Add an explanation of when

[Qemu-devel] [PATCH 1/5] Add an explanation of when a function should be marked coroutine_fn

2013-08-05 Thread Charlie Shepherd
From: Charlie Shepherd cs...@cam.ac.uk Coroutine functions that can yield directly or indirectly should be annotated with a coroutine_fn annotation. Add an explanation to that effect in include/block/coroutine.h. --- include/block/coroutine.h | 3 +++ 1 file changed, 3 insertions(+) diff --git

[Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield

2013-08-05 Thread Charlie Shepherd
From: Charlie Shepherd cs...@cam.ac.uk While it only really makes sense to call qemu_coroutine_self() in a coroutine context, it cannot actually yield execution itself, so remove the coroutine_fn annotation. --- include/block/coroutine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[Qemu-devel] [PATCH 3/5] Convert BlockDriver to explicit coroutine annotations

2013-08-05 Thread Charlie Shepherd
This patch converts the .bdrv_open, .bdrv_file_open and .bdrv_create members of struct BlockDriver to be explicitly annotated as coroutine_fn, rather than yielding dynamically depending on whether they are executed in a coroutine context or not. --- block.c | 16

[Qemu-devel] [PATCH 4/5] Convert block functions to coroutine versions

2013-08-05 Thread Charlie Shepherd
This patch follows on from the previous one and converts some block layer functions to be explicitly annotated with coroutine_fn instead of yielding depending upon calling context. --- block.c | 235 ++ block/mirror.c| 4 +-

[Qemu-devel] [PATCH 5/5] Convert block layer callers' annotations

2013-08-05 Thread Charlie Shepherd
This patch updates the callers of block layer functions converted to explicit coroutine_fn annotation in the previous patch. --- block/bochs.c| 4 ++-- block/cloop.c| 4 ++-- block/cow.c | 8 +++ block/dmg.c | 8 +++ block/qcow.c

[Qemu-devel] [PATCH] Test coroutine execution order

2013-08-05 Thread Charlie Shepherd
This patch adds a test for coroutine execution order in test-coroutine - this catches a bug in the CPC coroutine implementation. --- tests/test-coroutine.c | 54 ++ 1 file changed, 54 insertions(+) diff --git a/tests/test-coroutine.c

Re: [Qemu-devel] RFC: [PATCH 0/5] Explicitly annotating coroutine_fn functions

2013-08-05 Thread Charlie Shepherd
On 05/08/2013 19:44, Charlie Shepherd wrote: In order to compile the tree with CPC: $ git clone git://github.com/kerneis/cpc.git $ cd cpc $ make $ ./configure $ make $ cd .. $ export CPC=$(pwd)/cpc/bin/cpc $ cd qemu $ mkdir -p bin/cpc $ cd bin/cpc $ ../../configure

Re: [Qemu-devel] [PATCH 3/5] Convert BlockDriver to explicit coroutine annotations

2013-08-05 Thread Charlie Shepherd
On 05/08/2013 20:23, Gabriel Kerneis wrote: On Mon, Aug 05, 2013 at 08:44:05PM +0200, Charlie Shepherd wrote: This patch converts the .bdrv_open, .bdrv_file_open and .bdrv_create members of struct BlockDriver to be explicitly annotated as coroutine_fn, rather than yielding dynamically

[Qemu-devel] RFC [PATCH] Make bdrv_flush synchronous only and update callers

2013-07-18 Thread Charlie Shepherd
This patch makes bdrv_flush a synchronous function and updates any callers from a coroutine context to use bdrv_co_flush instead. The motivation for this patch comes from the GSoC Continuation-Passing C project. When coroutines were introduced, synchronous functions in the block layer were