[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 --- block/cow.c

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

2013-11-15 Thread Charlie Shepherd
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 (2): COW: Speed up writes COW: Extend checking allocated

[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 Reviewed-by: Paolo Bonzini --- block/

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 met

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 Thanks for your help with this series! Charlie

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

2013-11-06 Thread Charlie Shepherd
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 sector blo

[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 --- block/cow.c

[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 Reviewed-by: Paolo Bonzini --- block/

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 it

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

[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 --- block/cow.c | 79 - 1 file ch

[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 --- block/cow.c | 12

[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 Reviewed-by: Paolo Bonzini --- block/

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 exe

[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 --- 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 --- block/cow.c | 79 - 1 file ch

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

2013-11-06 Thread Charlie Shepherd
ll sectors 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/c

[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 --- block/cow.c | 9

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 02/80] pc: register e820 entries for ram

2013-11-06 Thread Charlie Shepherd
From: Gerd Hoffmann So RAM shows up in the new etc/e820 fw_cfg file. Cc: Andrea Arcangeli Signed-off-by: Gerd Hoffmann Signed-off-by: Charlie Shepherd --- hw/i386/pc.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index a653ae4

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

2013-11-06 Thread Charlie Shepherd
of entries can be figured from the file size. Cc: Andrea Arcangeli Signed-off-by: Gerd Hoffmann Signed-off-by: Charlie Shepherd --- hw/i386/pc.c | 39 --- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index dee409d

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

2013-11-06 Thread Charlie Shepherd
ult Antony Pavlov (1): milkymist-uart: Use Device::realize instead of SysBusDevice::init 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

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

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

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

2013-10-27 Thread Charlie Shepherd
erged 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 explan

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

2013-10-27 Thread Charlie Shepherd
From: Gabriel Kerneis 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 the former is not use

[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 --- include/block/coroutine.h | 8 1 file changed, 8 insertions(+) diff --git a

[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

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

[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 b/includ

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

2013-10-27 Thread Charlie Shepherd
erged 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

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

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_cac

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 --- block.c | 8 block/blkdebug.c | 4 ++-- block/blkverify.c | 4 ++-- block/bochs.c

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 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: cannot open shared object

[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 --- scripts/qapi-visit.py | 12 +--- 1 file changed

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

[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

[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 `tcg_

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 an

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_sect

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

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 spe

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

2013-08-20 Thread Charlie Shepherd
0 1M' test.cow Average over 3 runs: 351 Mb/s $ 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 --- block/cow.c | 119 ++

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 im

[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 --- block/cow.c | 116 1 file changed, 62 insertions(+), 54 deletions(-) diff --git a/block/cow.c b/block

[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 --- 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/raw.c

[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 --- block.c | 12 +++- include/block/block.h | 3 ++- 2 files changed, 5

[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 --- block.c | 56

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

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

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

[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 --- block.c | 12

[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 --- block.c | 37 + 1 file changed, 17

[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 --- block.c | 4 ++-- block/bochs.c | 2 +- block/cloop.c | 2 +- block/cow.c | 4 ++-- block

[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 --- include/block/coroutine.h | 4 ++-- qemu-coroutine-lock.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a

[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 --- qemu-img.c

[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 --- block/snapshot.c | 32 +++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/bl

[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 --- block.c | 106

[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 --- block/nbd.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index a0e3562..3e037ba 100644 --- a

[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 --- include/block/coroutine.h | 8 1 file changed, 8 insertions(+) diff --git a

[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

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 in

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 QEM

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

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

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 a

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

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 or not to be

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

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

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

[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 b/tests/test-c

[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 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 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 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield

2013-08-05 Thread Charlie Shepherd
From: Charlie Shepherd 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(-) diff --git a

[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 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 a/include/block

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

2013-08-05 Thread Charlie Shepherd
igure --enable-debug --disable-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 Ch

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